# Poetry Import Plugin
[![PyPI version](https://badge.fury.io/py/poetry-import-plugin.svg)](https://badge.fury.io/py/poetry-import-plugin) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/poetry-import-plugin) [![GitHub issues](https://img.shields.io/github/issues/benbenbang/poetry-import-plugin)](https://github.com/benbenbang/poetry-import-plugin/issues) ![pre-commit enable](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white) [![main](https://github.com/benbenbang/poetry-import-plugin/actions/workflows/main.yml/badge.svg)](https://github.com/benbenbang/poetry-import-plugin/actions/workflows/main.yml) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://semver.org/)
`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](https://python-poetry.org/docs/plugins/#using-plugins) for the latest available methods.
Currently (as of 2024), poetry provides three ways to install the plugin:
#### With `pipx inject`
```bash
# To install
pipx inject poetry poetry-import-plugin
# To uninstall
pipx uninject poetry poetry-import-plugin
```
#### With `pip`
```bash
# 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)
```bash
# 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): The `requirements.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 in `pyproject.toml`.
### Examples
1. Import dependencies from `requirements.txt` into the default group:
```bash
poetry import requirements.txt
```
2. Import dependencies from multiple `requirements.txt` files into specific groups:
```bash
poetry import -g dev dev-requirements.txt -g test test-requirements.txt
```
3. Apply constraints from a constraints file during import:
```bash
poetry import -c constraints.txt requirements.txt
```
4. Update the Poetry lock file after importing dependencies:
```bash
poetry import --lock requirements.txt
```
5. Install all dependencies after importing:
```bash
poetry import --install requirements.txt
```
## Contact
For any questions or feedback, please open an issue on the GitHub repository or contact the author.
Raw data
{
"_id": null,
"home_page": "https://github.com/benbenbang/poetry-import-plugin",
"name": "poetry-import-plugin",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.7",
"maintainer_email": null,
"keywords": "poetry, pyproject, toml, requirements, import",
"author": "Ben Chen",
"author_email": "benbenbang@github.com",
"download_url": "https://files.pythonhosted.org/packages/6e/9e/fc19550eed2abecabbc686f6c7b2268f3e91d51fd52abf38d4f26717745a/poetry_import_plugin-2.1.1.tar.gz",
"platform": null,
"description": "# Poetry Import Plugin\n\n [![PyPI version](https://badge.fury.io/py/poetry-import-plugin.svg)](https://badge.fury.io/py/poetry-import-plugin) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/poetry-import-plugin) [![GitHub issues](https://img.shields.io/github/issues/benbenbang/poetry-import-plugin)](https://github.com/benbenbang/poetry-import-plugin/issues) ![pre-commit enable](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white) [![main](https://github.com/benbenbang/poetry-import-plugin/actions/workflows/main.yml/badge.svg)](https://github.com/benbenbang/poetry-import-plugin/actions/workflows/main.yml) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://semver.org/)\n\n\n`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.\n\nps. It is renamed from `Req2Toml`\n\n\n\n\n## Features\n\n- Import dependencies from multiple `requirements.txt` files into specified groups.\n- Apply version constraints from a constraints file.\n\n\n\n## Installation\n\nPlease follow the [official docs](https://python-poetry.org/docs/plugins/#using-plugins) for the latest available methods.\n\nCurrently (as of 2024), poetry provides three ways to install the plugin:\n\n#### With `pipx inject`\n\n```bash\n# To install\npipx inject poetry poetry-import-plugin\n\n# To uninstall\npipx uninject poetry poetry-import-plugin\n```\n\n\n\n#### With `pip`\n\n```bash\n# To install\n$POETRY_HOME/bin/pip install --no-cache-dir poetry-import-plugin\n\n# To uninstall\n$POETRY_HOME/bin/pip uninstall poetry-import-plugin\n```\n\n\n\n#### The `self add` command (not recommended for Windows users)\n\n```bash\n# To install\npoetry self add poetry-import-plugin\n\n# To uninstall\npoetry self remove poetry-import-plugin\n```\n\n\n\n## Usage\n\nThe `import` command can be used to import dependencies from `requirements.txt` files into your Poetry project. Below are the available options and arguments:\n\n### Arguments\n\n- `files` (optional, multiple): The `requirements.txt` files to import.\n\n### Options\n\n- `--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.\n- `--constraint`, `-c` (optional): Specifies a constraint file to apply version restrictions on dependencies during import.\n- `--lock` (optional): Updates the Poetry lock file without installing the packages.\n- `--no-update` (optional): Prevents updating the lock file when running the lock operation.\n- `--install` (optional): Runs a Poetry installation to install all dependencies defined in `pyproject.toml`.\n\n### Examples\n\n1. Import dependencies from `requirements.txt` into the default group:\n\n ```bash\n poetry import requirements.txt\n ```\n\n2. Import dependencies from multiple `requirements.txt` files into specific groups:\n\n ```bash\n poetry import -g dev dev-requirements.txt -g test test-requirements.txt\n ```\n\n3. Apply constraints from a constraints file during import:\n\n ```bash\n poetry import -c constraints.txt requirements.txt\n ```\n\n4. Update the Poetry lock file after importing dependencies:\n\n ```bash\n poetry import --lock requirements.txt\n ```\n\n5. Install all dependencies after importing:\n\n ```bash\n poetry import --install requirements.txt\n ```\n\n\n\n## Contact\n\nFor any questions or feedback, please open an issue on the GitHub repository or contact the author.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Convert requirements.txt to pyproject.toml",
"version": "2.1.1",
"project_urls": {
"Homepage": "https://github.com/benbenbang/poetry-import-plugin",
"Repository": "https://github.com/benbenbang/poetry-import-plugin"
},
"split_keywords": [
"poetry",
" pyproject",
" toml",
" requirements",
" import"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "936bde4497c43fdaa565d8284da209ca3a1834c915073bd038e61202e03e5935",
"md5": "fad5ad34e9a62c5f321f4864c68ee7ad",
"sha256": "e7566476f1c9b0935e88f2c6aeb65fcae4fabdd0c6a6d001243ddba476f30e4e"
},
"downloads": -1,
"filename": "poetry_import_plugin-2.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fad5ad34e9a62c5f321f4864c68ee7ad",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.7",
"size": 13049,
"upload_time": "2024-06-01T18:29:09",
"upload_time_iso_8601": "2024-06-01T18:29:09.258930Z",
"url": "https://files.pythonhosted.org/packages/93/6b/de4497c43fdaa565d8284da209ca3a1834c915073bd038e61202e03e5935/poetry_import_plugin-2.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6e9efc19550eed2abecabbc686f6c7b2268f3e91d51fd52abf38d4f26717745a",
"md5": "7543b554c3af40fa943a2c68b4595a2d",
"sha256": "701f143542e817c230b0ebba54d412333c79eaf07ceff6ba971e3d1360f159af"
},
"downloads": -1,
"filename": "poetry_import_plugin-2.1.1.tar.gz",
"has_sig": false,
"md5_digest": "7543b554c3af40fa943a2c68b4595a2d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.7",
"size": 12484,
"upload_time": "2024-06-01T18:29:10",
"upload_time_iso_8601": "2024-06-01T18:29:10.643358Z",
"url": "https://files.pythonhosted.org/packages/6e/9e/fc19550eed2abecabbc686f6c7b2268f3e91d51fd52abf38d4f26717745a/poetry_import_plugin-2.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-01 18:29:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "benbenbang",
"github_project": "poetry-import-plugin",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "poetry-import-plugin"
}