Skip to main content

txtoml

A command-line utility that allows you to quickly and easily copy dependencies from a Poetry pyproject.toml file to a pip requirements.txt file.

Installation

$ pip install txtoml

Usage

$ txtoml [SOURCE] [OUTPUT]

where [SOURCE] is the path to a pyproject.toml file and [OUTPUT] is the path to a requirements.txt file (txtoml will create a requirements.txt file in the absence of one at the specified path, but the pyproject.toml file must already exist).

For example, this:

# pyproject.toml

[tool.poetry.dependencies]
python = "^3.9.0"
Django = "^3.1.5"
click = "^7.1.2"
toml = "^0.10.2"
pathvalidate = "^2.3.2"
path = "^15.0.1"
colorama = "^0.4.4"
dj-database-url = "^0.5.0"

after running this:

$ txtoml pyproject.toml requirements.txt

becomes this:

# requirements.txt

# Generated by txtoml on Fri Jan 29 at 15:48:43 UTC

# Dependencies
Django>=3.1.5, <4.0.0
click>=7.1.2, <8.0.0
toml>=0.10.2, <0.11.0
pathvalidate>=2.3.2, <3.0.0
path>=15.0.1, <16.0.0
colorama>=0.4.4, <0.5.0
dj-database-url>=0.5.0, <0.6.0

If you noticed the python dependency from the pyproject.toml file isn't present in the requirements.txt file, that's intended behavior. Poetry automatically includes it in pyproject.toml files it generates, but pip will throw an error if you include it in a requirements.txt, so txtoml excludes it during the copying process.

Development Dependencies

You can append the --include-dev flag to the txtoml command to include dependencies that are listed as development dependencies in the pyproject.toml file.

For example, this:

# pyproject.toml

[tool.poetry.dependencies]
python = "^3.9.0"
Django = "^3.1.5"
click = "^7.1.2"
toml = "^0.10.2"
pathvalidate = "^2.3.2"
path = "^15.0.1"
colorama = "^0.4.4"
dj-database-url = "^0.5.0"

[tool.poetry.dev-dependencies]
Sphinx = "^3.4.3"
sphinx-rtd-theme = "^0.5.1"
sphinx-click = "^2.5.0"

after running this:

$ txtoml pyproject.toml requirements.txt --include-dev

becomes this:

# requirements.txt

# Generated by txtoml on Fri Jan 29 at 15:52:32 UTC

# Dependencies
Django>=3.1.5, <4.0.0
click>=7.1.2, <8.0.0
toml>=0.10.2, <0.11.0
pathvalidate>=2.3.2, <3.0.0
path>=15.0.1, <16.0.0
colorama>=0.4.4, <0.5.0
dj-database-url>=0.5.0, <0.6.0

# Development dependencies
Sphinx>=3.4.3, <4.0.0
sphinx-rtd-theme>=0.5.1, <0.6.0
sphinx-click>=2.5.0, <3.0.0

Additional notes

txtoml does not support dependencies hosted on a repository other than the Python Package Index, nor does it support more complex Poetry dependency specifications such as Python restricted dependencies or environment markers.

License

txtoml is released under the MIT License.

Metadata

Release files for txtoml 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for txtoml 1.0.0
File Size Uploaded
txtoml-1.0.0.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for txtoml 1.0.0
File Interpreter ABI Platform
txtoml-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.9 kB

Release files / txtoml-1.0.0.tar.gz

Download URL txtoml-1.0.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ab7ba4f510d827f2a33b6c6602220b39cbff836741325722e3d8c25029f82169
BLAKE2b-256 checksum
How to use checksums
fade3fd2b5af08fbc694b82be0e7115bf4cf185c7c24524fa50d83d44732de5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.9.0 Windows/10

Release files / txtoml-1.0.0-py3-none-any.whl

Download URL txtoml-1.0.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d68b0547f60faa6b15977a67a5f886ed479a5f370c13c82e61d197c2737b1d4
BLAKE2b-256 checksum
How to use checksums
c2b03e81948cbb7a70ad7cb61c4eb46eed3cb273ecf005f0cdb52fb447ef66cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.9.0 Windows/10

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page