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

Support for PEP508 #21

Closed
escaped opened this issue Mar 19, 2018 · 7 comments
Closed

Support for PEP508 #21

escaped opened this issue Mar 19, 2018 · 7 comments

Comments

@escaped
Copy link

escaped commented Mar 19, 2018

With PEP508 you can limit certain package to a specific platforms, e.g. waitress==1.0.2;platform_system=="Windows" to install waitress only on Windows.

It seem like poetry doesn't support this feature at all or at least i wasn't able to specify the constraint from above. Neither poetry add waitress==1.0.2;platform_system=="Windows" nor writing waitress = "=1.0.2;platform_system=Windows" to the pyproject.toml works.

@sdispater
Copy link
Member

Thanks for your interest in Poetry!

As of now, neither the add command nor the pyproject.toml support PEP 508 when specifying dependencies. And while the pyproject.toml might support it in the future, the add command will most likely not.

The reason for it is that PEP 508 is not really readable when you have markers:

waitress==1.0.2;platform_system="Windows"

is, in my opinion, less readable than:

waitress = { version = "1.0.2", system = "Windows" }  # pyproject.tml

or for the add command:

poetry add waitress=1.0.2 --system Windows

Note that this is not yet supported but this is an idea of what one might expect in a near future for Poetry.

@escaped
Copy link
Author

escaped commented May 16, 2018

Hey @sdispater,

i wonder why you closed this issue. I checked the recent release and could not find anything related to this issue except for extras, which does not include plattform specific identifiers. I still think it would be really nice to automatically decide whether a required dependency should be installed. Examples for such packages would be:

  • pyinotify, which works only on linux
  • enum34, which is required for python <3.4

@jacebrowning
Copy link
Contributor

jacebrowning commented May 22, 2018

I would use this for pync, which only works on macOS.

And I agree that { version = "*", system = "macOS" } is much more readable that what it would need to map to for PEP508 (sys_platform="darwin").

@sdispater
Copy link
Member

The sys_platform constraint is supported by writing your dependency like this:

my-dependency = { version: "*",  "platform": "darwin"}

Note, however, that due to a bug it will be lost if/when packaging/publishing your project. This will likely be fixed in the 0.10.0 release.

@jacebrowning
Copy link
Contributor

With 0.10.0-alpha.1, this line in pyproject.toml:

pync = { version = '*', platform = 'darwin' }

causes this error with $ poetry lock:

[InvalidProjectFile]
[dev-dependencies.pync] {'version': '*', 'platform': 'darwin'} is not valid under any of the given schemas

@sdispater
Copy link
Member

@jacebrowning It should be fixed in the latest 0.10.0a2 prerelease.

diabonas added a commit to diabonas/weechat-matrix that referenced this issue Mar 30, 2020
Using environment markers in the version is not allowed
(python-poetry/poetry#21).
dimbleby pushed a commit to dimbleby/poetry that referenced this issue Apr 21, 2022
Copy link

github-actions bot commented Mar 3, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants