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.txtfiles 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.txtfiles 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.txtinto the default group:poetry import requirements.txt
-
Import dependencies from multiple
requirements.txtfiles 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.
Metadata
Release files for poetry-import-plugin 3.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| poetry_import_plugin-3.0.1.tar.gz | 15.8 kB | Without provenance | Details for poetry_import_plugin-3.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| poetry_import_plugin-3.0.1-py3-none-any.whl | Python 3 | none | any | Details for poetry_import_plugin-3.0.1-py3-none-any.whl |
Total release size: 32.4 kB
Release files / poetry_import_plugin-3.0.1.tar.gz
| Download URL | poetry_import_plugin-3.0.1.tar.gz |
|---|---|
| Size | 15.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fa61e82029cd5247940220cb26a4bf24154938be0dfd3173376f8e72e101396
|
|
BLAKE2b-256 checksum How to use checksums |
e3a394c60bc85ac6c95369264e37b2541b0b7bbf9c4c3f169086533475481e62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.3 Linux/6.8.0-1021-azure
|
Release files / poetry_import_plugin-3.0.1-py3-none-any.whl
| Download URL | poetry_import_plugin-3.0.1-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef7ed7fb594a500cff550dac8ca494817b7fe614325a223f30b97d12fbaf2ee2
|
|
BLAKE2b-256 checksum How to use checksums |
b9c7d8dcf30a17fb6236d1a1870323808fc2757a4157126258682455b201924a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.3 Linux/6.8.0-1021-azure
|
Security for poetry-import-plugin 3.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.