Skip to main content

seating

Sort the order of class functions, properties, and member variables.

Installation

Install with:

pip install seating

Sorting and Priority

  • Class variables declared in class body outside of a function
  • Dunder methods
  • Functions decorated with property or corresponding .setter and .deleter methods
  • Class functions

Each of these groups will be sorted alphabetically with respect to themselves.

The only exception is for dunder methods.
They will be sorted alphabetically except that __init__ will be first.

If you have class contents that are grouped a certain way and you want the groups individually sorted so that the grouping is maintained, you can use # Seat to demarcate the groups.

i.e. if the source is:

class MyClass():
    {arbitrary lines of code}
    # Seat
    {more arbitrary code}
    # Seat
    {yet more code}

then the three sets of code in brackets will be sorted independently from one another.

Usage

CLI

>seat -h
usage: seat [-h] [--start START] [--stop STOP] [-nb] [-o OUTPUT] [-d] file

positional arguments:
  file                  The file to format.

options:
  -h, --help            show this help message and exit
  --start START         Optional line number to start formatting at.
  --stop STOP           Optional line number to stop formatting at.
  -nb, --noblack        Don't format file with Black after sorting.
  -o OUTPUT, --output OUTPUT
                        Write changes to this file, otherwise changes are written back to the original file.
  -d, --dump            Dump ast tree to file instead of doing anything else. For debugging purposes.

Programmatically

from seating import seat
from pathier import Pathier

file = Pathier("somefile.py")
source = file.read_text()
source = seat(source)
file.write_text(source)

Metadata

Release files for seating 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for seating 0.0.3
File Size Uploaded Provenance Actions
seating-0.0.3.tar.gz 5.1 kB Without provenance Details for seating-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for seating 0.0.3
File Interpreter ABI Platform Actions
seating-0.0.3-py3-none-any.whl Python 3 none any Details for seating-0.0.3-py3-none-any.whl

Total release size: 11.5 kB

Release files / seating-0.0.3.tar.gz

Download URL seating-0.0.3.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
39898793f0da1a2025b8e81944b290306b469cc949764d3877be85cee251e120
BLAKE2b-256 checksum
How to use checksums
6b78ce5a7ffecd4c4ac8f3190e1d9dfec30ff4d1c5128378286002e65e3df5c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / seating-0.0.3-py3-none-any.whl

Download URL seating-0.0.3-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c5162bed9692abd5180fd9a7ef5568664036b639f214ef8becaccfcf36fc0b7
BLAKE2b-256 checksum
How to use checksums
f1ed5aa595ae4210fbf9738e2ceac618d955aad99b369432ba46b03edb27c040
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Security for seating 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page