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 24 commits into
base: main
Choose a base branch
from

Conversation

hculea
Copy link
Member

@hculea hculea commented Apr 30, 2024

Thanks to the prior work of @adriangb: #25

This will be picked up in the coming weeks. Would already appreciate a provisional review with high-level feedback on design!

@hculea hculea marked this pull request as draft April 30, 2024 13:24
@kareid kareid requested a review from Lucretiel May 1, 2024 15:04
@hculea hculea marked this pull request as ready for review May 28, 2024 15:01
@@ -14,6 +14,9 @@ thiserror = "1"
itertools = "0.12"
lazy_format = "2"
joinery = "2"
topological-sort = { version = "0.2.2"}
once_cell = { version = "1"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

#[derive(Debug, Clone)]
enum ParsedRusthThing<'a> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: parsedrustthing

/// Mappings from Rust type names to Python type names
pub type_mappings: HashMap<String, String>,
/// The Python module for the generated code.
pub module: RefCell<Module>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a refcell here?

module.add_global(identifier, vec![id.clone()])
}
RustType::Simple { id } => module.add_global(identifier, vec![id.clone()]),
RustType::Special(_) => {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type aliases for special types are unsupported?

| SpecialRustType::I64
| SpecialRustType::ISize
| SpecialRustType::USize => {
panic!("64 bit types not allowed in Typeshare")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're supported by python, though, so I'm not seeing any reason to fail here.

@Lucretiel
Copy link
Contributor

Doing some review, sorry for the delay. I'd like to ask for a high-level description in this MR for how this integration works, with especial focus on how structs are handled (in particular how the JSON <-> struct boundary is handled).

@MOmarMiraj MOmarMiraj force-pushed the hculea/add-python-support-in-typeshare branch from f4540ab to 85634d4 Compare July 31, 2024 19:42
@MOmarMiraj MOmarMiraj force-pushed the hculea/add-python-support-in-typeshare branch from 85634d4 to 48a8adb Compare July 31, 2024 19:42
@amandayu1 amandayu1 force-pushed the hculea/add-python-support-in-typeshare branch from fbfde61 to 5c88f19 Compare August 22, 2024 18:16
@amandayu1 amandayu1 force-pushed the hculea/add-python-support-in-typeshare branch 3 times, most recently from c901b1b to 9935aaf Compare August 22, 2024 20:19
@amandayu1 amandayu1 force-pushed the hculea/add-python-support-in-typeshare branch from 9935aaf to a74e4ce Compare August 22, 2024 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants