Skip to main content

A Module metaclass, to make your classes into modules.

Project description

ModuleMeta

Python modules are hard. modulemeta attempts to make them easier to write in the interpreter.

Basic Usage

>>> from modulemeta import Module
>>> class Wat(metaclass=Module):
...   _ermelon = 5
...
...   def ermelon():  # type: ignore[misc]
...     return _ermelon
...
>>> Wat.ermelon()
5
>>> Wat
<module 'Wat'>

Inheritance

Shockingly, modules cannot be inherited from, therefore they are treated as metaclasses:

from modulemeta import Module


class Wat(metaclass=Module):
  pass


class Wat2(metaclass=Wat):  # type: ignore[misc]
  pass

Project details


Download files

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

Source Distribution

modulemeta-0.2.0a2.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

modulemeta-0.2.0a2-py3-none-any.whl (3.3 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