Skip to main content

Alphabetically sort your Poetry dependencies

Project description

poetry-sort

PyPI - Python Version PyPI GitHub release (latest SemVer) PyPI - License Code style: Black

poetry-sort is a Poetry plugin that alphabetically sorts the dependencies in your pyproject.toml file.

Installation

poetry self add poetry-sort

Usage

poetry sort

poetry sort supports the --with, --without, and --only options, which function identically to poetry install. For full usage information, run poetry sort --help.

poetry-sort runs automatically whenever you run poetry add or poetry init and will sort only the dependency groups that were modified by the command.

Configuration

You can configure poetry-sort via the tool.poetry.sort section of pyproject.toml.

[tool.sort.config]
auto = true
case-sensitive = false
sort-python = false
format = true

The following options are available:

  • auto (bool, default: true): Whether or not to automatically sort dependencies when running poetry add or poetry init. poetry sort can always be run manually, regardless of this setting.

  • case-sensitive (bool, default: false): Whether to take case into account when sorting.

  • sort-python (bool, default: false): Whether to also sort the python dependency. If false, the python dependency will be placed at the top of tool.poetry.dependencies; if true, it will be sorted alphebetically with everything else.

  • format (bool, default: true): Whether to apply some basic formatting to pyproject.toml after sorting. If true, poetry-sort will :take all occurences of three or more consecutive newlines in pyproject.toml and replace them with two newlines.

License

poetry-sort is licensed 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

poetry_sort-2.0.0.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

poetry_sort-2.0.0-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

Supported by

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