Skip to main content

Fast Abstract

Fast Abstract is a high-performance implementation of abstract base classes for Python, designed with optimized checks and minimal overhead. Created by Michael Avina, this module offers a lightweight solution for developers who want to leverage abstract classes without the additional overhead of Python's built-in abc module.

Why?

I wanted a lightweight, high-performance alternative to Python's abc module that still provides the essential functionality of abstract base classes. Fast Abstract is perfect for applications that require speed and minimal overhead while still enforcing interface contracts within your Python code.

Features

  • Optimized for Performance: Fast Abstract uses tuples and avoids dynamic checks wherever possible to minimize runtime overhead.
  • Lightweight: The module is small, simple, and easy to integrate into any Python project.
  • Flexible Enforcement Levels: Allows you to specify enforcement levels ('error', 'warning', 'none') for abstract method checks.

Installation

You can install Fast Abstract using pip

Usage

from fast_abstract import FastAbstract, abstractmethod, abstractproperty

class MyBase(FastAbstract):
    @abstractmethod
    def method(self):
        pass
    
    @abstractproperty
    def my_property(self):
        """Abstract property example."""
        pass

    @abstractmethod
    def abstract_another_method(self):
        """Abstract method example with prefix 'abstract_'."""
        pass

class ConcreteClass(MyBase):
    def method(self):
        print("Method implemented in ConcreteClass")

    @property
    def my_property(self):
        return "Property implemented in ConcreteClass"

    def abstract_another_method(self):
        print("Abstract method with prefix implemented")

obj = ConcreteClass()
obj.method()  # This will print: Method implemented in ConcreteClass
print(obj.my_property)  # This will print: Property implemented in ConcreteClass
obj.abstract_another_method()  # This will print: Abstract method with prefix implemented

### 5. `LICENSE` File

The license remains the same:

#### `LICENSE`

```plaintext
MIT License

MIT License

Copyright (c) 2024 Michael Avina

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Metadata

Release files for fast-abstract 0.1.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 fast-abstract 0.1.0
File Size Uploaded Provenance Actions
fast_abstract-0.1.0.tar.gz 3.9 kB Without provenance Details for fast_abstract-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fast-abstract 0.1.0
File Interpreter ABI Platform Actions
fast_abstract-0.1.0-py3-none-any.whl Python 3 none any Details for fast_abstract-0.1.0-py3-none-any.whl

Total release size: 7.8 kB

Release files / fast_abstract-0.1.0.tar.gz

Download URL fast_abstract-0.1.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3509e82ee4b5b59192fc0c282ba6b03ead9e351d1c2a6289a9a2de56633cc495
BLAKE2b-256 checksum
How to use checksums
c392a56568489224a2db784c446c87cb4d9b88f25aec707a1ab18b3e1580a459
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / fast_abstract-0.1.0-py3-none-any.whl

Download URL fast_abstract-0.1.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
952bc7763ffbb313f58dadd9a4ee3d640a0d739197175aab9cbd88b2237cf146
BLAKE2b-256 checksum
How to use checksums
d8be838b85bdbed0c321852d26f6d26d1c4d7ec106b261bbb0f280373073a5f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Security for fast-abstract 0.1.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

0.1.0 This release

2 release files 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