Skip to content

Commit

Permalink
Merge pull request #283 from liquidiert/feature/python_support
Browse files Browse the repository at this point in the history
feat: #56 Python support
  • Loading branch information
andrewmd5 authored Nov 9, 2023
2 parents 6287e6c + dfc0eed commit 751a893
Show file tree
Hide file tree
Showing 30 changed files with 3,111 additions and 170 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
with:
toolchain: stable
profile: minimal
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Setup Node
uses: actions/setup-node@v1
with:
Expand All @@ -41,6 +45,12 @@ jobs:
yarn test
yarn build
working-directory: ./Runtime/TypeScript
- name: Build Python runtime
run: |
pip install build
python -m build
pip install dist/*.whl
working-directory: ./Runtime/Python
- name: yarn install
run: yarn install
working-directory: ${{env.TEST_ROOT}}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,4 @@ Laboratory/C#/Benchmarks/BenchmarkDotNet.Artifacts
Core/Meta/VersionInfo.cs

.DS_Store
.vscode
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/Compiler/bin/Debug/net7.0/bebopc.dll",
"args": [],
"program": "${workspaceFolder}/bin/compiler/Debug/artifacts/bebopc.dll",
"args": ["--config", "bebop.json"],
"cwd": "${workspaceFolder}/Compiler",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
Expand Down
7 changes: 6 additions & 1 deletion Compiler/CommandLineFlags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ public class CommandLineFlags
"--ts ./my/output/HelloWorld.ts", true)]
public string? TypeScriptOutput { get; private set; }

[CommandLineFlag("py", "Generate Python source code to the specified file",
"--py ./my/output/HelloWorld.py", true)]
public string? PythonOutput { get; private set; }

[CommandLineFlag("namespace", "When this option is specified generated code will use namespaces",
"--cs --namespace [package]")]
public string? Namespace { get; private set; }
Expand Down Expand Up @@ -277,7 +281,8 @@ public class CommandLineFlags
["cs"] = TempoServices.Both,
["dart"] = TempoServices.Both,
["rust"] = TempoServices.Both,
["ts"] = TempoServices.Both
["ts"] = TempoServices.Both,
["py"] = TempoServices.Both
};

/// <summary>
Expand Down
6 changes: 5 additions & 1 deletion Core/Generators/GeneratorUtils.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Runtime.Serialization;
using System;
using System.Collections.Generic;
using System.Text;
using Core.Generators.CPlusPlus;
using Core.Generators.CSharp;
using Core.Generators.Dart;
using Core.Generators.Rust;
using Core.Generators.TypeScript;
using Core.Generators.Python;
using Core.Meta;
using Core.Meta.Extensions;

Expand Down Expand Up @@ -121,6 +123,7 @@ public static string BaseClassName(this Definition definition)
{ "dart", s => new DartGenerator(s) },
{ "rust", s => new RustGenerator(s) },
{ "ts", s => new TypeScriptGenerator(s) },
{ "py", s => new PythonGenerator(s) }
};

public static Dictionary<string, string> ImplementedGeneratorNames = new()
Expand All @@ -130,6 +133,7 @@ public static string BaseClassName(this Definition definition)
{ "dart", "Dart" },
{ "rust", "Rust" },
{ "ts", "TypeScript" },
{ "py", "Python" }
};

/// <summary>
Expand Down
Loading

0 comments on commit 751a893

Please sign in to comment.