-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
WIP: src layout for python #501
Conversation
IMO |
My idea was this should work with something like the following layout:
This is similar to e.g. https://github.com/huggingface/tokenizers I also thought that the _src suffix makes it clearer that the directory would be named |
d03b559
to
9d4f106
Compare
I had an idea for very different design which I think would be better. The core idea is that for a pure rust project, it's a rust project (represented by Cargo.toml) but for a mixed project, it's a python project (represented by pyproject.toml) with an added rust submodule. For a pure rust project, still point
This is more verbose than before, but it has the advantage of using the normal src layout for python while also having no confusion about the subfolder name (it's always |
For existing Python projects adding a Rust extension to boost performance, this layout is quite nice. But for Rust projects adding a Python binding, it's a little annoying to have to move Rust source into a |
I think the overall proposal is quite agreeable. Do you think it'd be possible to make this the default "mixed layout" and add configuration options to allow users to customise the project layout a bit if they wanted? e.g. I think in
I agree with both of these points. I wonder if some automated commands e.g.
|
As has been said maturin's value to the whole spectrum from "rust project with thin python bindings" to "python project with a few lines of rust" will always introduce a conflict. Every change breaks a workflow, of course, but in my projects I tend to rely on rust tooling for tracking versions etc. (cargo-release for releases, then the rust core stores |
Closing in favor of #1185 |
For a mixed project with the current layout, python will always pick the local folder over the installed version, causing a number of problems (#335 (comment)). In pure python projects, this can be solved with the
src
layout. For rust projects, cargo already occupiessrc
, so I've named the folderpython_src
(name open to bikeshedding). With this changepyo3-src-layout/pyo3_src_layout/__init__.py
andpyo3-src-layout/python_src/pyo3_src_layout/__init__.py
both work.I hope this doesn't collide with #489.
Closes #335