How to share Python code between multiple packages without needing to publish the code as a library #2269
Unanswered
gaborbernat
asked this question in
Q&A
Replies: 1 comment 6 replies
-
|
Does any other general purpose python packaging tools support this kind of setup? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So this question is a variation of the monorepo support. Imagine you have a project that generates 2 or more (e.g. A, B) distinct maturin projects. However, there's some common code you want to share between them:
. ├── Cargo.lock ├── Cargo.toml ├── rust-common │ ├── Cargo.toml │ ├── src │ └── target ├── py-common │ ├── CHANGELOG.md │ ├── pyproject.toml │ └── src ├── A │ ├── Cargo.toml │ ├── pyproject.toml │ ├── rust │ └── src ├── B │ ├── Cargo.toml │ ├── pyproject.toml │ ├── rust │ └── src └── rust-toolchain.tomlSharing the rust code (hosted here in
rust-commonwithout needing to publish the crate is possible viacargoallowing relative paths for dependencies and rust has avirtualworkspace feature. The question is: How can you share the Python code? The Python part of PEP-621 does not allow relative paths independencies.Ideally, I would be able to take the content of
srcfrompy-commonand mount it (copy it, symlink it) undersrc/a/py-common. Something like:Which would then cause:
Things I have tried:
python-packageswith a relative path, but this does not make sense because is unclear where it should live.Example project tox-dev/toml-fmt#12, in this case trying to share
py-commonunderpyproject-fmt, without needing to publish thepy-commontoPyPI.Beta Was this translation helpful? Give feedback.
All reactions