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

Arbitrary environment property for environment markers #5222

Closed
orctom opened this issue Feb 21, 2022 · 2 comments
Closed

Arbitrary environment property for environment markers #5222

orctom opened this issue Feb 21, 2022 · 2 comments
Labels
kind/feature Feature requests/implementations

Comments

@orctom
Copy link

orctom commented Feb 21, 2022

Say I have an app that have to be runnable on these boxes:

  • Ubuntu, with CUDA 11.4 (which requires the cu111 version)
  • Ubuntu, with CUDA 10.2 (cu111 doesn't work)
  • Ubuntu, CPU only
  • MacOS

If only for Linux and MacOS, we can use environment markers such as:

torch = [
  {version = "1.8.1", markers = "sys_platform == 'linux'"},
  {version = "1.8.1", markers = "sys_platform == 'darwin'"}
]

But there're no options for different CUDA versions.

Can we add an environment property specific markers such as markers_env.

PROPOSAL:
Manually set a env property on box, export any_name=any_value
In dependency section: markers_env = "any_name <= the_condition_value"

e.g.

# set env property on box manually
export cuda=10.2
[tool.poetry.dependencies]
#...
torch = [
  {version = "1.8.1", markers = "sys_platform == 'linux'", markers_env = "cuda < 11.1"},
  #{url = "https://download.pytorch.org/whl/cu111/torch-1.8.1%2Bcu111-cp38-cp38-linux_x86_64.whl", markers = "sys_platform == 'linux'", markers_env = "cuda >= 11.1"},
  {version = "1.8.1+cu111", source="pytorch", markers = "sys_platform == 'linux'", markers_env = "cuda >= 11.1"},
  {version = "1.8.1", markers = "sys_platform == 'darwin'"}
]

#...

[[tool.poetry.source]]
name = "pytorch"
url = "https://eternalphane.github.io/pytorch-pypi/"
secondary = true
#...
@orctom orctom added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Feb 21, 2022
@finswimmer
Copy link
Member

Hello @orctom,

while I understand your use case, this is nothing Poetry can or will solve by it's own. Each dependency definition must be transferable to a PEP-508 compliant string. The environment-markers section has a clear idea what is allowed here.

You could try starting a broader discussion at https://discuss.python.org or have a look there if there is already some discussion going on. Once there is excepted PEP we are glad to implement it into Poetry :)

fin swimmer

Copy link

github-actions bot commented Mar 2, 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 2, 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

No branches or pull requests

3 participants