Skip to main content

TOPyN: Typed Opinionated PYthon Normalizer

Actions Status Actions Status Coverage Status License: MIT PyPI

About

Scooter*

Python is quite a flexible language, something that is not so good if you start working in mid level size projects and/or in teams. Over the time we have found a set of rules that makes working with Python in this context easier, and once you get you use to them you want to apply them to every small Python snippet that you write.

The problem is that these rules depend on a set of packages and config files, and every time we change our mind about one rule, or add new ones, we need to update multiple projects. Topyn solves this by providing in one single place all the tools and configurations we use in our projects.

All the configurations are part of the project (topyn/configs) and is not the purpose of this project to make them flexible, if you need that please check the packages that we use, and run them with your configuration.

Install

pip install topyn

Command line

There are two possible arguments:

  • path is the path that you want to check, if it is empty it defaults to the current directory.
  • --fix if you use this flag topyn will try to fix the code for you

Examples

Check the code inside directory_with_code : topyn directory_with_code

Check the code inside current directory : topyn

Check the code inside current directory and try to fix it: topyn --fix

topyn --help output

Typed Opinionated PYthon Normalizer

positional arguments:
  path        path to topynize (default: .)

optional arguments:
  -h, --help  show this help message and exit
  --fix       try to fix my code (default: False)
  --version   show program's version number and exit

topyn output

✅

➡️ Checking formatting ...
All done! ✨ 🍰 ✨
8 files would be left unchanged.
➡️ Checking rules ...
➡️ Checking types ...
✅ Everything is OK! 😎"

🔴

➡️ Checking formatting ...
All done! ✨ 🍰 ✨
1 file would be left unchanged.
➡️ Checking rules ...
➡️ Checking types ...
tests/resources/wrong_types/wrong_types.py:2: error: Incompatible return value type (got "int", expected "str")
Found 1 error in 1 file (checked 1 source file)

🔴 Sadly, types failed 😢

Tools included

Flake8

flake8 is a command-line utility for enforcing style consistency across Python projects

Flake8 plugins

  • flake8-bugbear

    A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.
  • flake8-print

    Check for print statements in python files.
  • flake8-comprehensions

    A flake8 plugin that helps you write better list/set/dict comprehensions.
  • pep8-naming

    Naming Convention checker for Python (PEP 8)

Black

The Uncompromising Code Formatter

Mypy

Optional static typing for Python (PEP 484)

Contributors

Leandro Leites Barrios : Main developer

Denada Korita : UX & Documentation consultant


* scooter icon source: icons8

Metadata

Release files for topyn 0.7.0

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

Source distribution (sdist)

Source distribution for topyn 0.7.0
File Size Uploaded Provenance Actions
topyn-0.7.0.tar.gz 7.9 kB Without provenance Details for topyn-0.7.0.tar.gz

Built distribution (wheel)

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

Total release size: 16.3 kB

Release files / topyn-0.7.0.tar.gz

Download URL topyn-0.7.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6a8d2c73f2805a57f2f7e91023a21dd83508fcc9df0cc1d8be7c02c69cf6be66
BLAKE2b-256 checksum
How to use checksums
557f5faca26fdad46e0c94d3f6d98a7a3f4ec71cb4212a721626a4a4f46b210f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.4 Darwin/21.5.0

Release files / topyn-0.7.0-py3-none-any.whl

Download URL topyn-0.7.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
efaf9272509151343712c5a83abf13a84df420860c512e0c32ec153f4844842a
BLAKE2b-256 checksum
How to use checksums
d5b38611f936ba6ddcced1a31dc9223e79a2eee83363de6c76bd470f611e9670
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.4 Darwin/21.5.0

Security for topyn 0.7.0

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