Skip to main content

runtime-final

Declare final Python classes and methods at runtime.

This module provides a decorator based interface to declare final classes and methods. This module is inspired by and is compatible with typing.final. See PEP-591 for more details on this topic.

Installation

Python 3.6 or higher is required.

You can simply install this module from pip.

python -m pip install runtime-final

Usage

The main component of this module is the final decorator that can be used to decorate classes and methods inside a class. As such:

  • Classes decorated with @final cannot be subclassed.
  • Methods decorated with @final cannot be overriden in subclasses.

For example with classes:

from runtime_final import final

@final
class Foo:
    ...

class Bar(Foo):  # Raises RuntimeError
    ...

And with methods:

from runtime_final import final

class User:
    @final
    def edit(self):
        ...

class AnotherUser(User):
    def edit(self):  # Raises RuntimeError
        ...

Documentation

For more details, see the documentation

Metadata

Release files for runtime-final 1.2.0

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

Built distribution (wheel)

Table of built distributions (wheels) for runtime-final 1.2.0
File Interpreter ABI Platform Actions
runtime_final-1.2.0-py3-none-any.whl Python 3 none any Details for runtime_final-1.2.0-py3-none-any.whl

Release files / runtime_final-1.2.0-py3-none-any.whl

Download URL runtime_final-1.2.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a0688f9c95937133059c5349a7cfa274d8b5b90b9c45aa619cd4ab180d9516a
BLAKE2b-256 checksum
How to use checksums
f842dab1472af7985d1c4d9a689d2fb8be433d7b8c5a829f357ca9c836896191
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Security for runtime-final 1.2.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.

Release history Release notifications | RSS feed

This release

1.2.0 This release

1 release file No provenance

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