Skip to main content

Alphabetically sort your Poetry dependencies

Project description

poetry-sort

PyPI - Python Version PyPI GitHub release (latest SemVer) PyPI - License

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

poetry-sort can be configured either on a per-project basis in pyproject.toml or globally in your Poetry config.toml file. Either way, configuration options are placed inside the tool.sort.config key.

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

Settings defined in pyroject.toml will override settings defined in config.toml.

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. If false, poetry-sort will not modify pyproject.toml beyond just sorting your dependencies.

License

poetry-sort is licensed udner 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-1.2.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

poetry_sort-1.2.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file poetry_sort-1.2.0.tar.gz.

File metadata

  • Download URL: poetry_sort-1.2.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.1 Linux/5.15.0-1024-azure

File hashes

Hashes for poetry_sort-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e0a11c3de737c6002f210835c3cba49a37248cb4f9cb2810c156c46124e5ea25
MD5 0a0e508d3f5f5a317511d0c219b12d0a
BLAKE2b-256 415474d125852ba7504f091f3ce3cbe36a91fdac38aa0ad5bb4d745d765834c0

See more details on using hashes here.

File details

Details for the file poetry_sort-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: poetry_sort-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.1 Linux/5.15.0-1024-azure

File hashes

Hashes for poetry_sort-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71e4d634d92a7e92060743a3447096154089f1a56f23ccfdaf33166e1594bd2c
MD5 d6732ac9ef748b3732ab7b7929c895a8
BLAKE2b-256 a09bc18aba15304ea6368d97795c991cc04f9971195c23c5958eea3b58347463

See more details on using hashes here.

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