-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Support publishing git dependencies to PyPI using vendoring #2828
Comments
Can confirm that it would be great to at least have some documentation on recommendations around this problem. |
This is correct. The issue is a policy decision taken by PyPI. This is allowed since the PEPs make an explicit exception for public indices to disallow direct references in wheels.
Unfortunately, this is not trivial. You'll have to either build and vendor the library correctly; or embed the built wheel of the dependency into the project wheel. And then there is the matter extracting the right dependencies for the environment in which the wheel is built etc and list them as first level dependencies. Not to mention, manipulation of import paths can cause some unexpected side-effects.
Personally, it would be great to have a |
I think having
Any idea what that would look like? Thanks for taking the time to respond. |
There will be a few things to be considered when providing a solution. First of which would be to identify if this is infact a "core" requirement or a plugin wrapping around something like https://github.com/pradyunsg/vendoring. Either way, we will have to determine how vendoring happens. Pre-pending site directories? Or embedding in-package eg: Then there is evaluating the consequence of doing this for package resolution. Does ithis mean that, if your package depends on A and B (vendored, lets call it B'), and A depends on B (non vendored) the depenency resolver treats B and B' as separate packages? or the same but different versions? Both have consequences that can be problematic. These are the first things that come to my mind. To be clear, I am not proposing we do this. Just discussing the possibilities. I am always on the fence whether vendoring is a good thing or a bad thing and if poetry should promote it or discourage it. :) EDIT: Oh, also there is the conversation around how does a PEP 517 build handle this? Or is the scope of this limited to wheels built by poetry itself and not using poetry-core build backend? |
Consider this Enterprise use case: We have several internal packages that reference one another, and now we want to upload a big orchestrating package to a cloud platform to run this. The cloud platform has no access to our internal artifactory, and only gets the exported wheel from us. Vendoring contents tidily solves this issue. The next-best thing I can see is using the |
Closing as a specialized variant of #4583 as submodules + the feature proposed there make more sense. Poetry's use of VCS/Git dependencies is of the PEP 508/standard-to-the-ecosystem style. If you want to include arbitrary code vendored in to your install/built artifacts and control the paths, that issue tracks it. I don't think we'll ever overload the way Poetry defines Git dependencies to allow for the implicit vendoring requested in this issue -- instead, submodules and #4583 are the best way to achieve this, in a way that is more explicit and flexible. |
Publishing to PyPI is blocked until direct GitHub partridge dependency is removed (PyPI doesn't support direct dependencies, see python-poetry/poetry#2828). For now, instead install from gtfs2nx package from GitHub tag. Also update .gitignore to exclude GTFS zip files downloaded in the getting-started notebook.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Feature Request
I noticed that when trying to upload a package with a Git dep to PyPI, I get an error:
My research has told me that this is because PyPI does not support non-package dependencies.
I was thinking, could Poetry support publishing packages with Git deps by copying the the contents of the git repository at the provided ref into the source distribution, and rewriting imports if needed to make sure the package was imported from a local directory instead? Then the wheel could be built from that.
This way the Git dep would be bundled with the package's code, and PyPI wouldn't complain. I think this could be a great feature that would set Poetry apart.
The text was updated successfully, but these errors were encountered: