-
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 generation of poetry manged setup.py file #761
Comments
This change introduces `setuptools:setupfile` command that generates a `setup.py` file for the project. Resolves: python-poetry#761
This change introduces `setuptools setupfile` command that generates a `setup.py` file for the project. Resolves: python-poetry#761
This change introduces `setuptools setupfile` command that generates a `setup.py` file for the project. Resolves: python-poetry#761
@abn other way to do it is to actually publish each commit to Test PyPI :) |
@webknjaz that would definitely work for a subset of use cases. The generation of |
Won't pip 19.0 remove the need for this? (as it understands pyproject.toml) - you'll need to add some manual stuff to it though, until #744 is resolved. |
@cjw296 I will see if I can validate that, if pip understands poetry projects, that will most likely cover a large chunk of the use cases. However, without this change, the other tools need to either support PEP-518 or poetry projects explicitly. With that in mind, I do think this is still useful even if pip support is completed. |
Snaps require setuptools and setup.py, at least for now, so having way to generate setup.py from poetry would help with that. |
Any updates on that? |
dephell will do this for you:
Or you can add this to [tool.dephell.main]
from = {format = "poetry", path = "pyproject.toml"}
to = {format = "setuppy", path = "setup.py"} |
I have updated the PR to be a new export format instead of new command. |
I would be super glad to have that feature out-of-the-box. I looked quickly at dephell but the fact it added almost 30 dependencies to my project made me uncomfortable. |
One great reason to have this feature is that you cannot do
For now the dephell command up above did what I was looking for, but requried attrs>=19.2.0. Also dephell has 49 dependencies. |
DepHell is intended to be an outside tool like you have no poetry in your dependencies. The recommended way to install dephell is Also, most of the dependencies are part of dephell's own ecosystem (https://github.com/dephell/). And even after this, there are much fewer dependencies than even in pip (https://github.com/pypa/pip/tree/master/src/pip/_vendor), the only difference is they aren't vendorized for good reasons. Installation of all dependencies from the ground zero takes 17 seconds on TravisCI. So, it's more about decoupling than having a fat dependency tree. |
I feel I should point out that the |
For what it's worth, here is a small script that uses poetry itself to generate the |
@albireox nice, thank you for the script. Here are two other versions to find Poetry's lib.
|
@pawamoy: thanks, but you have an extra |
In fact, poetry generates a $ poetry build
$ tar -xvf dist/*.tar.gz --wildcards --no-anchored '*/setup.py' --strip=1 now your poetry project is pip-editable ;) |
You can also just use a setup-shim for most cases. cat "import setuptools; setuptools.setup()" > setup.py Note that having a setup file can cause some side-effects. |
I was getting errors with Running just |
Has there been any consensus on whether such a script/tool for keeping the generated I imagine it would be extremely useful, at least until pypa finally decide what to do when you need an editable install with only a |
I have a problem with readthedocs.io and I will require a |
Why do you think pip doesn't? |
Created a PR to allow exporting to setup.py |
Another implication for not having a
The message "expected string or bytes-like object" means |
@jfaleiro there must be another reason for the error you receive. poetry doesn't need a |
Since I am the original author of this issue, I will go ahead and close this. Since 2018, the status quo has changed. This is no longer a useful change or a core feature for poetry. Additionally, my original need is no longer a concern as there is better developer tooling support for poetry now. For cases where a "legacy" editable mode is desireable you can simply make use of a import setuptools; setuptools.setup() Note: add name and version if you want sensible metadata that is not Poetry itself now implements an editable install support for projects it manages. That might coer a few use cases. Furhtermore, poetry is in the process of removing the internal supprot for generating |
I also have this problem. After reviewing the poetry source code, I found a solution and packaged it into a pypi package. https://github.com/abersheeran/poetry2setup In short, you only need to execute two commands in the project to generate the
|
Can't you install from a pyproject.toml now? |
Like this? |
@ThatXliner Yes, due to some open secrets (in China). When using |
For anyway that stumbles into this thread like I have, note that the latest version of |
via pip install poetry2setup poetry2setup > setup.py see python-poetry/poetry#761 (comment)
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. |
Issue
As things stand today, poetry packages cannot be installed using
pip
or any other package managers from a VCS. This is useful when working with unreleased/unpublished versions of dependencies, where dependencies are managed by 'pip' or another tool. This was briefly touched on in #34 for a similar use case.With this in mind, it could be great if poetry provided a solution, in a limited capacity, similar to what is implemented by poetry-setup. In order to achieve this, poetry could provide a command, eg:
poetry setuptools:setupfile
, that generates a usablesetup.py
file using the mechanism used today bySdistBuilder
.In theory, this could be migrated to be a plugin once #693 is implemented.
As an example. this, if implemented, could be used by projects as a pre-commit hook to generate
setup.py
file on commit. This should allow projects usingpip
etc. to install unpublished projects developed using poetry (if the maintainer wants it).In addition to the above use case, this also allows for tools like PyCharm etc., to auto detect requirements and metadata.
Can follow this up with a proposed implementation PR.
Relates-to: #34
The text was updated successfully, but these errors were encountered: