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

Automatically add extras entry for --optional #772

Closed
2 tasks done
xsduan opened this issue Jan 3, 2019 · 5 comments
Closed
2 tasks done

Automatically add extras entry for --optional #772

xsduan opened this issue Jan 3, 2019 · 5 comments

Comments

@xsduan
Copy link

xsduan commented Jan 3, 2019

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Question

So it took a while and 4 tries, but apparently to add extras you have to both do poetry add lib --optional and add a field in [tool.poetry.extras] as a list of dependencies for each group. It would be nice if the default behavior of poetry add lib --optional would either add a field in the extras section automatically or suggest adding a field into extras (like "to add as an extra, add lib = ["lib"] to [tool.poetry.extras]" or something), or at a minimum have a section in the docs on how to have "extras".

edit: nvm the extras does describe how to add, but i'd still like to have an cli option to add a new section automatically when add --optional (like add --peer?)

@xsduan xsduan changed the title Clarify how to add extras to project Automatically add extras entry for --optional Jan 3, 2019
@funkyfuture
Copy link
Contributor

@xsduan that result in something like this, right?

[tool.poetry.dependencies]
python = ">=3.6"
requests = {version = "^2.21",optional = true}

[tool.poetry.extras]
https-loader = ["requests"]

@mozartilize
Copy link

here is my example:

when I add gunicorn to deploy extras via poetry add gunicorn --optional --extras deploy, it adds to pyproject.toml like this

$ cat pyproject.toml
[tool.poetry]
name = "..."
version = "0.1.0"
description = ""
authors = ["..."]
license = "MIT"

[tool.poetry.dependencies]
python = "^3.6"
uvicorn = "^0.7.1"
wsproto = "^0.14.0"
gunicorn = {version = "^19.9",optional = true,extras = ["deploy"]}

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

As we see extras is in attribute, not in section and I think it's a bug.

When run install

$ poetry install -E deploy
Installing dependencies from lock file
                                    
[ValueError]         
Extra [deploy] is not specified.  
                                    
install [--no-dev] [--dry-run] [-E|--extras EXTRAS] [--develop DEVELOP]

@stale
Copy link

stale bot commented Nov 13, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 13, 2019
@stale
Copy link

stale bot commented Nov 20, 2019

Closing this issue automatically because it has not had any activity since it has been marked as stale. If you think it is still relevant and should be addressed, feel free to open a new one.

@stale stale bot closed this as completed Nov 20, 2019
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