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.0.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.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sdsort-0.2.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.3 Darwin/25.3.0

File hashes

Hashes for sdsort-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8311af3197f6d70c639bf77e75be1a3e2bec72c3f1c0e360fef1a3c6b6fbf9c9
MD5 deff7bc8dc9c04f6292899040fe38db0
BLAKE2b-256 e309d868bf5816fc277015e87354fee71c6af4ac913f831beafa8273db7d7859

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sdsort-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.3 Darwin/25.3.0

File hashes

Hashes for sdsort-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d365fcc71806b6dd6e030cd007afd4b1eaaa74752fc5a97549b1b6a84629c90
MD5 4ec3bd60a4be44e1e487ac06b43fb149
BLAKE2b-256 603338470d1f6b81342e93dd43882e9b9b06051ca512b0b2dc24367d89d9bbf0

See more details on using hashes here.

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