Skip to main content

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.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

txtoml-1.0.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

txtoml-1.0.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file txtoml-1.0.0.tar.gz.

File metadata

  • Download URL: txtoml-1.0.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.0 Windows/10

File hashes

Hashes for txtoml-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ab7ba4f510d827f2a33b6c6602220b39cbff836741325722e3d8c25029f82169
MD5 506c64bb5052150074cb85a2503be65c
BLAKE2b-256 fade3fd2b5af08fbc694b82be0e7115bf4cf185c7c24524fa50d83d44732de5b

See more details on using hashes here.

File details

Details for the file txtoml-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: txtoml-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.0 Windows/10

File hashes

Hashes for txtoml-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d68b0547f60faa6b15977a67a5f886ed479a5f370c13c82e61d197c2737b1d4
MD5 be2fe6bd676fb9e779d577b24bdbe57f
BLAKE2b-256 c2b03e81948cbb7a70ad7cb61c4eb46eed3cb273ecf005f0cdb52fb447ef66cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page