Skip to main content

flake8-override

Build Status codecov Python Version wemake-python-styleguide

flake8-override is a Flake8 plugin designed to enforce a coding standard where every method in a class must have the @override decorator. This ensures that all public methods implement their counterparts from an interface, promoting better design practices, easier mocking in unit tests, and simpler extension via decoration.

Seven Virtues of a Good Object. Part 2

Installation

You can install flake8-override via pip:

pip install flake8-override

Usage

To use flake8-override, simply include it in your Flake8 configuration. You can run Flake8 as usual, and the plugin will check for the presence of the @override decorator on each method.

flake8 your_code_directory

Example

Input code

class Dog:

    def sound(self):
        print('bark')

Expected code

from typing import Protocol, override

class Animal(Protocol):

    def sount(self): ...

class Dog(Animal):

    @override
    def sound(self):
        print('bark')

Rationale

The primary motivation for this plugin is to ensure that objects adhere to contracts as specified by interfaces. This has two main benefits:

  • Easier Mocking in Unit Tests: Objects that work by contract are easier to mock in unit tests because their behavior is predictable and defined by interfaces.
  • Simpler Extension via Decoration: Objects designed with clear contracts are easier to extend and decorate, promoting better software design and maintenance.

License

MIT

Credits

This project was generated with wemake-python-package. Current template version is: 864a62ecb432655249d071e263ac51f053448659. See what is updated since then.

Metadata

Release files for flake8-override 0.1.1

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

Source distribution (sdist)

Source distribution for flake8-override 0.1.1
File Size Uploaded Provenance Actions
flake8_override-0.1.1.tar.gz 3.6 kB Without provenance Details for flake8_override-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flake8-override 0.1.1
File Interpreter ABI Platform Actions
flake8_override-0.1.1-py3-none-any.whl Python 3 none any Details for flake8_override-0.1.1-py3-none-any.whl

Total release size: 8.6 kB

Release files / flake8_override-0.1.1.tar.gz

Download URL flake8_override-0.1.1.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ec01f25959b2997ad9a0addb5b52f3e0f89b04bd3acb94569fdaad57355bfc1e
BLAKE2b-256 checksum
How to use checksums
2417931e66cfdac463f6cdd74bcf7f66ae13d3937595feb0d76191bdeae6d12f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.13.1 Linux/7.0.0-1017-azure

Release files / flake8_override-0.1.1-py3-none-any.whl

Download URL flake8_override-0.1.1-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2717a84f481bfdb500f89563a6cbd0481a6450e4be8191039ace3bd4ad7d1815
BLAKE2b-256 checksum
How to use checksums
672402b43df8d31a5d2a2c19748ba823e7480be84fbda073ad038c5c32a3f64b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.13.1 Linux/7.0.0-1017-azure

Security for flake8-override 0.1.1

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