Skip to main content

simple migration script, migrate pipenv to poetry

Project description

pipenv-poetry-migrate

This is simple migration script, migrate pipenv to poetry.

PyPI - Python Version PyPI - Downloads Test Codecov FOSSA Status

: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 with dev-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

  1. Fork and clone the repository, and create the development branch.
  2. Run poetry install to setup your develop environment.
  3. Do your code.
  4. Run bash scripts/test.sh to check that your test passed.
  5. Run bash scripts/format.sh and bash scripts/lint.sh to check that you haven't warnings.
  6. 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

FOSSA Status

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pipenv_poetry_migrate-0.5.4.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pipenv_poetry_migrate-0.5.4-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file pipenv_poetry_migrate-0.5.4.tar.gz.

File metadata

  • Download URL: pipenv_poetry_migrate-0.5.4.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/43.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.2.1 tqdm/4.66.2 importlib-metadata/7.0.1 keyring/24.3.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.8.18

File hashes

Hashes for pipenv_poetry_migrate-0.5.4.tar.gz
Algorithm Hash digest
SHA256 cd824ba14f2578e0212a1b11815b99c31b4355cda2885a3c763c304df5ae89ab
MD5 31e1419c25a8b50c550aa08245765b4e
BLAKE2b-256 f2c189b1d1426709134f01fcfdae6fdeebf33110e71cb8f1f776dd0e8a6a129a

See more details on using hashes here.

File details

Details for the file pipenv_poetry_migrate-0.5.4-py3-none-any.whl.

File metadata

  • Download URL: pipenv_poetry_migrate-0.5.4-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/43.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.2.1 tqdm/4.66.2 importlib-metadata/7.0.1 keyring/24.3.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.8.18

File hashes

Hashes for pipenv_poetry_migrate-0.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8c94c66b5ba84859aeff9db28b59e7c3da96b8832d65694d3b2d306d5391bb79
MD5 926c65939e883466e637f815cddd9516
BLAKE2b-256 995756bab0f274ca9b8298b26e928063df789afa76f97d5826d583db909c8127

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page