{"library":"pyproject-fmt","title":"pyproject-fmt","description":"pyproject-fmt is an opinionated formatter for pyproject.toml files, designed to enforce a consistent format similar to how Black formats Python code. It intentionally provides minimal configuration options to establish a single standard format, which helps in reducing configuration time, producing smaller diffs, and simplifying code reviews. The current version is 2.21.1, and it maintains an active release cadence.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pyproject-fmt"],"cli":{"name":"pyproject-fmt","version":"pyproject-fmt (2.21.2)"}},"imports":["from pyproject_fmt import run"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom pyproject_fmt import run\n\n# Assuming a pyproject.toml file exists in the current directory for testing\n# Create a dummy pyproject.toml for demonstration if it doesn't exist\nif not os.path.exists('pyproject.toml'):\n    with open('pyproject.toml', 'w') as f:\n        f.write('[project]\\nname = \"my-package\"\\nversion = \"0.1.0\"\\nrequires-python = \">=3.10\"\\ndependencies = [\"requests\"]\\n')\n\n# Format a pyproject.toml file and return the exit code\n# The 'run' function accepts command-line arguments as a list.\n# Pass an empty list or specific file paths.\nexit_code = run([\"pyproject.toml\"])\n\nif exit_code == 0:\n    print(\"pyproject.toml formatted successfully.\")\nelse:\n    print(f\"Formatting failed with exit code: {exit_code}\")\n\n# Clean up the dummy file\nif os.path.exists('pyproject.toml'):\n    os.remove('pyproject.toml')\n","lang":"python","description":"This quickstart demonstrates how to programmatically use `pyproject-fmt` to format a `pyproject.toml` file. The `run` function processes the file(s) and returns an exit code, where 0 indicates success. It also creates a temporary `pyproject.toml` if one doesn't exist for a runnable example.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"2.8.0","pypi_latest":"2.21.2","is_stale":true,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.7,"avg_import_s":0.14,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pyproject-fmt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.15,"mem_mb":4.8,"disk_size":"31.9M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pyproject-fmt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0.11,"mem_mb":4.8,"disk_size":"32M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pyproject-fmt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.21,"mem_mb":7.4,"disk_size":"33.6M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pyproject-fmt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0.19,"mem_mb":7.4,"disk_size":"34M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pyproject-fmt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.17,"mem_mb":5.5,"disk_size":"25.5M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pyproject-fmt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.17,"mem_mb":5.5,"disk_size":"26M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pyproject-fmt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.13,"mem_mb":4.7,"disk_size":"25.2M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pyproject-fmt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.13,"mem_mb":4.7,"disk_size":"25M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pyproject-fmt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.09,"mem_mb":3.7,"disk_size":"21.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pyproject-fmt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2,"import_time_s":0.08,"mem_mb":3.7,"disk_size":"21M"}]}}