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

Add full environment markers support #1142

Merged
merged 1 commit into from
Jun 11, 2019

Conversation

sdispater
Copy link
Member

Pull Request Check List

  • Added tests for changed code.
  • Updated documentation for changed code.

Up until now, Poetry only supported the python and platform properties to specify conditional dependencies. This PR adds support for any environment markers via the markers property.

[tool.poetry.dependencies]
pathlib2 = { version = "^2.2", markers = "python_version ~= '2.7' or sys_platform == 'win32'" }

@sdispater sdispater added the kind/feature Feature requests/implementations label May 31, 2019
@sdispater sdispater added this to the 1.0 milestone May 31, 2019
@@ -39,6 +39,9 @@ my-package = { path = "../project_with_setup/" }
# Dir dependency with pyproject.toml
simple-project = { path = "../simple_project/" }

# Dependency with markers
functools32 = { version = "^3.2.3", markers = "python_version ~= '2.7' and sys_platform == 'win32' or python_version in '3.4 3.5'" }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: This sample made me realize I have no idea how it would resolve. Is it (A and B) or (C), A and (B or C)? I had to go into the PEP and quickly scan it. Including the basics in poetry's documentation in clear examples might be useful.

Stolen from the PEP's tests:

    # Should parse as (a and b) or c
    "name; os_name=='a' and os_name=='b' or os_name=='c'",
    # Overriding precedence -> a and (b or c)
    "name; os_name=='a' and (os_name=='b' or os_name=='c')",
    # should parse as a or (b and c)
    "name; os_name=='a' or os_name=='b' and os_name=='c'",
    # Overriding precedence -> (a or b) and c
    "name; (os_name=='a' or os_name=='b') and os_name=='c'",

And even with those, I'm still a bit unclear on how it works with extras. Perhaps it's not poetry's responsiblity to document this clearly, but it certainly wouldn't hurt.

Copy link

github-actions bot commented Mar 1, 2024

This pull request 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 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants