Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.
/ txtoml Public archive

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.

License

Notifications You must be signed in to change notification settings

jasonalantolbert/txtoml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

txtoml

PyPI - Python Version PyPI - License

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.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages