• Stars
    star
    120
  • Rank 295,983 (Top 6 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This is simple migration script, migrate pipenv to poetry

pipenv-poetry-migrate

This is simple migration script, migrate pipenv to poetry.

PyPI - Python Version PyPI - Downloads build Codecov FOSSA Status

🚀 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: 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 <[email protected]>"]

[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 <[email protected]>"]

[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"

🤝 Contributing

To run tests:

  1. poetry install # get environment setup
  2. make test # run the tests

Test cases are in tests/toml, update Pipfile with additional entries and expect_pyproject.toml with expected output

📝 License

FOSSA Status