c108
Curated core Python utilities with zero dependencies for introspection, formatting, CLI, IO/streams, filesystem, validation, networking, numerics, and sentinels.
- License: MIT
- Audience: Python developers who prefer small, practical APIs
Documentation
Full documentation and API reference: https://c108.readthedocs.io/
Installation
Install from PyPI:
pip install c108
Install latest from GitHub:
pip install git+https://github.com/C108-Lab/c108.git
Modules
- c108.abc β Runtime introspection and type-validation utilities
- c108.cli β CLI helpers
- c108.collections β BiDirectionalMap collection
- c108.dataclasses β dataclasses tools
- c108.dictify β serialization utilities
- c108.display β value with units of measurement display
- c108.formatters β formatting utilities for development and debugging
- c108.io β streaming and chunking helpers (StreamingFile, etc.)
- c108.json β safe JSON file read/write/update with optional atomic operations
- c108.network β timeout estimators
- c108.numeric β std_numeric convertor
- c108.os β low-level filesystem/path helpers
- c108.scratch β scratch & temp file utilities
- c108.sentinels β sentinel types
- c108.shutil β high-level file utilities
- c108.tools β miscellaneous helpers
- c108.typing β runtime type validation utilities
- c108.unicode β unicode text formatters
- c108.utils β shared utils
- c108.validators β country and region code constants, data validation schemes
Features
C108-Lab packages are:
- Curated β Centrally developed and maintained for consistency
- Production-ready β Thoroughly tested and documented
- Dependency-conscious β Core package stays lightweight; extra features and heavy deps live in sub-packages
- Community-friendly β Issues and feature requests are welcome
c108 has no external dependencies, standard library only.
Community & Contributing
While we don't accept pull requests, we warmly welcome:
- π Bug reports
- β¨ Feature requests
- π Documentation feedback
- β Usage questions
Please open an issue on GitHub for any of the above.
Releases
- Tagged releases on GitHub
- PyPI is the source of truth
- conda-forge feedstock tracks PyPI
License
Development Reference
Commands π₯οΈ
1. Create dev environment locally
uv venv # creates .venv
uv sync --extra dev # full dev environment with optional ML and Scientific deps
uv sync --extra test --extra tools # basic dev environment
2. Format with ruff
ruff format c108 tests
3. Run Tests with uv run COMMAND
Unit tests only (the subset used in CI):
pytest
Integration tests only (run locally):
pytest -m "integration"
Specific integration module:
pytest tests/integration/test_numeric.py
Unit and Integration tests:
pytest -m "integration or not integration"
Doctests:
pytest --xdoctest c108
4. Build and publish
# Build wheel + sdist via Hatchling
uv build
# Publish to PyPI; secrets handled by CI
uv publish --token ${{ secrets.PYPI_TOKEN }}
Test Structure β
- Unit tests (fast, minimal deps): live in
tests/and are always run by CI. - Integration tests (optional, heavy deps): live in
tests/integration/and cover interactions with external packages such as NumPy, Pandas, PyTorch, TensorFlow, JAX, Astropy, and SymPy.
All integration tests use pytest.importorskip(),
automatically skipped if a dependency is missing.
Test Dependencies
Integration tests use optional thirdβparty packages that are not required by the core test suite:
| Package | Supported Types |
|---|---|
| Astropy | Physical Quantity types |
| JAX | DeviceArray scalars |
| NumPy | Numeric scalars and arrays |
| Pandas | Nullable scalars/Series |
| PyTorch | Tensor dtypes |
| SymPy | Symbolic numeric support |
| TensorFlow | Tensor dtypes |
Install only what you need, for example:
pip install numpy pandas
Continuous Integration
GitHub Actions runs only unit tests for performance and reliability.
Integration tests are intended for local verification before releasing major versions or dependency interface changes.