Skip to main content

Sorts functions and class methods according to the step-down rule

Project description

sdsort

Sorts top-level functions and class methods in Python files according to the step-down rule, as described in Robert C. Martin's Clean Code. More concretely, functions and methods are ordered in a depth-first-traversal order of the dependency tree, so higher-level code appears before the lower-level code it calls.

Installation

pip install sdsort

Or run directly with uv:

uvx sdsort <path>

Usage

To target individual files, run the sdsort command, followed by the paths to the files that should be sorted:

sdsort <file_1> <file_2>

To sort all *.py files in a directory, and all of its subdirectories, run the sdsort command followed by the directory path:

sdsort <directory_path>

Maturity

It's early days. Consider this an alpha for now.

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

sdsort-0.2.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sdsort-0.2.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file sdsort-0.2.1.tar.gz.

File metadata

  • Download URL: sdsort-0.2.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sdsort-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7dda222467b93d3650d80288014920a444032fcf83e0b3cd4699da123d207e5b
MD5 17d1159674e0a5edffe2fb60d3616f37
BLAKE2b-256 a2af7327bb2d23dcb11f3b99d1d5043826f8ed8d7c4f51e419413c068bc5808b

See more details on using hashes here.

Provenance

The following attestation bundles were made for sdsort-0.2.1.tar.gz:

Publisher: publish.yml on eirikurt/sdsort

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sdsort-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: sdsort-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sdsort-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 29669bca96bdfb99fe7df13717d872ecf280067db04e9e9c64ff22dc78372f95
MD5 5007dd6a82e14b6dd60f2db7f4d4d1da
BLAKE2b-256 0acf518486a3e4b08c10fa2422aefc8f4c898071966baa640e6249d7c1a8d63a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sdsort-0.2.1-py3-none-any.whl:

Publisher: publish.yml on eirikurt/sdsort

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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