Skip to main content

oncequinox

Create singleton Equinox modules.

This is a micro-package, containing the single metaclass SingletonModuleMeta.
SingletonModuleMeta can be used to create Equinox modules that are singletons, meaning that only one instance of the module can exist at any given time.

Installation

PyPI platforms PyPI version

pip install oncequinox

Documentation

Actions Status

Basic Usage

Create a singleton Equinox module:

import equinox as eqx
from oncequinox import SingletonModuleMeta


class MySingletonModule(eqx.Module, metaclass=SingletonModuleMeta):
    value: str = "this is a singleton module"


# Create the singleton instance
singleton1 = MySingletonModule()

# Attempt to create another instance
singleton2 = MySingletonModule()

print(singleton1 is singleton2)  # True

Singleton Per Class

Different classes maintain separate singleton instances:

import equinox as eqx
from oncequinox import SingletonModuleMeta


class ConfigA(eqx.Module, metaclass=SingletonModuleMeta):
    name: str = "A"


class ConfigB(eqx.Module, metaclass=SingletonModuleMeta):
    name: str = "B"


config_a = ConfigA()
config_b = ConfigB()

print(config_a is config_b)  # False
print(config_a.name)  # A
print(config_b.name)  # B

With Initialization Arguments

Arguments are only used for the first instantiation:

import equinox as eqx
from oncequinox import SingletonModuleMeta


class HasValue(eqx.Module, metaclass=SingletonModuleMeta):
    value: int

    def __init__(self, value: int):
        self.value = value


v1 = HasValue(10)
print(v1.value)  # 10

# Subsequent calls ignore arguments and return existing instance
v2 = HasValue(20)
print(v2.value)  # 10
print(v1 is v2)  # True

Metadata

Release files for oncequinox 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 oncequinox 0.1.0
File Size Uploaded
oncequinox-0.1.0.tar.gz 110.8 kB Details

Built distribution (wheel)

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

Total release size: 116.5 kB

Release files / oncequinox-0.1.0.tar.gz

Download URL oncequinox-0.1.0.tar.gz
Size 110.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ece50c70084893f5333b1346e8ac16ee6642291243159b5091ecbc0b728722f7
BLAKE2b-256 checksum
How to use checksums
5b2b9bb1b5d5a02c634df2a2c62113b071e046e594f3c74dbe4a947e751240fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2025.

Transparency log

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

Download URL oncequinox-0.1.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63f50a9af0ba1b0fa27b3e3ce85d004c4ceaee0ed8712fd3afd57d646e662502
BLAKE2b-256 checksum
How to use checksums
75adf9a0314b32d6afee7b41b86172f9b0a60b974816675cde42bd34a41632c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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