-
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 Groups as Extras #4842
Comments
Side note (not sure if this should be a separate issue), but it would also be helpful if poetry export supported groups as well. My use case for this is that part of my code base is run as an azure functions app which has to be built with pip/requirements.txt. It would be helpful if I could do |
From #4891, Currently, using |
+1, this would be awesome to have. |
A lot of other comments seem to say that groups and extras are different things and extras are for runtime dependencies and groups are for development dependencies. This is a fair distinction except some tools (such as tox) are well used in development and does separate installation of the package. A well known work around is to use the extras essentially as groups. In short a big +1 for this feature as it allows grouping in toml but still outputting PEP compliant extras |
We have an FAQ entry about using tox -- note patterns 2 and 3 work with the use of groups, so what you want may already be possible in this case. |
I agree, this seems like a huge missed opportunity, groups are much nicer to work with. Perhaps if it's deemed necessary groups could be annotated with |
You're describing optional and non-optional groups -- non-optional (default) groups label and sort your dependencies but are always in the tree. Optional groups are used as a replacement for dev dependencies. Extras are inherently different as they can include the same package multiple time -- the current design of groups is not designed with similar functionality in mind. Given extras are a regular feature of the Python ecosystem, the current design for them is focused on familiarity and parity with the rest of the ecosystem. It is certainly possible to add interactions between groups and extras, but no one on the core team is (to the best of my knowledge) yet thinking about or working on such a feature. A cohesive design proposal/MR would be welcome, but would likely have to go through a decent amount of iteration to get it mergable. Also, any work on changing the project format is likely on hold until we can stabilize PEP 621 support. |
How can we elegantly solve this problem? [tool.poetry.dependencies]
python = "~3.10"
asyncpg = { version = "*", optional = true }
[tool.poetry.group.dev.dependencies]
pytest = "^7.2.0"
pytest-asyncio = "^0.20.2"
pytest-cov = "^4.0.0"
pytest-mock = "^3.10.0"
asyncpg-stubs = { version = "*", optional = true }
[tool.poetry.extras]
asyncpg = ["asyncpg", "asyncpg-stubs"] Command |
Optional dependencies outside the main group are meaningless in terms of extras. Move it to main and things will work as you expect. |
i imagine once pep 621 support is added this will be solved as it has a much nicer syntax for extras: [project]
dependencies = [
"foo ~= 1.0",
]
[project.optional-dependencies]
dev = [
"bar ~= 2.0",
] |
Let say I want to # myproject_1
[tool.poetry.dependencies]
package_1 = "^0.0.1"
# annoying repetition 1
package_2 = {version = "^0.0.2", optional = true}
package_3 = {version = "^0.0.3", optional = true}
[tool.poetry.group.group_a]
optional = true
[tool.poetry.group.group_a.dependencies]
package_2 = "^0.0.2"
package_3 = "^0.0.3"
# need to explicitly define "extras" for other packages install optional deps
[tool.poetry.extras]
group_a = ["package_2", "package_3"] # annoying repetition 2 It would be nice if I could write it concisely like: # myproject_1
[tool.poetry.dependencies]
package_1 = "^0.0.1"
[tool.poetry.group.group_a]
optional = true
extra = true # just 1 flag to avoid repetition
[tool.poetry.group.group_a.dependencies]
package_2 = "^0.0.2"
package_3 = "^0.0.3" There will be many cases in which you want to verify dependencies expressed in extras during development, so in many cases extras will soon become groups. Therefore, it would be very useful if we could express it as above. |
* initial commit * pre-commit * Add hub integration * pre-commit * use CommitOperation * Fix pre-commit * refactor * push changes * refactor * fix pre-commit * pre-commit * close the env and writer after eval * support dqn jax * pre-commit * Update cleanrl_utils/huggingface.py Co-authored-by: Lucain <[email protected]> * address comments * update docs * support dqn_atari_jax * bug fix and docs * Add cleanrl to the hf's `metadata` * include huggingface integration * test for enjoy.py * bump version, pip install extra hack python-poetry/poetry#4842 (comment) * Update cleanrl_utils/huggingface.py Co-authored-by: Lucain <[email protected]> * Update cleanrl_utils/huggingface.py Co-authored-by: Lucain <[email protected]> * Update cleanrl_utils/huggingface.py Co-authored-by: Lucain <[email protected]> * Update cleanrl_utils/huggingface.py Co-authored-by: Lucain <[email protected]> * Update cleanrl_utils/huggingface.py Co-authored-by: Lucain <[email protected]> * Update cleanrl_utils/huggingface.py Co-authored-by: Lucain <[email protected]> * update docs * update pre-commit * quick fix * bug fix * lazy load modules to avoid dependency issues * Add huggingface shields * Add emoji * Update docs * pre-commit * Update docs * Update docs * fix: use `algorithm_variant_filename` in model card reproduction script * typo fix * feat: add hf support for c51 * formatting fix * support pulling variant depdencies directly * support model saving for `ppo_atari_envpool_xla_jax_scan` * support `ppo_atari_envpool_xla_jax_scan` * quick change * support 'c51_jax' * formatting fix * support capture video * Add notebook * update docs * support `c51_atari` and `c51_atari_jax` * typo fix * add c51 to zoo docs * add colab badge * fix broken colab svg * pypi release * typo fix * update pre-commit * remove hf-integration reference Co-authored-by: Lucain <[email protected]> Co-authored-by: Kinal <[email protected]> Co-authored-by: Kinal Mehta <[email protected]>
Hello. I have another related bug #7743 to report. If I use the proposed solution from OP @jaymegordo, |
Hi, I've created a simple plugin that wraps the build command and allows mixing dependencies from a TOML option into a specified group, like the "main" group: toml:[tool.poetry-plugin-deps-juice]
"poetry" = [ # mix into ("main" alias)
# the groups list include from
"base",
"setup",
] Poetry build:poetry build && pkginfo -f requires_dist dist/*.whl output:
Juice plugin build:poetry jbuild && pkginfo -f requires_dist dist/*.whl output:
I think it's not the best solution, but it allows to put some dependency groups into the main (or else group) group without changing the TOML source for better readability. |
If I may I would like to point out, that this solution would also be extremely for tools that rely on pip, like cibuildwheel. Supplying test dependencies, without either code or data redundancy seems to be at the moment impossible I can either
which is hacky at best or by extra/group duplication like this
the above suggested, or similarly
would be concise and maintainable. |
Feature Request
There seems to be a few places where this issue is mentioned, but I don't see anything explicitly tracking it.
(Specifically @matthijskooijman's comment (point 2) 1644#issuecomment-895848818)
The new
groups
functionality is very helpful when managing packages installed while developing a project, but seems to miss a pretty good use case - basically usinggroups
in place ofextras
when installing this package in another environment.Instead of having to do:
It would be cleaner (and make more sense I think, once
groups
is out of preview), if we could just do:And then in
myproject_2
:The text was updated successfully, but these errors were encountered: