Skip to content

Comments

refactor dependency specification parsing logic#5554

Merged
neersighted merged 2 commits intopython-poetry:masterfrom
abn:refactor-init-parse-requirements
May 7, 2022
Merged

refactor dependency specification parsing logic#5554
neersighted merged 2 commits intopython-poetry:masterfrom
abn:refactor-init-parse-requirements

Conversation

@abn
Copy link
Member

@abn abn commented May 6, 2022

This change moves, cleans up and refactors dependency specification parsing logic from InitCommand to poetry.utils.dependency_specification. This is done to improve usability and maintainability of this logic.

This has been bugging me for a while now, so decided to clean it up a bit.

Additionally, with this change, users can now add dependencies using valid PEP 508 strings.

$ poetry add 'cachecontrol[filecache] (>=0.12.9,<0.13.0); python_version >= "3.6"' --lock

Updating dependencies
Resolving dependencies... (0.5s)

Writing lock file
$ cat pyproject.toml | grep -i cachecontrol
CacheControl = {version = ">=0.12.9,<0.13.0", markers = "python_version >= \"3.6\"", extras = ["filecache"]}

@abn abn requested a review from a team May 6, 2022 20:22
@abn abn force-pushed the refactor-init-parse-requirements branch from 7d85d60 to 329908f Compare May 6, 2022 20:56
abn added 2 commits May 7, 2022 17:33
This change moves, cleans up and refactors dependency specification
parsing logic from `InitCommand` to
`poetry.utils.dependency_specification`. This is done to improve
usability and maintainability of this logic.
With this change, users can now add dependencies using valid PEP 508
strings.
@abn abn force-pushed the refactor-init-parse-requirements branch from cb05e08 to 49dda75 Compare May 7, 2022 15:41
Copy link
Member

@neersighted neersighted left a comment

Choose a reason for hiding this comment

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

This is a whole lot cleaner and easier to read -- nice work!

@neersighted neersighted merged commit 73a6dbe into python-poetry:master May 7, 2022
@abn abn deleted the refactor-init-parse-requirements branch May 7, 2022 16:26
@abn abn mentioned this pull request Jun 6, 2022
@github-actions
Copy link

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 Feb 29, 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

Successfully merging this pull request may close these issues.

2 participants