Convert requirements.txt to pyproject.toml
Project description
Poetry Import Plugin
poetry-import-plugin
is a Python plugin for Poetry that simplifies the process of importing dependencies from requirements.txt
files into a Poetry project. It allows you to integrate dependencies into specified dependency groups within the project's pyproject.toml
file, optionally applying constraints from a constraints file. This plugin also supports updating the Poetry lock file and installing dependencies.
ps. It is renamed from Req2Toml
Features
- Import dependencies from multiple
requirements.txt
files into specified groups. - Apply version constraints from a constraints file.
Installation
Please follow the official docs for the latest available methods.
Currently (as of 2024), poetry provides three ways to install the plugin:
With pipx inject
# To install
pipx inject poetry poetry-import-plugin
# To uninstall
pipx uninject poetry poetry-import-plugin
With pip
# To install
$POETRY_HOME/bin/pip install --no-cache-dir poetry-import-plugin
# To uninstall
$POETRY_HOME/bin/pip uninstall poetry-import-plugin
The self add
command (not recommended for Windows users)
# To install
poetry self add poetry-import-plugin
# To uninstall
poetry self remove poetry-import-plugin
Usage
The import
command can be used to import dependencies from requirements.txt
files into your Poetry project. Below are the available options and arguments:
Arguments
files
(optional, multiple): Therequirements.txt
files to import.
Options
--group
,-g
(optional, multiple): Specifies the dependency group(s) into which the dependencies will be imported. Multiple groups can be specified, each followed by a list of dependency files to import.--constraint
,-c
(optional): Specifies a constraint file to apply version restrictions on dependencies during import.--lock
(optional): Updates the Poetry lock file without installing the packages.--no-update
(optional): Prevents updating the lock file when running the lock operation.--install
(optional): Runs a Poetry installation to install all dependencies defined inpyproject.toml
.
Examples
-
Import dependencies from
requirements.txt
into the default group:poetry import requirements.txt
-
Import dependencies from multiple
requirements.txt
files into specific groups:poetry import -g dev dev-requirements.txt -g test test-requirements.txt
-
Apply constraints from a constraints file during import:
poetry import -c constraints.txt requirements.txt
-
Update the Poetry lock file after importing dependencies:
poetry import --lock requirements.txt
-
Install all dependencies after importing:
poetry import --install requirements.txt
Contact
For any questions or feedback, please open an issue on the GitHub repository or contact the author.
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 poetry_import_plugin-2.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 701f143542e817c230b0ebba54d412333c79eaf07ceff6ba971e3d1360f159af |
|
MD5 | 7543b554c3af40fa943a2c68b4595a2d |
|
BLAKE2b-256 | 6e9efc19550eed2abecabbc686f6c7b2268f3e91d51fd52abf38d4f26717745a |
Hashes for poetry_import_plugin-2.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7566476f1c9b0935e88f2c6aeb65fcae4fabdd0c6a6d001243ddba476f30e4e |
|
MD5 | fad5ad34e9a62c5f321f4864c68ee7ad |
|
BLAKE2b-256 | 936bde4497c43fdaa565d8284da209ca3a1834c915073bd038e61202e03e5935 |