simple migration script, migrate pipenv to poetry
Project description
pipenv-poetry-migrate
This is simple migration script, migrate pipenv to poetry.
:rocket: Get Started
Installation
$ pip install -U poetry pipenv-poetry-migrate
Migration
Step 1: Create pyproject.toml
file
$ poetry init
Step 2: Migrate
To migrate Pipfile
to pyproject.toml
.
$ pipenv-poetry-migrate -f Pipfile -t pyproject.toml
When want to run dry-run mode:
$ pipenv-poetry-migrate -f Pipfile -t pyproject.toml -n
Dry-run mode is pyproject.toml
file does not overwrite, results are displayed on standard output.
[!Note]
If the dependency already exists in the poetry dependency and you want to re-migrate it, please use the--re-migrate
option. However, if the dependency is removed from pipenv, the poetry dependency is not removed.$ pipenv-poetry-migrate -f Pipfile -t pyproject.toml --re-migrate
[!Note]
The default behavior is to migrate with the group notation, which has been available since Poetry 1.2.0. If you want to migrate withdev-dependencies
notation, please use the--on-use-group-notation
option.$ pipenv-poetry-migrate -f Pipfile -t pyproject.toml --no-use-group-notation
Step 3: Generate lock file
$ poetry lock
If there is already a poetry.lock
file, remove it first.
Step 4: Installing dependencies
To install the defined dependencies for your project.
$ poetry install
Example output
This is an example of a Pipfile to be migrated.
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
requests = "*"
[dev-packages]
pytest = "^5.2"
Migrate the above file to the following pyproject.toml.
[tool.poetry]
name = "migration-sample"
version = "0.1.0"
description = ""
authors = ["Yoshiyuki HINO <yhinoz@gmail.com>"]
[tool.poetry.dependencies]
python = "^3.7"
[tool.poetry.group.dev.dependencies]
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
By executing this script, pyproject.toml is rewritten as follows.
[tool.poetry]
name = "migration-sample"
version = "0.1.0"
description = ""
authors = ["Yoshiyuki HINO <yhinoz@gmail.com>"]
[tool.poetry.dependencies]
python = "^3.7"
requests = "*"
[tool.poetry.group.dev.dependencies]
pytest = "^5.2"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
:handshake: Contributing
- Fork and clone the repository, and create the development branch.
- Run
poetry install
to setup your develop environment. - Do your code.
- Run
bash scripts/test.sh
to check that your test passed. - Run
bash scripts/format.sh
andbash scripts/lint.sh
to check that you haven't warnings. - Open a PR on GitHub.
Test cases
Test cases are in tests/toml
, update Pipfile
with additional entries and expect_pyproject.toml
with expected output.
:pencil: License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pipenv_poetry_migrate-0.5.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87e99d7516a7a5ec85a8d815e6be7fe7761bd378f5feb2abfc15225bb1cc23df |
|
MD5 | b843a148c10a4a634ae5a31978631a3d |
|
BLAKE2b-256 | ca30b9d90beb460a2be8085a832fb6bd69d888ebd5b29fb882ca6224ead29a30 |
Hashes for pipenv_poetry_migrate-0.5.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a61a34020aef3b2fad474e1703cd5103a3433e5dfd4c49e5ba6fb3808cfb239 |
|
MD5 | 38e36b614e47b81673a6577e4ddc9b3a |
|
BLAKE2b-256 | 2927b9d13191b143f9be2b267a14c12f1cc9df7c374764d811dcb8d91fc5f8af |