ncompasslib
nCompass Library
A Python library providing immutable objects and traits for building robust applications.
Installation:
pip install ncompasslib
Basic Usage:
1. Creating an Immutable Object:
The Immutable class prevents attributes from being modified after they are first set.
from ncompasslib.immutable import Immutable
class MyClass(Immutable):
def __init__(self):
super().__init__()
self.value = 42
obj = MyClass()
obj.value # Returns 42
obj.value = 43 # Raises RuntimeError: Cannot change state once created
2. Using the Mutate Decorator:
When you need to modify an immutable object in a controlled way, use the mutate decorator.
from ncompasslib.immutable import Immutable, mutate
class Counter(Immutable):
def __init__(self):
super().__init__()
self.count = 0
@mutate
def increment(self):
self.count += 1
3. Creating Traits:
Traits are abstract base classes that are also immutable.
from ncompasslib.trait import Trait
class MyTrait(Trait):
def __init__(self):
super().__init__()
self.trait_value = "example"
Features:
- Immutable objects with controlled mutation
- Trait system for creating abstract interfaces
- Python 3.11+ support
- Comprehensive test suite
For more information, visit: https://github.com/nCompass-tech/ncompasslib
Metadata
Release files for ncompasslib 0.0.1.post7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ncompasslib-0.0.1.post7.tar.gz | 5.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ncompasslib-0.0.1.post7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.6 kB
Release files / ncompasslib-0.0.1.post7.tar.gz
| Download URL | ncompasslib-0.0.1.post7.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07774d477206e1b212a4238a5df19aa679241eaee0cda70b1a4f450999b3b122
|
|
BLAKE2b-256 checksum How to use checksums |
b564c6e03fbaca7730e9fd7375dbbaad2f34657504e60c96744abd087b4e989e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / ncompasslib-0.0.1.post7-py3-none-any.whl
| Download URL | ncompasslib-0.0.1.post7-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70b3a41807d31ac89e1e46423e1fd83c0084602bf983a4fe1543530c07bd149e
|
|
BLAKE2b-256 checksum How to use checksums |
d243e33aa3ea9c660ea7f69259a524e324b8a2fa9771e7c69311c8b99af02bd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Security for ncompasslib 0.0.1.post7
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.