tsrkit-types 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tsrkit_types-0.1.0/CHANGELOG.md +51 -0
- tsrkit_types-0.1.0/CONTRIBUTING.md +72 -0
- tsrkit_types-0.1.0/LICENSE +21 -0
- tsrkit_types-0.1.0/MANIFEST.in +19 -0
- tsrkit_types-0.1.0/PKG-INFO +750 -0
- tsrkit_types-0.1.0/README.md +710 -0
- tsrkit_types-0.1.0/pyproject.toml +56 -0
- tsrkit_types-0.1.0/pytest.ini +15 -0
- tsrkit_types-0.1.0/setup.cfg +4 -0
- tsrkit_types-0.1.0/setup.py +7 -0
- tsrkit_types-0.1.0/tests/test_bytes.py +40 -0
- tsrkit_types-0.1.0/tests/test_choices.py +341 -0
- tsrkit_types-0.1.0/tests/test_containers.py +393 -0
- tsrkit_types-0.1.0/tests/test_enums.py +406 -0
- tsrkit_types-0.1.0/tests/test_int.py +53 -0
- tsrkit_types-0.1.0/tests/test_integers.py +201 -0
- tsrkit_types-0.1.0/tests/test_network.py +632 -0
- tsrkit_types-0.1.0/tests/test_seq.py +73 -0
- tsrkit_types-0.1.0/tests/test_strings.py +228 -0
- tsrkit_types-0.1.0/tests/test_struct.py +62 -0
- tsrkit_types-0.1.0/tests/test_structs.py +478 -0
- tsrkit_types-0.1.0/tsrkit_types/__init__.py +76 -0
- tsrkit_types-0.1.0/tsrkit_types/bits.py +115 -0
- tsrkit_types-0.1.0/tsrkit_types/bool.py +41 -0
- tsrkit_types-0.1.0/tsrkit_types/bytes.py +102 -0
- tsrkit_types-0.1.0/tsrkit_types/choice.py +127 -0
- tsrkit_types-0.1.0/tsrkit_types/dictionary.py +145 -0
- tsrkit_types-0.1.0/tsrkit_types/enum.py +128 -0
- tsrkit_types-0.1.0/tsrkit_types/integers.py +203 -0
- tsrkit_types-0.1.0/tsrkit_types/itf/codable.py +82 -0
- tsrkit_types-0.1.0/tsrkit_types/null.py +43 -0
- tsrkit_types-0.1.0/tsrkit_types/option.py +30 -0
- tsrkit_types-0.1.0/tsrkit_types/sequences.py +212 -0
- tsrkit_types-0.1.0/tsrkit_types/string.py +66 -0
- tsrkit_types-0.1.0/tsrkit_types/struct.py +82 -0
- tsrkit_types-0.1.0/tsrkit_types.egg-info/PKG-INFO +750 -0
- tsrkit_types-0.1.0/tsrkit_types.egg-info/SOURCES.txt +38 -0
- tsrkit_types-0.1.0/tsrkit_types.egg-info/dependency_links.txt +1 -0
- tsrkit_types-0.1.0/tsrkit_types.egg-info/requires.txt +8 -0
- tsrkit_types-0.1.0/tsrkit_types.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2024-12-19
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of tsrkit-types library
|
|
12
|
+
- Core `Codable` interface for all types
|
|
13
|
+
- Integer types: `Uint` with fixed-size (`U8`, `U16`, `U32`, `U64`) and variable-size variants
|
|
14
|
+
- String type: `String` with UTF-8 encoding and length prefix
|
|
15
|
+
- Boolean type: `Bool` with single-byte encoding
|
|
16
|
+
- Null types: `Null` singleton and `Nullable[T]` wrapper
|
|
17
|
+
- Choice types: `Choice[T1, T2, ...]` for tagged unions and `Option[T]` for optional values
|
|
18
|
+
- Container types:
|
|
19
|
+
- Sequence types: `Array`, `Vector`, `TypedArray`, `TypedVector`, `BoundedVector`, `TypedBoundedVector`
|
|
20
|
+
- Dictionary type: `Dictionary[K, V]` with typed keys and values
|
|
21
|
+
- Bytes types: `Bytes` for raw binary data and `BitArray` for bit sequences
|
|
22
|
+
- Enumeration type: `Enum` with integer backing and string names
|
|
23
|
+
- Structured types: `@struct` decorator for automatic `Codable` implementation
|
|
24
|
+
- Binary serialization with efficient encoding formats
|
|
25
|
+
- JSON serialization with customizable field mapping
|
|
26
|
+
- Type safety with runtime validation
|
|
27
|
+
- Generic type parameters for flexible usage
|
|
28
|
+
- Comprehensive test suite
|
|
29
|
+
- MIT license
|
|
30
|
+
- Complete API documentation
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
- All types implement the `Codable` interface for consistent encoding/decoding
|
|
34
|
+
- Memory-efficient encoding optimized for common use cases
|
|
35
|
+
- Type validation at construction and assignment time
|
|
36
|
+
- Support for nested and complex type compositions
|
|
37
|
+
- Zero-dependency core library
|
|
38
|
+
- Python 3.12+ support
|
|
39
|
+
|
|
40
|
+
## [Unreleased]
|
|
41
|
+
|
|
42
|
+
### Planned
|
|
43
|
+
- Performance optimizations for large data structures
|
|
44
|
+
- Additional integer types (signed integers)
|
|
45
|
+
- Time and date types
|
|
46
|
+
- UUID type
|
|
47
|
+
- Decimal/fixed-point numeric types
|
|
48
|
+
- Schema validation and migration support
|
|
49
|
+
- Code generation tools
|
|
50
|
+
- Benchmarking suite
|
|
51
|
+
- Documentation examples and tutorials
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Contributing to TSRKit Types
|
|
2
|
+
|
|
3
|
+
We welcome contributions! Here's how to get started.
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
1. **Clone the repository:**
|
|
8
|
+
```bash
|
|
9
|
+
git clone https://github.com/chainscore/tsrkit-types.git
|
|
10
|
+
cd tsrkit-types
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. **Install development dependencies:**
|
|
14
|
+
```bash
|
|
15
|
+
pip install -e ".[dev]"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Running Tests
|
|
19
|
+
|
|
20
|
+
Run the full test suite:
|
|
21
|
+
```bash
|
|
22
|
+
pytest
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Run tests with coverage:
|
|
26
|
+
```bash
|
|
27
|
+
pytest --cov=tsrkit_types --cov-report=html
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Run tests in parallel (faster):
|
|
31
|
+
```bash
|
|
32
|
+
pytest -n auto
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Run specific test files:
|
|
36
|
+
```bash
|
|
37
|
+
pytest tests/test_integers.py
|
|
38
|
+
pytest tests/test_strings.py
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Code Style
|
|
42
|
+
|
|
43
|
+
- Follow PEP 8
|
|
44
|
+
- Use type hints for all functions and methods
|
|
45
|
+
- Add docstrings for public APIs
|
|
46
|
+
- Keep functions focused and testable
|
|
47
|
+
|
|
48
|
+
## Submitting Changes
|
|
49
|
+
|
|
50
|
+
1. **Fork the repository** on GitHub
|
|
51
|
+
2. **Create a feature branch** from `main`:
|
|
52
|
+
```bash
|
|
53
|
+
git checkout -b feature/your-feature-name
|
|
54
|
+
```
|
|
55
|
+
3. **Make your changes** and add tests
|
|
56
|
+
4. **Run the test suite** to ensure everything passes
|
|
57
|
+
5. **Commit your changes** with descriptive messages
|
|
58
|
+
6. **Push to your fork** and submit a pull request
|
|
59
|
+
|
|
60
|
+
## What to Contribute
|
|
61
|
+
|
|
62
|
+
- Bug fixes
|
|
63
|
+
- New data types or features
|
|
64
|
+
- Performance improvements
|
|
65
|
+
- Documentation improvements
|
|
66
|
+
- Test coverage improvements
|
|
67
|
+
|
|
68
|
+
## Questions?
|
|
69
|
+
|
|
70
|
+
Feel free to open an issue for discussion before starting work on major changes.
|
|
71
|
+
|
|
72
|
+
Thanks for contributing! 🚀
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Chainscore Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
include README.md
|
|
2
|
+
include LICENSE
|
|
3
|
+
include CHANGELOG.md
|
|
4
|
+
include CONTRIBUTING.md
|
|
5
|
+
include pytest.ini
|
|
6
|
+
include pyproject.toml
|
|
7
|
+
include setup.py
|
|
8
|
+
|
|
9
|
+
recursive-include tsrkit_types *.py
|
|
10
|
+
recursive-include tests *.py
|
|
11
|
+
|
|
12
|
+
exclude .gitignore
|
|
13
|
+
exclude .github/*
|
|
14
|
+
exclude examples/*
|
|
15
|
+
exclude .pytest_cache/*
|
|
16
|
+
exclude __pycache__/*
|
|
17
|
+
exclude *.pyc
|
|
18
|
+
exclude .coverage
|
|
19
|
+
exclude htmlcov/*
|