Skip to main content

Crackerjack code formatting style.

Project description

Crackerjack Python

Python: 3.7 Code style: black Code style: crackerjack

Crackerjack is a python coding, formatting, and documentation style for statically typed python >=3.10

Why Crackerjack?

Crackerjack exists to make modern python code more elegant and readable. Let's face it, the python documentation system has been a major contributor to the languages popularity, but over time python code in packages and repositories has become so cluttered up with docstrings, doctests, and comments that it actually becomes really hard to find the actual code in it - nonetheless read through it. Yes, modern IDE's offer up options to fold the docstrings, but this doesn't help when looking through code on GitHub, or in an console based editor like vi and doesn't account for either for all the different ways that developers comment up their code. There must be some sanity!

Enter Crackerjack. Crackerjack works on the theory that with statically typed python code and explicit class, function, variable, and other object names the code should be straight forward to read and the documentation should pretty much be able to write itself (can you say ai). Crackerjack also has coding style guidelines that exist to keep the codebase clean, elegant, standardized, and easily readable - give it to me straight basically.

What does this package do?

Crackjack first cleans up the codebase by removing all docstrings and comments that do not conform to Crackerjack standards (see below). The code is then reformatted to the Black code style, unused imports are removed with autoflake, and remaining imports sorted by reorder_python_imports. After that MonkeyType is run to add type annotations to the code and optionally run through Mypy to check for errors.

What are the rules?

(...more what you'd call "guidelines" than actual rules. -Captain Barbossa )

  • All docstrings, README's, and other documentation is to be done in Markdown (md)

  • Code needs to be black'ed

  • Imports are one single import per line (see reorder_python_imports) - this not only helps aviod merge conflicts but makes it easier to manipulate if using hot-keys

  • Use pathlib.Path not os.path

  • If a function or class is performing file operations it should be passed a Path object - not a string

  • Work in progress

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crackerjack-0.1.0.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

crackerjack-0.1.0-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

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