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

@sdispater sdispater commented Jul 12, 2019

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 CLI Feature labels Jul 12, 2019
@sdispater sdispater added this to the 1.0 milestone Jul 12, 2019
@sdispater sdispater added this to In progress in 1.0 via automation Jul 12, 2019
@sdispater sdispater force-pushed the improve-add-command branch 2 times, most recently from 86c4db7 to 154cdd1 Compare Jul 13, 2019
@sdispater sdispater merged commit c6a2d6e into develop Jul 13, 2019
4 checks passed
1.0 automation moved this from In progress to Done Jul 13, 2019
@sdispater sdispater deleted the improve-add-command branch Jul 13, 2019
@sdispater sdispater mentioned this pull request Aug 2, 2019
2 tasks
@sdispater sdispater moved this from Done to Closed in 1.0 Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
CLI Feature
No open projects

Successfully merging this pull request may close these issues.

None yet

1 participant