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
merged 5 commits into from Jul 13, 2019
Merged

Improve the add and init commands #1221

merged 5 commits into from Jul 13, 2019

Conversation

@sdispater
Copy link
Member

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+https://github.com/sdispater/pendulum.git
poetry add git+https://github.com/sdispater/pendulum.git@develop
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 (https://github.com/sdispater/poetry.git)
  - A git url with a revision (https://github.com/sdispater/poetry.git@develop)
  - 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 added 4 commits Jul 11, 2019
…able
@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 Jul 12, 2019
@sdispater sdispater force-pushed the improve-add-command branch from 154cdd1 to 993eaac Jul 13, 2019
@sdispater sdispater merged commit c6a2d6e into develop Jul 13, 2019
4 checks passed
4 checks passed
continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
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 Sep 30, 2019
2 of 2 tasks complete
@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
Projects
1.0
  
Closed
1 participant
You can’t perform that action at this time.