# poetry-sort
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/poetry-sort?logo=python&logoColor=white&style=for-the-badge)](https://pypi.org/project/poetry-sort)
[![PyPI](https://img.shields.io/pypi/v/poetry-sort?logo=pypi&color=green&logoColor=white&style=for-the-badge)](https://pypi.org/project/poetry-sort)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/celsiusnarhwal/poetry-sort?logo=github&color=orange&logoColor=white&style=for-the-badge)](https://github.com/celsiusnarhwal/poetry-sort/releases)
[![PyPI - License](https://img.shields.io/pypi/l/poetry-sort?color=03cb98&style=for-the-badge)](https://github.com/celsiusnarhwal/poetry-sort/blob/main/LICENSE)
poetry-sort is a [Poetry](https://python-poetry.org/) plugin that alphabetically sorts the dependencies in
your `pyproject.toml` file.
## Installation
```bash
poetry self add poetry-sort
```
## Usage
```bash
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.
```toml
[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](LICENSE.md).
Raw data
{
"_id": null,
"home_page": "https://github.com/celsiusnarhwal/poetry-sort",
"name": "poetry-sort",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "celsius narhwal",
"author_email": "hello@celsiusnarhwal.dev",
"download_url": "https://files.pythonhosted.org/packages/41/54/74d125852ba7504f091f3ce3cbe36a91fdac38aa0ad5bb4d745d765834c0/poetry_sort-1.2.0.tar.gz",
"platform": null,
"description": "# poetry-sort\n\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/poetry-sort?logo=python&logoColor=white&style=for-the-badge)](https://pypi.org/project/poetry-sort)\n[![PyPI](https://img.shields.io/pypi/v/poetry-sort?logo=pypi&color=green&logoColor=white&style=for-the-badge)](https://pypi.org/project/poetry-sort)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/celsiusnarhwal/poetry-sort?logo=github&color=orange&logoColor=white&style=for-the-badge)](https://github.com/celsiusnarhwal/poetry-sort/releases)\n[![PyPI - License](https://img.shields.io/pypi/l/poetry-sort?color=03cb98&style=for-the-badge)](https://github.com/celsiusnarhwal/poetry-sort/blob/main/LICENSE)\n\npoetry-sort is a [Poetry](https://python-poetry.org/) plugin that alphabetically sorts the dependencies in\nyour `pyproject.toml` file.\n\n## Installation\n\n```bash\npoetry self add poetry-sort\n```\n\n## Usage\n\n```bash\npoetry sort\n```\n\n`poetry sort` supports the `--with`, `--without`, and `--only` options, which function identically to `poetry install`.\nFor full usage information, run `poetry sort --help`.\n\npoetry-sort runs automatically whenever you run `poetry add` or `poetry init` and will sort only the dependency\ngroups that were modified by the command.\n\n## Configuration\n\npoetry-sort can be configured either on a per-project basis in `pyproject.toml` or globally in your Poetry\n`config.toml` file. Either way, configuration options are placed inside the `tool.sort.config` key.\n\n```toml\n[tool.sort.config]\nauto = true\ncase-sensitive = false\nsort-python = false\nformat = true\n```\n\nSettings defined in `pyroject.toml` will override settings defined in `config.toml`.\n\nThe following options are available:\n\n- `auto` (`bool`, default: `true`): Whether or not to automatically sort dependencies when running `poetry add`\n or `poetry init`. `poetry sort` can always be run manually, regardless of this setting.\n\n- `case-sensitive` (`bool`, default: `false`): Whether to take case into account when sorting.\n\n- `sort-python` (`bool`, default: `false`): Whether to also sort the `python` dependency. If `false`, the `python`\n dependency will be placed at\n the top of `tool.poetry.dependencies`; if `true`, it will be sorted alphebetically with everything else.\n\n- `format` (`bool`, default: `true`): Whether to apply some basic formatting to `pyproject.toml` after sorting.\n If `true`, poetry-sort will\n take all occurences of three or more consecutive newlines in `pyproject.toml` and replace them with two newlines.\n If `false`, poetry-sort will not modify `pyproject.toml` beyond just sorting your dependencies.\n\n## License\n\npoetry-sort is licensed udner the [MIT License](LICENSE.md).",
"bugtrack_url": null,
"license": "MIT",
"summary": "Alphabetically sort your Poetry dependencies",
"version": "1.2.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d6732ac9ef748b3732ab7b7929c895a8",
"sha256": "71e4d634d92a7e92060743a3447096154089f1a56f23ccfdaf33166e1594bd2c"
},
"downloads": -1,
"filename": "poetry_sort-1.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d6732ac9ef748b3732ab7b7929c895a8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 5101,
"upload_time": "2022-12-26T03:35:59",
"upload_time_iso_8601": "2022-12-26T03:35:59.242659Z",
"url": "https://files.pythonhosted.org/packages/a0/9b/c18aba15304ea6368d97795c991cc04f9971195c23c5958eea3b58347463/poetry_sort-1.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "0a0e508d3f5f5a317511d0c219b12d0a",
"sha256": "e0a11c3de737c6002f210835c3cba49a37248cb4f9cb2810c156c46124e5ea25"
},
"downloads": -1,
"filename": "poetry_sort-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "0a0e508d3f5f5a317511d0c219b12d0a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 4675,
"upload_time": "2022-12-26T03:36:00",
"upload_time_iso_8601": "2022-12-26T03:36:00.410501Z",
"url": "https://files.pythonhosted.org/packages/41/54/74d125852ba7504f091f3ce3cbe36a91fdac38aa0ad5bb4d745d765834c0/poetry_sort-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-26 03:36:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "celsiusnarhwal",
"github_project": "poetry-sort",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "poetry-sort"
}