# depcon
```
|
__| _ _ __ __ _ _
/ | |/ |/ \_/ / \_/ |/ |
\_/|_/|__/|__/ \___/\__/ | |_/
/|
\|
```
`depcon` is a tool designed to simplify the migration of dependency specifications from traditional `requirements.txt`, `requirements.in`, `requirements-dev.txt`, and `requirements-dev.in` files into the modern `pyproject.toml` format created using the [`uv`](https://docs.astral.sh/uv/) or [`hatch`](https://github.com/pypa/hatch) tools. This allows for a streamlined, standardized, and more maintainable approach to dependency management in Python projects.
## Rationale
Traditional `requirements.txt` files are widely used to manage dependencies in Python projects, but they have limitations:
- They do not natively integrate with modern Python packaging tools.
- Managing separate files for base and development dependencies can be error-prone.
- Adding, updating, or syncing dependencies requires external tools like `pip-tools`.
By migrating dependencies to `pyproject.toml`, you can leverage a unified and declarative format for dependency and project configuration. This format is now the standard for Python packaging and works seamlessly with tools like `hatch`, `poetry`, and `uv`.
## Installation
You can install `depcon` via [pipx](https://pypa.github.io/pipx/) or the `uvx` plugin manager:
```bash
# Using uvx
uvx install depcon
# Using pipx
pipx install depcon
```
## Usage
`depcon` integrates into a workflow involving `uv` for project initialization and management. Here’s how you can use it:
Workflow Overview
1. Initialize your project with uv init.
2. Migrate your dependencies with depcon.
3. Sync and lock your dependencies with uv sync.
## Step-by-Step Instructions
1. Initialize your Project
Start by creating a pyproject.toml file for your project using uv init:
```
uv init
```
This will create a pyproject.toml file with basic metadata for your project.
2. Migrate Dependencies with depcon
Run depcon to migrate dependencies from existing requirements files into your pyproject.toml file. For example:
* Migrate base dependencies from requirements.txt:
```
depcon -r requirements.txt
```
or
```
depcon -r requirements.in
```
* Migrate development dependencies from requirements-dev.txt:
```
depcon -d requirements-dev.txt
```
or
```
depcon -r requirements.txt -d requirements-dev.txt
```
By default, `depcon` will add dependencies to the [project.dependencies] section for base dependencies, and to [tool.uv.dev-dependencies] for development dependencies.
3. Sync and Lock Dependencies
Once dependencies are migrated, sync and lock them with uv:
```
uv sync
```
This will resolve, install, and lock all dependencies into a hatch.lock or requirements.lock file.
Additional Options
* Specify requirements.in files for pinned dependency resolution:
```
depcon -r requirements.in
```
* Use depcon with different tools (e.g., poetry) by specifying custom behavior (future support planned).
### Benefits of this Workflow
* Unified Configuration: Manage dependencies and metadata in a single pyproject.toml file.
* Modern Tools: Leverage the power of uv, hatch, and modern packaging workflows.
* Ease of Use: Simplify the migration and maintenance of dependencies.
## Review of command line options
- `-r`, `--requirements`: Path to requirements.txt file
- `-d`, `--requirements-dev`: Path to requirements-dev.txt file
- `-p`, `--pyproject`: Path to target pyproject.toml file (default: ./pyproject.toml)
### Examples
```
depcon -r requirements.txt -d requirements-dev.txt -p pyproject.toml
depcon -r requirements.in -p pyproject.toml
depcon -r requirements.txt
```
## Contributing
Contributions are welcome! If you’d like to improve depcon or add features, feel free to submit an issue or pull request on the GitHub repository.
## License
depcon is licensed under the MIT License. See the LICENSE file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "depcon",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "requirements, dependencies, pyproject, conversion",
"author": null,
"author_email": "Lance Reinsmith <info@k2rad.com>",
"download_url": "https://files.pythonhosted.org/packages/70/f9/67493f9725b4934e074dddb24072cbe47a1c0283254ea5ce6aee74d1e45b/depcon-0.1.4.tar.gz",
"platform": null,
"description": "# depcon\n\n```\n | \n __| _ _ __ __ _ _ \n/ | |/ |/ \\_/ / \\_/ |/ | \n\\_/|_/|__/|__/ \\___/\\__/ | |_/\n /| \n \\| \n```\n\n`depcon` is a tool designed to simplify the migration of dependency specifications from traditional `requirements.txt`, `requirements.in`, `requirements-dev.txt`, and `requirements-dev.in` files into the modern `pyproject.toml` format created using the [`uv`](https://docs.astral.sh/uv/) or [`hatch`](https://github.com/pypa/hatch) tools. This allows for a streamlined, standardized, and more maintainable approach to dependency management in Python projects.\n\n## Rationale\n\nTraditional `requirements.txt` files are widely used to manage dependencies in Python projects, but they have limitations:\n\n- They do not natively integrate with modern Python packaging tools.\n- Managing separate files for base and development dependencies can be error-prone.\n- Adding, updating, or syncing dependencies requires external tools like `pip-tools`.\n\nBy migrating dependencies to `pyproject.toml`, you can leverage a unified and declarative format for dependency and project configuration. This format is now the standard for Python packaging and works seamlessly with tools like `hatch`, `poetry`, and `uv`.\n\n## Installation\n\nYou can install `depcon` via [pipx](https://pypa.github.io/pipx/) or the `uvx` plugin manager:\n\n```bash\n# Using uvx\nuvx install depcon\n\n# Using pipx\npipx install depcon\n```\n\n## Usage\n\n`depcon` integrates into a workflow involving `uv` for project initialization and management. Here\u2019s how you can use it:\n\nWorkflow Overview\n1.\tInitialize your project with uv init.\n2.\tMigrate your dependencies with depcon.\n3.\tSync and lock your dependencies with uv sync.\n\n## Step-by-Step Instructions\n\n1. Initialize your Project\n\nStart by creating a pyproject.toml file for your project using uv init:\n\n```\nuv init\n```\n\nThis will create a pyproject.toml file with basic metadata for your project.\n\n2. Migrate Dependencies with depcon\n\nRun depcon to migrate dependencies from existing requirements files into your pyproject.toml file. For example:\n\n* Migrate base dependencies from requirements.txt:\n\n```\ndepcon -r requirements.txt\n```\nor \n```\ndepcon -r requirements.in\n```\n\n* Migrate development dependencies from requirements-dev.txt:\n\n```\ndepcon -d requirements-dev.txt\n```\nor\n```\ndepcon -r requirements.txt -d requirements-dev.txt\n```\n\nBy default, `depcon` will add dependencies to the [project.dependencies] section for base dependencies, and to [tool.uv.dev-dependencies] for development dependencies.\n\n3. Sync and Lock Dependencies\n\nOnce dependencies are migrated, sync and lock them with uv:\n\n```\nuv sync\n```\n\nThis will resolve, install, and lock all dependencies into a hatch.lock or requirements.lock file.\n\nAdditional Options\n\n* Specify requirements.in files for pinned dependency resolution:\n\n```\ndepcon -r requirements.in\n```\n\n* Use depcon with different tools (e.g., poetry) by specifying custom behavior (future support planned).\n\n### Benefits of this Workflow\n\n* Unified Configuration: Manage dependencies and metadata in a single pyproject.toml file.\n* Modern Tools: Leverage the power of uv, hatch, and modern packaging workflows.\n* Ease of Use: Simplify the migration and maintenance of dependencies.\n\n## Review of command line options\n\n- `-r`, `--requirements`: Path to requirements.txt file\n- `-d`, `--requirements-dev`: Path to requirements-dev.txt file\n- `-p`, `--pyproject`: Path to target pyproject.toml file (default: ./pyproject.toml)\n\n### Examples\n\n```\ndepcon -r requirements.txt -d requirements-dev.txt -p pyproject.toml\ndepcon -r requirements.in -p pyproject.toml\ndepcon -r requirements.txt \n```\n\n## Contributing\n\nContributions are welcome! If you\u2019d like to improve depcon or add features, feel free to submit an issue or pull request on the GitHub repository.\n\n## License\n\ndepcon is licensed under the MIT License. See the LICENSE file for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Convert requirements files to pyproject.toml format used in uv",
"version": "0.1.4",
"project_urls": {
"Bug Tracker": "https://github.com/lancereinsmith/depcon/issues",
"Documentation": "https://github.com/lancereinsmith/depcon#readme",
"Homepage": "https://github.com/lancereinsmith/depcon"
},
"split_keywords": [
"requirements",
" dependencies",
" pyproject",
" conversion"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "1e7981e4f6e5a88708da7fcb256dc06024cd86d5b27734de06325ee8ce6d9901",
"md5": "d9b57ac1ea776a7f37f0cd3ba145847c",
"sha256": "40fda7abc708854134e3a2a5b4657df78a5dcef8c03d37378953d160e59ea662"
},
"downloads": -1,
"filename": "depcon-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d9b57ac1ea776a7f37f0cd3ba145847c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 4936,
"upload_time": "2024-12-24T19:31:40",
"upload_time_iso_8601": "2024-12-24T19:31:40.755282Z",
"url": "https://files.pythonhosted.org/packages/1e/79/81e4f6e5a88708da7fcb256dc06024cd86d5b27734de06325ee8ce6d9901/depcon-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "70f967493f9725b4934e074dddb24072cbe47a1c0283254ea5ce6aee74d1e45b",
"md5": "9ddd69a6ce3ebdff0b66e8ec8c033f1a",
"sha256": "f1236718d4fdf313c2bc7b481d2da15f9215e7a3311c1cf175f8ba47909164d9"
},
"downloads": -1,
"filename": "depcon-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "9ddd69a6ce3ebdff0b66e8ec8c033f1a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 4639,
"upload_time": "2024-12-24T19:31:42",
"upload_time_iso_8601": "2024-12-24T19:31:42.634280Z",
"url": "https://files.pythonhosted.org/packages/70/f9/67493f9725b4934e074dddb24072cbe47a1c0283254ea5ce6aee74d1e45b/depcon-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-24 19:31:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lancereinsmith",
"github_project": "depcon",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "packaging",
"specs": [
[
"==",
"24.2"
]
]
},
{
"name": "requirements-parser",
"specs": [
[
"==",
"0.11.0"
]
]
},
{
"name": "toml",
"specs": [
[
"==",
"0.10.2"
]
]
},
{
"name": "types-setuptools",
"specs": [
[
"==",
"75.6.0.20241126"
]
]
}
],
"lcname": "depcon"
}