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

Improve the add and init commands #1221

merged 5 commits into from
Jul 13, 2019

Improve the add and init commands #1221

merged 5 commits into from
Jul 13, 2019


Copy link

Pull Request Check List

  • Added tests for changed code.
  • Updated documentation for changed code.

This PR improves the add and init commands in the following ways.

Easier addition of git and path dependencies

It's now easier to add git and path dependencies, and they can now be added at the same time as other packages:

poetry add requests git+
poetry add git+
poetry add ./my-package/
poetry add ../my-package/dist/my_package-0.1.0.whl

It also removes the --git and --path options since they are no longer needed.

Since the logic is shared, init now supports adding git and path dependencies and you get a new message before adding your first package:

You can specify a package in the following forms:
  - A single name (requests)
  - A name and a constraint (requests ^2.23.0)
  - A git url (
  - A git url with a revision (
  - A file path (../my-package/my-package.whl)
  - A directory (../my-package/)

Bump the constraint of an existing depency

You can now update the constraint of an already present dependency (which would raise an error previously) by specifying a specific constraint or by using the special latest constraint:

poetry add pendulum@^2.0.5
poetry add pendulum@latest

Better handling of prereleases

Now, if a package only has prereleases, the highest one will be selected. Before this change, the command would return a message saying the package didn't have any version matching the constraint.

$ poetry add black --dev
Using version ^19.3b0 for black

@sdispater sdispater added area/cli Related to the command line kind/feature Feature requests/implementations labels Jul 12, 2019
@sdispater sdispater added this to the 1.0 milestone Jul 12, 2019
@sdispater sdispater force-pushed the improve-add-command branch 2 times, most recently from 86c4db7 to 154cdd1 Compare July 13, 2019 15:31
Copy link

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.
area/cli Related to the command line kind/feature Feature requests/implementations
None yet

Successfully merging this pull request may close these issues.

None yet

1 participant