Commit 13bd6400 by Sébastien Eustace Committed by GitHub

Change lock file name from pyproject.lock to poetry.lock (#447)

* Rename pyproject.lock to poetry.lock

* Update reference to pyproject.lock
parent 2dc80cff
...@@ -56,7 +56,7 @@ Poetry uses this information to search for the right set of files in package "re ...@@ -56,7 +56,7 @@ Poetry uses this information to search for the right set of files in package "re
in the `tool.poetry.repositories` section, or on [PyPI](https://pypi.org) by default. in the `tool.poetry.repositories` section, or on [PyPI](https://pypi.org) by default.
Also, instead of modifying the `pyproject.toml` file by hand, you can use the `add` command. Also, instead of modifying the `pyproject.toml` file by hand, you can use the `add` command.
```bash ```bash
$ poetry add pendulum $ poetry add pendulum
``` ```
...@@ -75,50 +75,50 @@ Please read [versions](/versions/) for more in-depth information on versions, ho ...@@ -75,50 +75,50 @@ Please read [versions](/versions/) for more in-depth information on versions, ho
!!!note !!!note
**How does Poetry download the right files?** **How does Poetry download the right files?**
When you specify a dependency in `pyproject.toml`, Poetry first take the name of the package When you specify a dependency in `pyproject.toml`, Poetry first take the name of the package
that you have requested and searches for it in any repository you have registered using the `repositories` key. that you have requested and searches for it in any repository you have registered using the `repositories` key.
If you have not registered any extra repositories, or it does not find a package with that name in the If you have not registered any extra repositories, or it does not find a package with that name in the
repositories you have specified, it falls back on PyPI. repositories you have specified, it falls back on PyPI.
When Poetry finds the right package, it then attempts to find the best match When Poetry finds the right package, it then attempts to find the best match
for the version constraint you have specified. for the version constraint you have specified.
## Installing dependencies ## Installing dependencies
To install the defined dependencies for your project, just run the `install` command. To install the defined dependencies for your project, just run the `install` command.
```bash ```bash
poetry install poetry install
``` ```
When you run this command, one of two things may happen: When you run this command, one of two things may happen:
### Installing without `pyproject.lock` ### Installing without `poetry.lock`
If you have never run the command before and there is also no `pyproject.lock` file present, If you have never run the command before and there is also no `poetry.lock` file present,
Poetry simply resolves all dependencies listed in your `pyproject.toml` file and downloads the latest version of their files. Poetry simply resolves all dependencies listed in your `pyproject.toml` file and downloads the latest version of their files.
When Poetry has finished installing, it writes all of the packages and the exact versions of them that it downloaded to the `pyproject.lock` file, When Poetry has finished installing, it writes all of the packages and the exact versions of them that it downloaded to the `poetry.lock` file,
locking the project to those specific versions. locking the project to those specific versions.
You should commit the `pyproject.lock` file to your project repo so that all people working on the project are locked to the same versions of dependencies (more below). You should commit the `poetry.lock` file to your project repo so that all people working on the project are locked to the same versions of dependencies (more below).
### Installing with `pyproject.lock` ### Installing with `poetry.lock`
This brings us to the second scenario. If there is already a `pyproject.lock` file as well as a `pyproject.toml` file This brings us to the second scenario. If there is already a `poetry.lock` file as well as a `pyproject.toml` file
when you run `poetry install`, it means either you ran the `install` command before, when you run `poetry install`, it means either you ran the `install` command before,
or someone else on the project ran the `install` command and committed the `pyproject.lock` file to the project (which is good). or someone else on the project ran the `install` command and committed the `poetry.lock` file to the project (which is good).
Either way, running `install` when a `pyproject.lock` file is present resolves and installs all dependencies that you listed in `pyproject.toml`, Either way, running `install` when a `poetry.lock` file is present resolves and installs all dependencies that you listed in `pyproject.toml`,
but Poetry uses the exact versions listed in `pyproject.lock` to ensure that the package versions are consistent for everyone working on your project. but Poetry uses the exact versions listed in `poetry.lock` to ensure that the package versions are consistent for everyone working on your project.
As a result you will have all dependencies requested by your `pyproject.toml` file, As a result you will have all dependencies requested by your `pyproject.toml` file,
but they may not all be at the very latest available versions but they may not all be at the very latest available versions
(some of the dependencies listed in the `pyproject.lock` file may have released newer versions since the file was created). (some of the dependencies listed in the `poetry.lock` file may have released newer versions since the file was created).
This is by design, it ensures that your project does not break because of unexpected changes in dependencies. This is by design, it ensures that your project does not break because of unexpected changes in dependencies.
### Commit your `pyproject.lock` file to version control ### Commit your `poetry.lock` file to version control
Committing this file to VC is important because it will cause anyone who sets up the project Committing this file to VC is important because it will cause anyone who sets up the project
to use the exact same versions of the dependencies that you are using. to use the exact same versions of the dependencies that you are using.
...@@ -132,20 +132,20 @@ the dependencies installed are still working even if your dependencies released ...@@ -132,20 +132,20 @@ the dependencies installed are still working even if your dependencies released
!!!note !!!note
For libraries it is not necessary to commit the lock file. For libraries it is not necessary to commit the lock file.
## Updating dependencies to their latest versions ## Updating dependencies to their latest versions
As mentioned above, the `pyproject.lock` file prevents you from automatically getting the latest versions As mentioned above, the `poetry.lock` file prevents you from automatically getting the latest versions
of your dependencies. of your dependencies.
To update to the latest versions, use the `update` command. To update to the latest versions, use the `update` command.
This will fetch the latest matching versions (according to your `pyproject.toml` file) This will fetch the latest matching versions (according to your `pyproject.toml` file)
and update the lock file with the new versions. and update the lock file with the new versions.
(This is equivalent to deleting the `pyproject.lock` file and running `install` again.) (This is equivalent to deleting the `poetry.lock` file and running `install` again.)
!!!note !!!note
Poetry will display a **Warning** when executing an install command if `pyproject.lock` and `pyproject.toml` Poetry will display a **Warning** when executing an install command if `poetry.lock` and `pyproject.toml`
are not synchronized. are not synchronized.
...@@ -159,7 +159,7 @@ or create a brand new one for you to always work isolated from your global Pytho ...@@ -159,7 +159,7 @@ or create a brand new one for you to always work isolated from your global Pytho
The created virtualenv will use the Python executable for which The created virtualenv will use the Python executable for which
`poetry` has been installed. `poetry` has been installed.
What this means is if you project is Python 2.7 only you should What this means is if you project is Python 2.7 only you should
install `poetry` for your global Python 2.7 executable and use install `poetry` for your global Python 2.7 executable and use
it to manage your project. it to manage your project.
...@@ -103,11 +103,11 @@ resolves the dependencies, and installs them. ...@@ -103,11 +103,11 @@ resolves the dependencies, and installs them.
poetry install poetry install
``` ```
If there is a `pyproject.lock` file in the current directory, If there is a `poetry.lock` file in the current directory,
it will use the exact versions from there instead of resolving them. it will use the exact versions from there instead of resolving them.
This ensures that everyone using the library will get the same versions of the dependencies. This ensures that everyone using the library will get the same versions of the dependencies.
If there is no `pyproject.lock` file, Poetry will create one after dependency resolution. If there is no `poetry.lock` file, Poetry will create one after dependency resolution.
You can specify to the command that you do not want the development dependencies installed by passing You can specify to the command that you do not want the development dependencies installed by passing
the `--no-dev` option. the `--no-dev` option.
...@@ -131,14 +131,14 @@ poetry install -E mysql -E pgsql ...@@ -131,14 +131,14 @@ poetry install -E mysql -E pgsql
## update ## update
In order to get the latest versions of the dependencies and to update the `pyproject.lock` file, In order to get the latest versions of the dependencies and to update the `poetry.lock` file,
you should use the `update` command. you should use the `update` command.
```bash ```bash
poetry update poetry update
``` ```
This will resolve all dependencies of the project and write the exact versions into `pyproject.lock`. This will resolve all dependencies of the project and write the exact versions into `poetry.lock`.
If you just want to update a few packages and not all, you can list them as such: If you just want to update a few packages and not all, you can list them as such:
......
...@@ -18,7 +18,7 @@ This has many advantages for the end users and allows them to set appropriate ...@@ -18,7 +18,7 @@ This has many advantages for the end users and allows them to set appropriate
## Lock file ## Lock file
For your library, you may commit the `pyproject.lock` file if you want to. For your library, you may commit the `poetry.lock` file if you want to.
This can help your team to always test against the same dependency versions. This can help your team to always test against the same dependency versions.
However, this lock file will not have any effect on other projects that depend on it. However, this lock file will not have any effect on other projects that depend on it.
It only has an effect on the main project. It only has an effect on the main project.
...@@ -59,10 +59,10 @@ and you have [configured your credentials](/repositories/#adding-credentials) pr ...@@ -59,10 +59,10 @@ and you have [configured your credentials](/repositories/#adding-credentials) pr
!!!note !!!note
The `publish` command does not execute `build` by default. The `publish` command does not execute `build` by default.
If you want to build and publish your packages together, If you want to build and publish your packages together,
just pass the `--build` option. just pass the `--build` option.
Once this is done, your library will be available to anyone. Once this is done, your library will be available to anyone.
......
...@@ -699,7 +699,7 @@ name = "tox" ...@@ -699,7 +699,7 @@ name = "tox"
optional = false optional = false
platform = "unix" platform = "unix"
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "3.3.0" version = "3.4.0"
[package.dependencies] [package.dependencies]
pluggy = ">=0.3.0,<1" pluggy = ">=0.3.0,<1"
...@@ -811,7 +811,7 @@ six = ["70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", "832d ...@@ -811,7 +811,7 @@ six = ["70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", "832d
toml = ["380178cde50a6a79f9d2cf6f42a62a5174febe5eea4126fe4038785f1d888d42", "a7901919d3e4f92ffba7ff40a9d697e35bbbc8a8049fe8da742f34c83606d957"] toml = ["380178cde50a6a79f9d2cf6f42a62a5174febe5eea4126fe4038785f1d888d42", "a7901919d3e4f92ffba7ff40a9d697e35bbbc8a8049fe8da742f34c83606d957"]
tomlkit = ["8ab16e93162fc44d3ad83d2aa29a7140b8f7d996ae1790a73b9a7aed6fb504ac", "ca181cee7aee805d455628f7c94eb8ae814763769a93e69157f250fe4ebe1926"] tomlkit = ["8ab16e93162fc44d3ad83d2aa29a7140b8f7d996ae1790a73b9a7aed6fb504ac", "ca181cee7aee805d455628f7c94eb8ae814763769a93e69157f250fe4ebe1926"]
tornado = ["0662d28b1ca9f67108c7e3b77afabfb9c7e87bde174fbda78186ecedc2499a9d", "4e5158d97583502a7e2739951553cbd88a72076f152b4b11b64b9a10c4c49409", "732e836008c708de2e89a31cb2fa6c0e5a70cb60492bee6f1ea1047500feaf7f", "8154ec22c450df4e06b35f131adc4f2f3a12ec85981a203301d310abf580500f", "8e9d728c4579682e837c92fdd98036bd5cdefa1da2aaf6acf26947e6dd0c01c5", "d4b3e5329f572f055b587efc57d29bd051589fb5a43ec8898c77a47ec2fa2bbb", "e5f2585afccbff22390cddac29849df463b252b711aa2ce7c5f3f342a5b3b444"] tornado = ["0662d28b1ca9f67108c7e3b77afabfb9c7e87bde174fbda78186ecedc2499a9d", "4e5158d97583502a7e2739951553cbd88a72076f152b4b11b64b9a10c4c49409", "732e836008c708de2e89a31cb2fa6c0e5a70cb60492bee6f1ea1047500feaf7f", "8154ec22c450df4e06b35f131adc4f2f3a12ec85981a203301d310abf580500f", "8e9d728c4579682e837c92fdd98036bd5cdefa1da2aaf6acf26947e6dd0c01c5", "d4b3e5329f572f055b587efc57d29bd051589fb5a43ec8898c77a47ec2fa2bbb", "e5f2585afccbff22390cddac29849df463b252b711aa2ce7c5f3f342a5b3b444"]
tox = ["433bb93c57edae263150767e672a0d468ab4fefcc1958eb4013e56a670bb851e", "bfb4e4efb7c61a54bc010a5c00fdbe0973bc4bdf04090bfcd3c93c901006177c"] tox = ["7f802b37fffd3b5ef2aab104943fa5dad24bf9564bb7e732e54b8d0cfec2fca0", "cc97859bd7f38aa5b3b8ba55ffe7ee9952e7050faad1aedc0829cd3db2fb61d6"]
typing = ["4027c5f6127a6267a435201981ba156de91ad0d1d98e9ddc2aa173453453492d", "57dcf675a99b74d64dacf6fba08fb17cf7e3d5fdff53d4a30ea2a5e7e52543d4", "a4c8473ce11a65999c8f59cb093e70686b6c84c98df58c1dae9b3b196089858a"] typing = ["4027c5f6127a6267a435201981ba156de91ad0d1d98e9ddc2aa173453453492d", "57dcf675a99b74d64dacf6fba08fb17cf7e3d5fdff53d4a30ea2a5e7e52543d4", "a4c8473ce11a65999c8f59cb093e70686b6c84c98df58c1dae9b3b196089858a"]
urllib3 = ["a68ac5e15e76e7e5dd2b8f94007233e01effe3e50e8daddf69acfd81cb686baf", "b5725a0bd4ba422ab0e66e89e030c806576753ea3ee08554382c14e685d117b5"] urllib3 = ["a68ac5e15e76e7e5dd2b8f94007233e01effe3e50e8daddf69acfd81cb686baf", "b5725a0bd4ba422ab0e66e89e030c806576753ea3ee08554382c14e685d117b5"]
virtualenv = ["2ce32cd126117ce2c539f0134eb89de91a8413a29baac49cbab3eb50e2026669", "ca07b4c0b54e14a91af9f34d0919790b016923d157afda5efdde55c96718f752"] virtualenv = ["2ce32cd126117ce2c539f0134eb89de91a8413a29baac49cbab3eb50e2026669", "ca07b4c0b54e14a91af9f34d0919790b016923d157afda5efdde55c96718f752"]
......
...@@ -13,7 +13,7 @@ class InstallCommand(EnvCommand): ...@@ -13,7 +13,7 @@ class InstallCommand(EnvCommand):
{ --develop=* : Install given packages in development mode. } { --develop=* : Install given packages in development mode. }
""" """
help = """The <info>install</info> command reads the <comment>pyproject.lock</> file from help = """The <info>install</info> command reads the <comment>poetry.lock</> file from
the current directory, processes it, and downloads and installs all the the current directory, processes it, and downloads and installs all the
libraries and dependencies outlined in that file. If the file does not libraries and dependencies outlined in that file. If the file does not
exist it will look for <comment>pyproject.toml</> and do the same. exist it will look for <comment>pyproject.toml</> and do the same.
......
...@@ -9,7 +9,7 @@ class LockCommand(EnvCommand): ...@@ -9,7 +9,7 @@ class LockCommand(EnvCommand):
""" """
help = """The <info>lock</info> command reads the <comment>pyproject.toml</> file from help = """The <info>lock</info> command reads the <comment>pyproject.toml</> file from
the current directory, processes it, and locks the depdencies in the <comment>pyproject.lock</> file. the current directory, processes it, and locks the depdencies in the <comment>poetry.lock</> file.
<info>poetry lock</info> <info>poetry lock</info>
""" """
......
...@@ -2,6 +2,7 @@ from __future__ import absolute_import ...@@ -2,6 +2,7 @@ from __future__ import absolute_import
from __future__ import unicode_literals from __future__ import unicode_literals
import json import json
import shutil
from .__version__ import __version__ from .__version__ import __version__
from .config import Config from .config import Config
...@@ -165,7 +166,15 @@ class Poetry: ...@@ -165,7 +166,15 @@ class Poetry:
if "packages" in local_config: if "packages" in local_config:
package.packages = local_config["packages"] package.packages = local_config["packages"]
locker = Locker(poetry_file.with_suffix(".lock"), local_config) # Moving lock if necessary (pyproject.lock -> poetry.lock)
lock = poetry_file.parent / "poetry.lock"
if not lock.exists():
# Checking for pyproject.lock
old_lock = poetry_file.with_suffix(".lock")
if old_lock.exists():
shutil.move(old_lock, lock)
locker = Locker(poetry_file.parent / "poetry.lock", local_config)
return cls(poetry_file, local_config, package, locker) return cls(poetry_file, local_config, package, locker)
......
...@@ -84,7 +84,7 @@ class Provider: ...@@ -84,7 +84,7 @@ class Provider:
@property @property
def name_for_locking_dependency_source(self): # type: () -> str def name_for_locking_dependency_source(self): # type: () -> str
return "pyproject.lock" return "poetry.lock"
def is_debugging(self): def is_debugging(self):
return self._is_debugging return self._is_debugging
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment