keeks 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.
- keeks-0.1.0/.cursor/rules/project_overview.mdc +133 -0
- keeks-0.1.0/.cursor/rules/pytest_standards.mdc +48 -0
- keeks-0.1.0/.cursor/rules/python_standards.mdc +68 -0
- keeks-0.1.0/.cursor/rules/sphinx_docs_standards.mdc +62 -0
- keeks-0.1.0/.cursor/rules/testing.mdc +53 -0
- keeks-0.1.0/.github/ISSUE_TEMPLATE.md +17 -0
- keeks-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +7 -0
- keeks-0.1.0/.github/workflows/docs.yml +36 -0
- keeks-0.1.0/.github/workflows/publish-docs.yml +41 -0
- keeks-0.1.0/.github/workflows/publish-pypi.yml +55 -0
- keeks-0.1.0/.github/workflows/test.yml +38 -0
- keeks-0.1.0/.gitignore +77 -0
- keeks-0.1.0/CHANGELOG.md +9 -0
- keeks-0.1.0/CODE_OF_CONDUCT.md +46 -0
- keeks-0.1.0/LICENSE.md +8 -0
- keeks-0.1.0/Makefile +91 -0
- keeks-0.1.0/PKG-INFO +232 -0
- keeks-0.1.0/README.md +199 -0
- keeks-0.1.0/docs/Makefile +20 -0
- keeks-0.1.0/docs/README.md +58 -0
- keeks-0.1.0/docs/make.bat +35 -0
- keeks-0.1.0/docs/requirements.txt +4 -0
- keeks-0.1.0/docs/source/bankroll.rst +14 -0
- keeks-0.1.0/docs/source/binary_strategies.rst +77 -0
- keeks-0.1.0/docs/source/conf.py +102 -0
- keeks-0.1.0/docs/source/getting_started.rst +122 -0
- keeks-0.1.0/docs/source/index.rst +135 -0
- keeks-0.1.0/docs/source/simulators.rst +29 -0
- keeks-0.1.0/docs/source/utils.rst +17 -0
- keeks-0.1.0/examples/README.md +50 -0
- keeks-0.1.0/examples/output/st_petersburg_strategies_comparison.csv +11 -0
- keeks-0.1.0/examples/output/st_petersburg_strategies_comparison.png +0 -0
- keeks-0.1.0/examples/st_petersburg_comparison.py +311 -0
- keeks-0.1.0/keeks/__init__.py +14 -0
- keeks-0.1.0/keeks/bankroll.py +126 -0
- keeks-0.1.0/keeks/binary_strategies/__init__.py +31 -0
- keeks-0.1.0/keeks/binary_strategies/base.py +33 -0
- keeks-0.1.0/keeks/binary_strategies/kelly.py +282 -0
- keeks-0.1.0/keeks/binary_strategies/simple.py +428 -0
- keeks-0.1.0/keeks/simulators/__init__.py +11 -0
- keeks-0.1.0/keeks/simulators/random_binary.py +66 -0
- keeks-0.1.0/keeks/simulators/random_uncertain_binary.py +82 -0
- keeks-0.1.0/keeks/simulators/repeated_binary.py +62 -0
- keeks-0.1.0/keeks/utils.py +9 -0
- keeks-0.1.0/pyproject.toml +98 -0
- keeks-0.1.0/tests/__init__.py +0 -0
- keeks-0.1.0/tests/test_Bankroll.py +42 -0
- keeks-0.1.0/tests/test_cppi_strategy.py +211 -0
- keeks-0.1.0/tests/test_drawdown_adjusted_kelly.py +143 -0
- keeks-0.1.0/tests/test_dynamic_bankroll_management.py +269 -0
- keeks-0.1.0/tests/test_fixed_fraction_strategy.py +129 -0
- keeks-0.1.0/tests/test_kelly_criterion.py +174 -0
- keeks-0.1.0/tests/test_naive_strategy.py +47 -0
- keeks-0.1.0/tests/test_optimal_f.py +173 -0
- keeks-0.1.0/version.py +1 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Overview of the pygeohash project
|
|
3
|
+
globs:
|
|
4
|
+
---
|
|
5
|
+
# Keeks Project Overview
|
|
6
|
+
|
|
7
|
+
## Introduction
|
|
8
|
+
|
|
9
|
+
Keeks is a Python library for simulating and evaluating betting strategies, with a focus on bankroll management and risk assessment. The project provides tools for modeling different betting scenarios, implementing various betting strategies, and analyzing their performance over time.
|
|
10
|
+
|
|
11
|
+
## Core Components
|
|
12
|
+
|
|
13
|
+
### Bankroll Management
|
|
14
|
+
|
|
15
|
+
The `BankRoll` class in `keeks/bankroll.py` is the central component for tracking funds:
|
|
16
|
+
- Manages a user's available funds
|
|
17
|
+
- Tracks deposit and withdrawal history
|
|
18
|
+
- Implements safety features like maximum drawdown limits
|
|
19
|
+
- Provides visualization of bankroll history
|
|
20
|
+
|
|
21
|
+
### Betting Strategies
|
|
22
|
+
|
|
23
|
+
Located in `keeks/binary_strategies/`, the library offers several strategy implementations:
|
|
24
|
+
|
|
25
|
+
1. **Base Strategy** (`base.py`): Abstract base class that all strategies inherit from
|
|
26
|
+
2. **Kelly Criterion** (`kelly.py`): Implements the Kelly formula for optimal bet sizing
|
|
27
|
+
- `KellyCriterion`: Standard Kelly formula implementation
|
|
28
|
+
- `FractionalKellyCriterion`: Modified Kelly that bets a fraction of the recommended amount
|
|
29
|
+
3. **Naive Strategy** (`simple.py`): A simple strategy that bets the full amount when expected value is positive
|
|
30
|
+
|
|
31
|
+
### Simulators
|
|
32
|
+
|
|
33
|
+
Located in `keeks/simulators/`, these components run betting simulations:
|
|
34
|
+
|
|
35
|
+
1. **RandomBinarySimulator**: Simulates betting on events with normally distributed probabilities
|
|
36
|
+
2. **RandomUncertainBinarySimulator**: Similar to RandomBinarySimulator but adds uncertainty to the actual outcome
|
|
37
|
+
3. **RepeatedBinarySimulator**: Simulates betting on events with a fixed probability
|
|
38
|
+
|
|
39
|
+
### Utilities
|
|
40
|
+
|
|
41
|
+
The `utils.py` file contains helper functions and custom exceptions like `RuinException` which is raised when a user loses too much money according to their maximum drawdown settings.
|
|
42
|
+
|
|
43
|
+
## How It Works
|
|
44
|
+
|
|
45
|
+
1. **Setup**: Create a `BankRoll` instance with initial funds and risk parameters
|
|
46
|
+
2. **Strategy Selection**: Choose and configure a betting strategy (e.g., Kelly Criterion)
|
|
47
|
+
3. **Simulation**: Run a simulator to evaluate the strategy's performance over multiple trials
|
|
48
|
+
4. **Analysis**: Analyze the results, including bankroll history and final balance
|
|
49
|
+
|
|
50
|
+
## Example Usage
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from keeks.bankroll import BankRoll
|
|
54
|
+
from keeks.binary_strategies import KellyCriterion
|
|
55
|
+
from keeks.simulators.repeated_binary import RepeatedBinarySimulator
|
|
56
|
+
|
|
57
|
+
# Initialize bankroll with $1000
|
|
58
|
+
bankroll = BankRoll(initial_funds=1000.0, max_draw_down=0.3)
|
|
59
|
+
|
|
60
|
+
# Create a Kelly Criterion strategy
|
|
61
|
+
# Parameters: payoff=1.0, loss=1.0, transaction_cost=0.01
|
|
62
|
+
strategy = KellyCriterion(1.0, 1.0, 0.01)
|
|
63
|
+
|
|
64
|
+
# Create a simulator with 55% win probability
|
|
65
|
+
simulator = RepeatedBinarySimulator(
|
|
66
|
+
payoff=1.0,
|
|
67
|
+
loss=1.0,
|
|
68
|
+
transaction_costs=0.01,
|
|
69
|
+
probability=0.55,
|
|
70
|
+
trials=1000
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
# Run the simulation
|
|
74
|
+
simulator.evaluate_strategy(strategy, bankroll)
|
|
75
|
+
|
|
76
|
+
# Visualize results
|
|
77
|
+
bankroll.plot_history()
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Project Structure
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
keeks/
|
|
84
|
+
├── __init__.py
|
|
85
|
+
├── bankroll.py # Bankroll management
|
|
86
|
+
├── utils.py # Utility functions and exceptions
|
|
87
|
+
├── binary_strategies/ # Strategy implementations
|
|
88
|
+
│ ├── __init__.py
|
|
89
|
+
│ ├── base.py # Abstract base strategy
|
|
90
|
+
│ ├── kelly.py # Kelly Criterion implementations
|
|
91
|
+
│ └── simple.py # Simple betting strategies
|
|
92
|
+
└── simulators/ # Simulation engines
|
|
93
|
+
├── __init__.py
|
|
94
|
+
├── random_binary.py
|
|
95
|
+
├── random_uncertain_binary.py
|
|
96
|
+
└── repeated_binary.py
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Makefile Commands
|
|
100
|
+
|
|
101
|
+
While the Makefile wasn't provided in the repository files, typical commands for a Python project would include:
|
|
102
|
+
|
|
103
|
+
- `make install`: Install the package
|
|
104
|
+
- `make install-dev`: Install the package with development dependencies
|
|
105
|
+
- `make test`: Run the test suite
|
|
106
|
+
- `make lint`: Run linting tools (like flake8, pylint)
|
|
107
|
+
- `make format`: Format code (using tools like black, isort)
|
|
108
|
+
- `make docs`: Build documentation
|
|
109
|
+
- `make clean`: Remove build artifacts and temporary files
|
|
110
|
+
- `make coverage`: Run tests with coverage reporting
|
|
111
|
+
- `make benchmark`: Run performance benchmarks
|
|
112
|
+
|
|
113
|
+
## Getting Started
|
|
114
|
+
|
|
115
|
+
To get started with Keeks:
|
|
116
|
+
|
|
117
|
+
1. Install the package: `pip install keeks`
|
|
118
|
+
2. Import the necessary components
|
|
119
|
+
3. Create a bankroll instance
|
|
120
|
+
4. Select and configure a betting strategy
|
|
121
|
+
5. Run simulations to evaluate strategy performance
|
|
122
|
+
6. Analyze the results using the built-in visualization tools
|
|
123
|
+
|
|
124
|
+
## Project Goals
|
|
125
|
+
|
|
126
|
+
Keeks aims to:
|
|
127
|
+
1. Provide a framework for testing and comparing different betting strategies
|
|
128
|
+
2. Help users understand bankroll management principles
|
|
129
|
+
3. Simulate real-world betting scenarios with various levels of uncertainty
|
|
130
|
+
4. Visualize the long-term effects of different betting approaches
|
|
131
|
+
5. Implement established mathematical models for optimal bet sizing
|
|
132
|
+
|
|
133
|
+
The project is particularly useful for those interested in quantitative finance, sports betting, or any domain where strategic risk management is important.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
description:
|
|
3
|
+
globs: tests/*
|
|
4
|
+
---
|
|
5
|
+
# Pytest Standards
|
|
6
|
+
|
|
7
|
+
## Test Organization
|
|
8
|
+
- All test files should be named with the prefix `test_` (e.g., `test_module.py`)
|
|
9
|
+
- Test classes should be named with the prefix `Test` (e.g., `TestClassName`)
|
|
10
|
+
- Test methods should be named with the prefix `test_` (e.g., `test_function_name`)
|
|
11
|
+
- Tests should be organized in the same directory structure as the source code they test
|
|
12
|
+
|
|
13
|
+
## Test Structure
|
|
14
|
+
- Each test should focus on testing a single functionality
|
|
15
|
+
- Use descriptive test names that explain what is being tested
|
|
16
|
+
- Group related tests in test classes
|
|
17
|
+
- Use appropriate fixtures for test setup and teardown
|
|
18
|
+
- Avoid test interdependence - tests should be able to run in any order
|
|
19
|
+
|
|
20
|
+
## Assertions
|
|
21
|
+
- Use pytest's built-in assertions instead of Python's `assert` statement when possible
|
|
22
|
+
- Use appropriate assertion methods for the type being tested (e.g., `assert_almost_equal` for floats)
|
|
23
|
+
- Include descriptive error messages in assertions to aid debugging
|
|
24
|
+
|
|
25
|
+
## Fixtures
|
|
26
|
+
- Use fixtures for common setup and teardown operations
|
|
27
|
+
- Define fixtures at the appropriate scope (function, class, module, or session)
|
|
28
|
+
- Use parameterized fixtures for testing multiple inputs
|
|
29
|
+
- Use conftest.py for sharing fixtures across multiple test files
|
|
30
|
+
|
|
31
|
+
## Coverage
|
|
32
|
+
- Aim for at least 80% code coverage
|
|
33
|
+
- Write tests for both success and failure cases
|
|
34
|
+
- Test edge cases and boundary conditions
|
|
35
|
+
- Use `pytest-cov` to generate coverage reports
|
|
36
|
+
|
|
37
|
+
## Best Practices
|
|
38
|
+
- Keep tests fast and independent
|
|
39
|
+
- Avoid mocking unless necessary
|
|
40
|
+
- Use markers to categorize tests (e.g., `@pytest.mark.slow`)
|
|
41
|
+
- Use parametrize for testing multiple inputs
|
|
42
|
+
- Write tests before or alongside code (TDD approach)
|
|
43
|
+
- Run the full test suite before committing changes
|
|
44
|
+
|
|
45
|
+
## Commands
|
|
46
|
+
- Run tests with `pytest`
|
|
47
|
+
- Generate coverage reports with `pytest --cov=elote`
|
|
48
|
+
- Run specific tests with `pytest path/to/test_file.py::TestClass::test_method`
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
description:
|
|
3
|
+
globs: *.py
|
|
4
|
+
---
|
|
5
|
+
# Python Coding Standards
|
|
6
|
+
|
|
7
|
+
## Important Notes
|
|
8
|
+
- Do not ever ever add test-case specific handling into the library code. Do not add handling for "special cases", "test cases" or any other logic branches that attempt to skip the normal buisness logic to get a test to pass.
|
|
9
|
+
|
|
10
|
+
## Code Style
|
|
11
|
+
- Follow PEP 8 style guide for Python code
|
|
12
|
+
- Use 4 spaces for indentation (no tabs)
|
|
13
|
+
- Maximum line length of 88 characters (Black default)
|
|
14
|
+
- Use snake_case for variables, functions, and methods
|
|
15
|
+
- Use CamelCase for classes
|
|
16
|
+
- Use UPPER_CASE for constants
|
|
17
|
+
- Add a blank line at the end of each file
|
|
18
|
+
|
|
19
|
+
## Imports
|
|
20
|
+
- Group imports in the following order:
|
|
21
|
+
1. Standard library imports
|
|
22
|
+
2. Related third-party imports
|
|
23
|
+
3. Local application/library specific imports
|
|
24
|
+
- Use absolute imports when possible
|
|
25
|
+
- Avoid wildcard imports (`from module import *`)
|
|
26
|
+
- Use import aliases for long module names
|
|
27
|
+
|
|
28
|
+
## Documentation
|
|
29
|
+
- Document all public modules, classes, methods, and functions
|
|
30
|
+
- Use docstrings that follow the Google style guide
|
|
31
|
+
- Include type hints for function parameters and return values
|
|
32
|
+
- Document parameters, return values, and exceptions raised
|
|
33
|
+
|
|
34
|
+
## Error Handling
|
|
35
|
+
- Use specific exception types instead of generic ones
|
|
36
|
+
- Handle exceptions at the appropriate level
|
|
37
|
+
- Use context managers (`with` statements) for resource management
|
|
38
|
+
- Avoid catching exceptions without proper handling
|
|
39
|
+
|
|
40
|
+
## Code Organization
|
|
41
|
+
- Keep functions and methods short and focused
|
|
42
|
+
- Follow the Single Responsibility Principle
|
|
43
|
+
- Use classes to encapsulate related functionality
|
|
44
|
+
- Separate concerns into different modules
|
|
45
|
+
|
|
46
|
+
## Testing
|
|
47
|
+
- Write unit tests for all code
|
|
48
|
+
- Use meaningful test names
|
|
49
|
+
- Test both normal and edge cases
|
|
50
|
+
- Mock external dependencies in tests
|
|
51
|
+
|
|
52
|
+
## Performance
|
|
53
|
+
- Prefer list/dict/set comprehensions over loops when appropriate
|
|
54
|
+
- Use generators for large data sets
|
|
55
|
+
- Profile code before optimizing
|
|
56
|
+
- Consider using NumPy/Pandas for numerical operations
|
|
57
|
+
|
|
58
|
+
## Tools
|
|
59
|
+
- Use Black for code formatting
|
|
60
|
+
- Use Ruff for linting and static analysis
|
|
61
|
+
- Use mypy for type checking
|
|
62
|
+
- Use isort for import sorting
|
|
63
|
+
|
|
64
|
+
## Version Control
|
|
65
|
+
- Write meaningful commit messages
|
|
66
|
+
- Keep commits focused on a single change
|
|
67
|
+
- Use feature branches for development
|
|
68
|
+
- Review code before merging
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
description:
|
|
3
|
+
globs: docs/*
|
|
4
|
+
---
|
|
5
|
+
# Sphinx Documentation Standards
|
|
6
|
+
|
|
7
|
+
## Project Setup
|
|
8
|
+
- Use `sphinx-quickstart` to initialize the documentation structure
|
|
9
|
+
- Configure `conf.py` with appropriate project information
|
|
10
|
+
- Use the ReadTheDocs theme for consistent styling
|
|
11
|
+
- Enable necessary extensions (e.g., `autodoc`, `napoleon`, `viewcode`)
|
|
12
|
+
|
|
13
|
+
## Directory Structure
|
|
14
|
+
- Keep documentation source files in the `docs/` directory
|
|
15
|
+
- Organize documentation into logical sections (e.g., user guide, API reference)
|
|
16
|
+
- Use a clear and consistent file naming convention
|
|
17
|
+
- Include an `index.rst` file as the documentation entry point
|
|
18
|
+
|
|
19
|
+
## Documentation Style
|
|
20
|
+
- Write in clear, concise language
|
|
21
|
+
- Use present tense and active voice
|
|
22
|
+
- Be consistent with terminology
|
|
23
|
+
- Include examples where appropriate
|
|
24
|
+
- Target the appropriate audience (users, developers, etc.)
|
|
25
|
+
|
|
26
|
+
## reStructuredText Formatting
|
|
27
|
+
- Use proper heading hierarchy (=, -, ~, ^, ")
|
|
28
|
+
- Use bullet lists for unordered items and numbered lists for sequences
|
|
29
|
+
- Use code blocks with appropriate language for syntax highlighting
|
|
30
|
+
- Use cross-references to link between documentation sections
|
|
31
|
+
- Include images and diagrams where they add value
|
|
32
|
+
|
|
33
|
+
## API Documentation
|
|
34
|
+
- Use autodoc to generate API documentation from docstrings
|
|
35
|
+
- Document all public modules, classes, methods, and functions
|
|
36
|
+
- Follow Google or NumPy docstring style consistently
|
|
37
|
+
- Include type information for parameters and return values
|
|
38
|
+
- Document exceptions that may be raised
|
|
39
|
+
|
|
40
|
+
## Examples and Tutorials
|
|
41
|
+
- Include practical examples for common use cases
|
|
42
|
+
- Provide step-by-step tutorials for complex operations
|
|
43
|
+
- Ensure all examples are tested and working
|
|
44
|
+
- Use `literalinclude` to include code examples from actual source files
|
|
45
|
+
|
|
46
|
+
## Building and Testing
|
|
47
|
+
- Build documentation locally before committing changes
|
|
48
|
+
- Check for and fix all warnings during the build process
|
|
49
|
+
- Verify that cross-references work correctly
|
|
50
|
+
- Test documentation on different screen sizes
|
|
51
|
+
|
|
52
|
+
## Deployment
|
|
53
|
+
- Configure automatic documentation builds on ReadTheDocs or GitHub Pages
|
|
54
|
+
- Include a link to the documentation in the project README
|
|
55
|
+
- Version documentation to match software releases
|
|
56
|
+
- Provide a changelog or release notes section
|
|
57
|
+
|
|
58
|
+
## Maintenance
|
|
59
|
+
- Keep documentation up-to-date with code changes
|
|
60
|
+
- Review and update documentation during each release cycle
|
|
61
|
+
- Address user feedback and questions in the documentation
|
|
62
|
+
- Remove outdated or deprecated information
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: how to use the makefile to run tests
|
|
3
|
+
globs:
|
|
4
|
+
---
|
|
5
|
+
# Keeks Testing Standards
|
|
6
|
+
|
|
7
|
+
## Running Tests
|
|
8
|
+
|
|
9
|
+
### Using Make Commands
|
|
10
|
+
- Always use `make test` to run the test suite
|
|
11
|
+
- Use `make test-cov` to run tests with coverage reports
|
|
12
|
+
- Use `make test-all` to run tests on all supported Python versions using tox
|
|
13
|
+
|
|
14
|
+
### Test Commands
|
|
15
|
+
```bash
|
|
16
|
+
# Run the standard test suite
|
|
17
|
+
make test
|
|
18
|
+
|
|
19
|
+
# Run tests with coverage
|
|
20
|
+
make test-cov
|
|
21
|
+
|
|
22
|
+
# Run tests on all supported Python versions
|
|
23
|
+
make test-all
|
|
24
|
+
|
|
25
|
+
# Run a specific test file
|
|
26
|
+
make test PYTEST_ARGS="tests/test_unified_interface.py"
|
|
27
|
+
|
|
28
|
+
# Run a specific test class
|
|
29
|
+
make test PYTEST_ARGS="tests/test_unified_interface.py::TestUnifiedInterface"
|
|
30
|
+
|
|
31
|
+
# Run a specific test method
|
|
32
|
+
make test PYTEST_ARGS="tests/test_unified_interface.py::TestUnifiedInterface::test_base_methods_elo"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Test Environment
|
|
36
|
+
- Tests are run using `uv run pytest` through the Makefile
|
|
37
|
+
- The test environment is automatically set up with the correct dependencies
|
|
38
|
+
- Always run tests in a clean environment to avoid dependency conflicts
|
|
39
|
+
|
|
40
|
+
### Continuous Integration
|
|
41
|
+
- All tests must pass in CI before merging
|
|
42
|
+
- Coverage should not decrease with new code
|
|
43
|
+
- New features should include corresponding tests
|
|
44
|
+
|
|
45
|
+
### Benchmarks
|
|
46
|
+
- Use `make benchmark` to run performance benchmarks
|
|
47
|
+
- Benchmark results are stored in the `benchmark_results` directory
|
|
48
|
+
- Performance regressions should be addressed before merging
|
|
49
|
+
|
|
50
|
+
### Linting and Formatting
|
|
51
|
+
- Use `make lint` to check code quality
|
|
52
|
+
- Use `make lint-fix` to automatically fix linting issues
|
|
53
|
+
- Use `make format` to format code according to project standards
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: "Master Docs Publication"
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [ master ]
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
docs:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- name: Clone
|
|
11
|
+
uses: actions/checkout@v1
|
|
12
|
+
|
|
13
|
+
- name: Set up Python
|
|
14
|
+
uses: actions/setup-python@v4
|
|
15
|
+
with:
|
|
16
|
+
python-version: '3.10'
|
|
17
|
+
|
|
18
|
+
- name: Install uv
|
|
19
|
+
run: |
|
|
20
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
21
|
+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
22
|
+
|
|
23
|
+
- name: Install Dependencies
|
|
24
|
+
run: |
|
|
25
|
+
uv pip install --system -e ".[dev]"
|
|
26
|
+
|
|
27
|
+
- name: Build Docs
|
|
28
|
+
uses: ammaraskar/sphinx-action@master
|
|
29
|
+
with:
|
|
30
|
+
docs-folder: "./docs/"
|
|
31
|
+
|
|
32
|
+
- name: Deploy Docs
|
|
33
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
34
|
+
with:
|
|
35
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
36
|
+
publish_dir: "./docs/build"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Publish Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish-docs:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v3
|
|
14
|
+
|
|
15
|
+
- name: Set up Python
|
|
16
|
+
uses: actions/setup-python@v4
|
|
17
|
+
with:
|
|
18
|
+
python-version: '3.11'
|
|
19
|
+
|
|
20
|
+
- name: Install uv
|
|
21
|
+
run: |
|
|
22
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
23
|
+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
24
|
+
|
|
25
|
+
- name: Create virtual environment and install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
uv venv
|
|
28
|
+
source .venv/bin/activate
|
|
29
|
+
uv pip install -e ".[dev]"
|
|
30
|
+
|
|
31
|
+
- name: Build documentation
|
|
32
|
+
run: |
|
|
33
|
+
source .venv/bin/activate
|
|
34
|
+
cd docs
|
|
35
|
+
make html
|
|
36
|
+
|
|
37
|
+
- name: Deploy to GitHub Pages
|
|
38
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
39
|
+
with:
|
|
40
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
41
|
+
publish_dir: ./docs/build/html
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
name: "PyPI Packaging"
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: created
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
build_and_publish:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
permissions:
|
|
10
|
+
# IMPORTANT: this permission is mandatory for Trusted Publishing
|
|
11
|
+
id-token: write
|
|
12
|
+
steps:
|
|
13
|
+
- name: Clone
|
|
14
|
+
uses: actions/checkout@v3
|
|
15
|
+
|
|
16
|
+
- name: Set up Python
|
|
17
|
+
uses: actions/setup-python@v4
|
|
18
|
+
with:
|
|
19
|
+
python-version: '3.11'
|
|
20
|
+
|
|
21
|
+
- name: Install uv
|
|
22
|
+
run: |
|
|
23
|
+
python -m pip install --upgrade pip
|
|
24
|
+
pip install uv
|
|
25
|
+
|
|
26
|
+
- name: Setup virtual environment
|
|
27
|
+
run: |
|
|
28
|
+
uv venv
|
|
29
|
+
echo "VIRTUAL_ENV=$(pwd)/.venv" >> $GITHUB_ENV
|
|
30
|
+
echo "$(pwd)/.venv/bin" >> $GITHUB_PATH
|
|
31
|
+
|
|
32
|
+
- name: Install dependencies
|
|
33
|
+
run: |
|
|
34
|
+
uv pip install -e ".[dev]"
|
|
35
|
+
uv pip install build
|
|
36
|
+
|
|
37
|
+
- name: Build source distribution
|
|
38
|
+
run: |
|
|
39
|
+
# Clean the build directories first
|
|
40
|
+
rm -fr build/
|
|
41
|
+
rm -fr dist/
|
|
42
|
+
rm -fr .eggs/
|
|
43
|
+
find . -name '*.egg-info' -exec rm -fr {} +
|
|
44
|
+
find . -name '*.egg' -exec rm -f {} +
|
|
45
|
+
|
|
46
|
+
# Build only the source distribution
|
|
47
|
+
python -m build --sdist
|
|
48
|
+
|
|
49
|
+
- name: Publish package to PyPI
|
|
50
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
51
|
+
with:
|
|
52
|
+
packages-dir: dist/
|
|
53
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
54
|
+
# Remove the password line after the first successful publish
|
|
55
|
+
# to switch to trusted publishing for subsequent releases
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Run Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main, master]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
python-version: ['3.8', '3.9', '3.10', '3.11']
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v3
|
|
17
|
+
|
|
18
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
19
|
+
uses: actions/setup-python@v4
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
|
|
23
|
+
- name: Install uv
|
|
24
|
+
run: |
|
|
25
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
26
|
+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
27
|
+
|
|
28
|
+
- name: Create virtual environment
|
|
29
|
+
run: |
|
|
30
|
+
uv venv
|
|
31
|
+
|
|
32
|
+
- name: Install dependencies
|
|
33
|
+
run: |
|
|
34
|
+
uv pip install -e ".[dev]"
|
|
35
|
+
|
|
36
|
+
- name: Run tests with pytest
|
|
37
|
+
run: |
|
|
38
|
+
uv run pytest tests --cov=keeks --cov-report=term-missing
|
keeks-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
### Python template
|
|
2
|
+
# Byte-compiled / optimized / DLL files
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
uv.lock
|
|
7
|
+
# C extensions
|
|
8
|
+
*.so
|
|
9
|
+
.idea
|
|
10
|
+
# Distribution / packaging
|
|
11
|
+
.Python
|
|
12
|
+
env/
|
|
13
|
+
build/
|
|
14
|
+
develop-eggs/
|
|
15
|
+
dist/
|
|
16
|
+
downloads/
|
|
17
|
+
eggs/
|
|
18
|
+
.eggs/
|
|
19
|
+
lib/
|
|
20
|
+
lib64/
|
|
21
|
+
parts/
|
|
22
|
+
sdist/
|
|
23
|
+
var/
|
|
24
|
+
wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
.cache
|
|
45
|
+
nosetests.xml
|
|
46
|
+
coverage.xml
|
|
47
|
+
*,cover
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Django stuff:
|
|
54
|
+
*.log
|
|
55
|
+
|
|
56
|
+
# Sphinx documentation
|
|
57
|
+
docs/_build/
|
|
58
|
+
|
|
59
|
+
# PyBuilder
|
|
60
|
+
target/
|
|
61
|
+
|
|
62
|
+
# Created by .ignore support plugin (hsz.mobi)
|
|
63
|
+
|
|
64
|
+
# Testing
|
|
65
|
+
.pytest_cache/
|
|
66
|
+
|
|
67
|
+
# Virtual environments
|
|
68
|
+
venv/
|
|
69
|
+
ENV/
|
|
70
|
+
|
|
71
|
+
# IDE
|
|
72
|
+
.vscode/
|
|
73
|
+
*.swp
|
|
74
|
+
*.swo
|
|
75
|
+
|
|
76
|
+
# OS specific
|
|
77
|
+
.DS_Store
|