{"id":17377363,"url":"https://github.com/kieran-ryan/pyprojectsort","last_synced_at":"2025-04-14T19:34:20.759Z","repository":{"id":176527032,"uuid":"656904909","full_name":"kieran-ryan/pyprojectsort","owner":"kieran-ryan","description":"Formatter for pyproject.toml files","archived":false,"fork":false,"pushed_at":"2025-04-07T17:53:02.000Z","size":260,"stargazers_count":10,"open_issues_count":6,"forks_count":4,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-10T07:51:58.920Z","etag":null,"topics":["formatter","pyproject","python"],"latest_commit_sha":null,"homepage":"https://kieran-ryan.github.io/pyprojectsort","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kieran-ryan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-21T22:23:39.000Z","updated_at":"2025-03-14T15:38:00.000Z","dependencies_parsed_at":"2024-02-19T19:31:47.805Z","dependency_job_id":"4fd199ab-79a7-4cda-b021-c0ab31dcbd32","html_url":"https://github.com/kieran-ryan/pyprojectsort","commit_stats":{"total_commits":50,"total_committers":4,"mean_commits":12.5,"dds":0.28,"last_synced_commit":"ef1aa4eb9deac39be65cc5debe1d606b7e93b199"},"previous_names":["kieran-ryan/pyproject-sort","kieran-ryan/pyprojectsort"],"tags_count":6,"template":false,"template_full_name":"kieran-ryan/python-package-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kieran-ryan%2Fpyprojectsort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kieran-ryan%2Fpyprojectsort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kieran-ryan%2Fpyprojectsort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kieran-ryan%2Fpyprojectsort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kieran-ryan","download_url":"https://codeload.github.com/kieran-ryan/pyprojectsort/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248946439,"owners_count":21187505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["formatter","pyproject","python"],"created_at":"2024-10-16T05:05:38.389Z","updated_at":"2025-04-14T19:34:20.740Z","avatar_url":"https://github.com/kieran-ryan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003epyprojectsort\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eFormatter for pyproject.toml files\u003c/b\u003e\n\u003c/p\u003e\n\n[![PyPI Version](https://badge.fury.io/py/pyprojectsort.svg)](https://pypi.org/project/pyprojectsort/)\n![LICENSE](https://img.shields.io/badge/license-MIT-blue)\n[![Python versions](https://img.shields.io/pypi/pyversions/pyprojectsort.svg)](https://pypi.org/pypi/pyprojectsort)\n![Supported platforms](https://img.shields.io/badge/platforms-macOS%20%7C%20Windows%20%7C%20Linux-green)\n![Pipeline status](https://github.com/kieran-ryan/python-package-template/actions/workflows/main.yml/badge.svg)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/kieran-ryan/pyprojectsort/main.svg)](https://results.pre-commit.ci/latest/github/kieran-ryan/pyprojectsort/main)\n[![codecov](https://codecov.io/gh/kieran-ryan/pyprojectsort/graph/badge.svg?token=MNGM4NAXEB)](https://codecov.io/gh/kieran-ryan/pyprojectsort)\n\nThis package enforces consistent formatting of pyproject.toml files, reducing merge request conflicts and saving time otherwise spent on manual formatting. It also contributes to a cleaner git history and more readable code; enhancing overall project organisation and maintainability. Experience a streamlined workflow, reduced errors, and improved code readability with `pyprojectsort`.\n\n## Features\n\n- Alphanumerically sorts pyproject.toml by:\n    - section\n    - section key\n    - list value\n- Reformats pyproject.toml to a standardised style\n    - line per list value\n    - double quotations\n    - trailing commas\n    - indentation\n    - end of file newline\n\n## Installation\n\n`pyprojectsort` is available via [PyPI](https://pypi.org/project/pyprojectsort/):\n\n```console\npip install pyprojectsort\n```\n\n### Using pyprojectsort with [pre-commit](https://pre-commit.com)\n\nTo use as an automated git hook, add this to your `.pre-commit-config.yaml`:\n\n```yaml\n- repo: https://github.com/kieran-ryan/pyprojectsort\n  rev: v0.4.0\n  hooks:\n      - id: pyprojectsort\n```\n\n## Examples\n\nWith the following `pyproject.toml`:\n\n```toml\n[tool.ruff]\nignore = [\"G004\",\n\"T201\",\n    \"ANN\"\n]\n\n[project]\nname = 'pyprojectsort'\nauthors = [\n    { name = \"Kieran Ryan\" },\n    \"Author Name \u003cauthor@email.com\u003e\",\n    {name=\"Author Name\"}\n]\n\n[tool.radon]\nshow_mi = true\nexclude = \"tests/*,venv/*\"\ntotal_average = true\nshow_complexity = true\n\n[build-system]\nbuild-backend = \"flit.buildapi\"\nrequires = [\"flit\"]\n```\n\nRun the package from within its directory:\n\n```console\npyprojectsort\n```\n\nThe configuration will be reformatted as follows:\n\n```toml\n[build-system]\nbuild-backend = \"flit.buildapi\"\nrequires = [\n    \"flit\",\n]\n\n[project]\nauthors = [\n    \"Author Name \u003cauthor@email.com\u003e\",\n    { name = \"Author Name\" },\n    { name = \"Kieran Ryan\" },\n]\nname = \"pyprojectsort\"\n\n[tool.radon]\nexclude = \"tests/*,venv/*\"\nshow_complexity = true\nshow_mi = true\ntotal_average = true\n\n[tool.ruff]\nignore = [\n    \"ANN\",\n    \"G004\",\n    \"T201\",\n]\n```\n\nThe pyproject file path can alternatively be specified:\n\n```console\npyprojectsort ../pyproject.toml\n```\n\n### Check formatting\n\nThe **--check** option can be used to determine whether your file would be reformatted.\n\n```console\npyprojectsort --check\n```\n\nIf the file needs reformatting, the program exits with an error code. This is useful for [pipeline integration](https://github.com/kieran-ryan/pyprojectsort/blob/d9cf5e1e646e1e5260f7cf0168ecd0a05ce8ed11/.github/workflows/main.yml#L30) as it prevents writing back changes so that a clean repository is maintained for subsequent jobs.\n\nThe **--diff** option provides similar functionality but also displays any changes that would be made.\n\n```console\npyprojectsort --diff\n```\n\nThe diff of an alphabetically reordered array will appear as follows:\n\n```diff\n@@ -6,8 +6,8 @@\n[project]\nauthors = [\n+ { name = \"Author Name\" },\n  { name = \"Kieran Ryan\" },\n- { name = \"Author Name\" },\n]\n```\n\n## Contributing\n\nContributions are welcome for `pyprojectsort`, and can be made by raising [issues](https://github.com/kieran-ryan/pyprojectsort/issues) or [pull requests](https://github.com/kieran-ryan/pyprojectsort/pulls).\n\nUsing [`uv`](https://docs.astral.sh/uv/getting-started/installation/#pypi) for package and project management is encouraged when developing with the project - though not required. You will typically want to use the below commands within the project during development.\n\n```console\nuv run pytest              # Run the tests\nuv run pre-commit          # Run the linting checks on staged changes\nuv run pre-commit install  # Run the linting checks on commit\nuv run mkdocs serve        # Build the documentation\nuv build                   # Build the package\n```\n\n## License\n\n`pyprojectsort` is licensed under the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkieran-ryan%2Fpyprojectsort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkieran-ryan%2Fpyprojectsort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkieran-ryan%2Fpyprojectsort/lists"}