Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Typeshare support for Python #169

Open
wants to merge 60 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
90f7537
Add experimental typeshare support for Python
hculea Apr 30, 2024
ee5673c
Resolve clippy errors
hculea May 28, 2024
78bca98
Resolve merge conflicts with latest main
hculea May 28, 2024
dfd6522
Resolve merge conflicts with latest main
hculea May 28, 2024
0c14914
Add python as an option for the --lang flag
hculea May 28, 2024
439783b
Add support for todo and priorly unsupported types
hculea Jun 10, 2024
d7f12d0
Leverage mutable self to remove RefCell around Module
hculea Jun 10, 2024
2039818
Fix ParsedRusthThing typo
hculea Jun 10, 2024
48a8adb
Merge branch 'main' into hculea/add-python-support-in-typeshare
MOmarMiraj Jul 23, 2024
1427223
Merge branch '1Password:main' into hculea/add-python-support-in-types…
AndyTitu Aug 5, 2024
c9f4be4
Use serialization alias in renaming fields in Python
hculea Aug 5, 2024
ad6645a
Merge branch '1Password:main' into hculea/add-python-support-in-types…
hculea Aug 20, 2024
459f596
Fix python serializing and deserialzing using pydantic Field aliasing…
AndyTitu Aug 20, 2024
fde8907
Fix indentation of writing config dict
AndyTitu Aug 20, 2024
ead7d3a
added None default to Optional python type
amandayu1 Aug 20, 2024
a74e4ce
Updated None default condition
amandayu1 Aug 22, 2024
9b5c4be
fixing optional field set to default
amandayu1 Aug 22, 2024
628608d
add fix for missing fields
amandayu1 Aug 22, 2024
8519dea
added fix
amandayu1 Aug 22, 2024
6786aad
changed fix
amandayu1 Aug 22, 2024
2d0e627
testing new approach
amandayu1 Aug 22, 2024
169b380
Merge pull request #1 from hculea/optional-fields-default-to-none
amandayu1 Aug 22, 2024
e6bea87
added clarifying comment for None default
amandayu1 Aug 22, 2024
d51d903
set optional field to None by default
amandayu1 Aug 27, 2024
aa2213d
Bring Python fork up to date with main
hculea Oct 1, 2024
eeaa0d1
Run cargo fmt
hculea Oct 1, 2024
e79b7b6
fix duplicated " = None = None"
CheatCod Oct 1, 2024
d98a3e2
fix duplicate
CheatCod Oct 1, 2024
677cf13
add tests
CheatCod Oct 1, 2024
df4a611
add comments to test
CheatCod Oct 1, 2024
77b7239
minor formatting
CheatCod Oct 1, 2024
b3536c8
Remove level of indentation of type alias on comments
MOmarMiraj Oct 2, 2024
45e9e5f
Refactor Python Codegen to correctly top sort file and use typeshare …
MOmarMiraj Oct 3, 2024
c8026b0
Add Feature Flag for Python TS (#3)
MOmarMiraj Oct 28, 2024
e419246
Draft: Change tagged enum generation in python (#2)
CheatCod Oct 31, 2024
53b25db
Merge remote-tracking branch 'upstream/main' into hculea/add-python-s…
MOmarMiraj Oct 31, 2024
fb666ca
Add python support and update cargo lock
MOmarMiraj Oct 31, 2024
40206a7
fmt fix and fix rust doc
MOmarMiraj Oct 31, 2024
7184b52
update test cases
MOmarMiraj Oct 31, 2024
3d447df
Add mention of Python support in README
hculea Nov 4, 2024
a251db1
remove trailing comma
MOmarMiraj Nov 7, 2024
03d600b
Merge branch 'hculea/add-python-support-in-typeshare' of github.com:h…
MOmarMiraj Nov 7, 2024
61b6afd
Update unit enum to use enum values
MOmarMiraj Nov 7, 2024
9810e7b
fmt fix
MOmarMiraj Nov 7, 2024
92f6922
Remove config dict and allow unit enums to be serializble
MOmarMiraj Nov 7, 2024
0f89783
fix tuple variant generation
CheatCod Nov 8, 2024
90793c7
dedup union
CheatCod Nov 8, 2024
40803c4
better error handling
CheatCod Nov 8, 2024
23ecf7f
Merge pull request #4 from hculea/peter/fix-tuple-variant-generation
CheatCod Nov 8, 2024
ce97007
remove once-cell; use index-set
CheatCod Nov 12, 2024
260fa75
update tests
CheatCod Nov 12, 2024
d4fabb6
add comments on unused function for generics
CheatCod Nov 12, 2024
83001f7
refactor how union works. Note this requires the struct to be externa…
CheatCod Nov 14, 2024
6afd25a
proper rename
CheatCod Nov 14, 2024
0c9b8ac
use literal for tag keys
CheatCod Nov 15, 2024
a10d3e7
generate comments properly
CheatCod Nov 15, 2024
3df3ece
fix type aliasing issue
CheatCod Nov 15, 2024
533c75f
remove unneeded newlines
CheatCod Nov 15, 2024
4a0bb0e
fix to confrom python's wonderful doc conventions
CheatCod Nov 15, 2024
a49914a
use enum for type
CheatCod Nov 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 80 additions & 48 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ pub const ARG_OUTPUT_FOLDER: &str = "output-folder";
pub const ARG_FOLLOW_LINKS: &str = "follow-links";

#[cfg(feature = "go")]
const AVAILABLE_LANGUAGES: [&str; 5] = ["kotlin", "scala", "swift", "typescript", "go"];
const AVAILABLE_LANGUAGES: [&str; 6] = ["kotlin", "scala", "swift", "typescript", "go", "python"];

#[cfg(not(feature = "go"))]
const AVAILABLE_LANGUAGES: [&str; 4] = ["kotlin", "scala", "swift", "typescript"];
const AVAILABLE_LANGUAGES: [&str; 5] = ["kotlin", "scala", "swift", "typescript", "python"];

/// Parse command line arguments.
pub(crate) fn build_command() -> Command<'static> {
Expand Down
7 changes: 7 additions & 0 deletions cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ use std::{

const DEFAULT_CONFIG_FILE_NAME: &str = "typeshare.toml";

#[derive(Default, Serialize, Deserialize, PartialEq, Eq, Debug)]
#[serde(default)]
pub struct PythonParams {
pub type_mappings: HashMap<String, String>,
}

#[derive(Default, Serialize, Deserialize, Debug, PartialEq, Eq)]
#[serde(default)]
pub struct KotlinParams {
Expand Down Expand Up @@ -60,6 +66,7 @@ pub(crate) struct Config {
pub typescript: TypeScriptParams,
pub kotlin: KotlinParams,
pub scala: ScalaParams,
pub python: PythonParams,
#[cfg(feature = "go")]
pub go: GoParams,
}
Expand Down
Loading
Loading