Skip to content

Add full environment markers support #1142

Merged
sdispater merged 1 commit into
developfrom
full-environment-markers-support
Jun 11, 2019
Merged

Add full environment markers support #1142
sdispater merged 1 commit into
developfrom
full-environment-markers-support

Conversation

@sdispater
Copy link
Copy Markdown
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
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'" }
Copy link
Copy Markdown

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.

@github-actions
Copy link
Copy Markdown

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