Comprehensive Object-Based Runtime Architecture
Project description
🐍 COBRA
Comprehensive Object-Based Runtime Architecture
COBRA is an experimental Python library that brings runtime encapsulation and object-oriented access control to Python using decorators, descriptors, and runtime inspection.
Unlike Python's naming conventions (_protected, __private), COBRA enforces access restrictions at runtime.
Features
✅ v0.2.1
- Runtime enforced private methods
- Descriptor-based private fields
- Runtime access engine
- Automatic class registration
- Lightweight and dependency-free
- Python 3.11+
Installation
pip install cobra-oop
Example
from cobra import CobraObject, PrivateField, private
class BankAccount(CobraObject):
balance = PrivateField(default=1000)
@private
def calculate_interest(self):
return self.balance * 0.08
def interest(self):
return self.calculate_interest()
account = BankAccount()
print(account.interest())
Output
80.0
Attempting to access private members directly:
account.calculate_interest()
raises
PrivateAccessError
Likewise,
account.balance
raises
PrivateAccessError
Current API
from cobra import (
CobraObject,
PrivateField,
private,
)
Roadmap
✅ v0.1.0
- Runtime private methods
@privatedecoratorCobraObject
✅ v0.2.0
- Descriptor-based private fields
- Runtime access engine
- Runtime class registry
- Runtime access policies
PrivateField
✅ v0.2.1
@protecteddecoratorProtectedField- Protected runtime validation
- Expanded automated test suite (16 tests)
🚧 v0.3.0
@frienddecoratorFriendField- Friend registry
- Friend access policy
- Runtime policy enhancements
🚧 v0.4.0
@finaldecorator@overridedecorator- Final classes
- Test suite reorganization
- CI/CD integration
- Improved documentation
🚧 v0.5.0
- DOJO static analysis engine
- VS Code / Pylance diagnostics
- Architecture rules
- Runtime contracts
- Developer tooling
🎯 v1.0.0
- Complete runtime encapsulation framework
- Stable public API
- Comprehensive documentation
- Architecture enforcement
- Static analysis integration
- Framework integrations (Django, FastAPI)
- Production-ready release
Running Tests
python -m pytest
Contributing
Contributions, bug reports, feature requests, and design discussions are welcome.
Please open an issue before starting major changes.
License
MIT License
Author
Vishnu Swaroop
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cobra_oop-0.2.1.tar.gz.
File metadata
- Download URL: cobra_oop-0.2.1.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c36832c5c58b5091e51ced0721e4f37226040ab74bdbac62de7ff962f614929c
|
|
| MD5 |
c99bdd5d6c724ca0dd690c9189de26de
|
|
| BLAKE2b-256 |
45c843051fb9c75c1d87ec2d414cf62d32cb8ef441a2f0456cfc7d70a6b3fef7
|
File details
Details for the file cobra_oop-0.2.1-py3-none-any.whl.
File metadata
- Download URL: cobra_oop-0.2.1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
587891265d949beac1f2e256deb0f89c69eb5d84c93e35c12a272c6c3d42e25d
|
|
| MD5 |
a0960abe4a1c96e81da39f83a8631dc2
|
|
| BLAKE2b-256 |
aea6b9813e584c50c2f7bd1cc3e3473d81ad19b73a1070cf82640146ad8f2d9c
|