herogold 0.1.1__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.
Files changed (36) hide show
  1. herogold-0.1.1/.github/FUNDING.yml +16 -0
  2. herogold-0.1.1/.github/copilot-instructions.md +79 -0
  3. herogold-0.1.1/.github/example-workflows/coverage.yml +40 -0
  4. herogold-0.1.1/.github/example-workflows/docs.yml +35 -0
  5. herogold-0.1.1/.github/example-workflows/pypi.yml +53 -0
  6. herogold-0.1.1/.github/example-workflows/release.yml +70 -0
  7. herogold-0.1.1/.github/example-workflows/test.yml +40 -0
  8. herogold-0.1.1/.github/workflows/pypi.yml +53 -0
  9. herogold-0.1.1/.github/workflows/release.yml +70 -0
  10. herogold-0.1.1/.github/workflows/test.yml +32 -0
  11. herogold-0.1.1/.gitignore +216 -0
  12. herogold-0.1.1/.python-version +1 -0
  13. herogold-0.1.1/PKG-INFO +13 -0
  14. herogold-0.1.1/README.md +0 -0
  15. herogold-0.1.1/examples/__init__.py +0 -0
  16. herogold-0.1.1/examples/descriptor.py +24 -0
  17. herogold-0.1.1/examples/wrappers.py +18 -0
  18. herogold-0.1.1/pyproject.toml +23 -0
  19. herogold-0.1.1/src/herogold/__init__.py +0 -0
  20. herogold-0.1.1/src/herogold/backup/__init__.py +0 -0
  21. herogold-0.1.1/src/herogold/backup/backup.py +55 -0
  22. herogold-0.1.1/src/herogold/color/__init__.py +0 -0
  23. herogold-0.1.1/src/herogold/color/color_print.py +105 -0
  24. herogold-0.1.1/src/herogold/color/rainbow.py +1534 -0
  25. herogold-0.1.1/src/herogold/config/__init__.py +0 -0
  26. herogold-0.1.1/src/herogold/config/argparse_config.py +49 -0
  27. herogold-0.1.1/src/herogold/log/__init__.py +17 -0
  28. herogold-0.1.1/src/herogold/log/formats.py +7 -0
  29. herogold-0.1.1/src/herogold/log/handlers.py +24 -0
  30. herogold-0.1.1/src/herogold/log/logger_mixin.py +111 -0
  31. herogold-0.1.1/src/herogold/progress/__init__.py +172 -0
  32. herogold-0.1.1/src/herogold/py.typed +0 -0
  33. herogold-0.1.1/src/herogold/random/__init__.py +40 -0
  34. herogold-0.1.1/src/herogold/sentinel/__init__.py +59 -0
  35. herogold-0.1.1/src/herogold/typing/__init__.py +0 -0
  36. herogold-0.1.1/src/herogold/typing/enforcer.py +374 -0
@@ -0,0 +1,16 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: HEROgold # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ # patreon: # Replace with a single Patreon username
5
+ # open_collective: # Replace with a single Open Collective username
6
+ # ko_fi: # Replace with a single Ko-fi username
7
+ # tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ # community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ # liberapay: # Replace with a single Liberapay username
10
+ # issuehunt: # Replace with a single IssueHunt username
11
+ # lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12
+ # polar: # Replace with a single Polar username
13
+ # buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14
+ # thanks_dev: # Replace with a single thanks.dev username
15
+ # custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
16
+ #
@@ -0,0 +1,79 @@
1
+ Copilot instructions for this repository
2
+ =====================================
3
+
4
+ Primary goal
5
+ ------------
6
+ Keep a single namespace package `herogold` which contains optional subpackages
7
+ (`herogold.sentinel`, `herogold.color`, `herogold.log`, etc.). Subpackages
8
+ are small utilities and boilerplate helpers — each lives under a per-package
9
+ `src/herogold/<pkg>` layout so that after installation the import path is
10
+ `from herogold.<pkg> import ...`.
11
+
12
+ Python version and features
13
+ ---------------------------
14
+ - Prefer the Python interpreter indicated by a `.python-version` file in the
15
+ subpackage root. If that file is missing, use the latest available version, and us the tool `uv` to set it. (uv python pin <version>)
16
+ - Use modern, stable language features appropriate for the target Python version:
17
+ - builtin generics (e.g. `list[int]`, `dict[str, str]`) for typing
18
+ - `def[T](arg1: T) -> T:` style generics
19
+ - `match` / `case` (structural pattern matching) where it improves clarity or adds functionality
20
+ - concise `f`-strings and clear, explicit `__repr__` for debugging
21
+ - `dataclasses`, `typing.Protocol`, `TypedDict`, `Annotated` where helpful
22
+ - prefer `pathlib.Path`, `importlib`, and high-level stdlib APIs
23
+
24
+ Packaging and layout rules
25
+ -------------------------
26
+ - Source layout: package code must live under `src/herogold/<pkg>/` (not
27
+ `src/<pkg>`). This ensures installed imports are `herogold.<pkg>`.
28
+ - Each subpackage should include a minimal `__init__.py` and public API
29
+ surface (use `__all__` when helpful). Also add small README.md files in
30
+ subpackage folders describing purpose and a tiny usage example.
31
+ - Do NOT create compatibility shims at the top-level (no `import sentinel ->
32
+ herogold.sentinel` shims). We prefer the canonical `herogold.<pkg>` import.
33
+ - Keep per-package `pyproject.toml` metadata accurate. If you change
34
+ package layout, update workspace mappings (`[tool.uv.sources]` and
35
+ `pyproject` extras) accordingly.
36
+
37
+ Coding style and quality
38
+ ------------------------
39
+ - Follow the repository's formatter/linter settings (Black, ruff) if present
40
+ in `pyproject.toml` or `ruff.toml`. Use type annotations liberally and keep functions small
41
+ and testable.
42
+ - Add or update unit tests (pytest) for any new behavior. Put tests under
43
+ `tests/` or inside each package's `tests/` folder. Use small, fast tests.
44
+ - Always use typehinting. use `ruff check` and `ty check` to confirm these cases.
45
+ `ty check` is alpha, so just to be sure, also use `mypy`
46
+
47
+ When generating code
48
+ --------------------
49
+ - Produce complete, runnable artifacts: module files, a minimal README, and
50
+ a couple of tests. If adding CLI entry points, wire them in `pyproject.toml`.
51
+ - use tools and cli commands (like `ruff`, `uv`, etc) to create these where possible
52
+ - Avoid adding external dependencies unless explicitly requested. If a
53
+ dependency is required, update the appropriate package `pyproject.toml`
54
+ - add new packages to the workspace configuration in the root `pyproject.toml`
55
+
56
+ Safety and network
57
+ ------------------
58
+ - Do not include secrets or make remote network calls in generated code.
59
+
60
+ Workflows and CI/CD
61
+ ----------------------
62
+ - use existing workflows and CI/CD patterns in `.github/workflows/` and `.github/example-workflows/`
63
+ - `.github/example-workflows/` contains reusable examples and should be referenced first when creating new workflows
64
+ - use #fetch https://docs.astral.sh/uv/guides/integration/github over python actions
65
+ - make sure workflows runs parallel jobs where possible to speed up feedback loops
66
+ - call and reuse existing workflows where possible
67
+ - cache and use results of other workflows to avoid redundant work if it provides value
68
+
69
+ Examples
70
+ --------
71
+ - Import sentinel sentinel value:
72
+ from herogold.sentinel import MISSING
73
+ - Import rainbow
74
+ from herogold.rainbow import RAINBOW
75
+ - Import logging helpers:
76
+ from herogold.log import LoggerMixin
77
+
78
+ If anything is ambiguous, prefer small, conservative changes and ask for
79
+ clarification before large refactors.
@@ -0,0 +1,40 @@
1
+ name: Coverage
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+
7
+ jobs:
8
+ coveralls-upload:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+
13
+ - name: Install uv
14
+ uses: astral-sh/setup-uv@v4
15
+ with:
16
+ version: "latest"
17
+
18
+ - name: Set up Python 3.13
19
+ run: uv python install 3.13
20
+
21
+ - name: Install dependencies
22
+ run: uv sync --group dev
23
+
24
+ - name: Run tests with coverage
25
+ run: uv run coverage run --source=. -m pytest tests/
26
+
27
+ - name: Upload coverage data to coveralls.io
28
+ env:
29
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30
+ COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
31
+ COVERALLS_SERVICE_NAME: github-actions
32
+ COVERALLS_PARALLEL: true
33
+ run: uvx coveralls --service=github
34
+
35
+ - name: Coveralls Finished
36
+ env:
37
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38
+ COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
39
+ run: uvx coveralls --finish
40
+ if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
@@ -0,0 +1,35 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: write
10
+
11
+ jobs:
12
+ build-docs:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: '3.12'
20
+
21
+ - uses: astral-sh/setup-uv@v3
22
+
23
+ - name: Generate docs (pdoc + mkdocs)
24
+ run: |
25
+ uv sync --group docs
26
+ uv run pdoc confkit -o docs/api
27
+ uv run mkdocs build -d site
28
+
29
+ - name: Deploy to GitHub Pages
30
+ if: github.ref == 'refs/heads/master'
31
+ uses: peaceiris/actions-gh-pages@v4
32
+ with:
33
+ github_token: ${{ secrets.GITHUB_TOKEN }}
34
+ publish_dir: site
35
+ force_orphan: true
@@ -0,0 +1,53 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ repository_dispatch:
5
+ types: [new-release-created]
6
+ workflow_dispatch:
7
+ workflow_call:
8
+
9
+ jobs:
10
+ build:
11
+ name: Build distribution 📦
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ with:
17
+ persist-credentials: false
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.x"
22
+ - name: Install pypa/build
23
+ run: >-
24
+ python3 -m
25
+ pip install
26
+ uv
27
+ - name: Build a binary wheel and a source tarball
28
+ run: uv build --sdist --wheel --out-dir dist
29
+ - name: Store the distribution packages
30
+ uses: actions/upload-artifact@v4
31
+ with:
32
+ name: python-package-distributions
33
+ path: dist/
34
+
35
+ publish-to-pypi:
36
+ name: Publish Python 🐍 distribution 📦 to PyPI
37
+ needs:
38
+ - build
39
+ runs-on: ubuntu-latest
40
+ environment:
41
+ name: pypi
42
+ url: https://pypi.org/p/confkit
43
+ permissions:
44
+ id-token: write # IMPORTANT: mandatory for trusted publishing
45
+
46
+ steps:
47
+ - name: Download all the dists
48
+ uses: actions/download-artifact@v4
49
+ with:
50
+ name: python-package-distributions
51
+ path: dist/
52
+ - name: Publish distribution 📦 to PyPI
53
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,70 @@
1
+ name: Auto-release
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ rel-test:
10
+ uses: ./.github/workflows/test.yml
11
+
12
+ new-release:
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ contents: write
16
+ needs: rel-test
17
+ outputs:
18
+ version_changed: ${{ steps.version-check.outputs.version_changed }}
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ with:
23
+ fetch-depth: 0 # Needed to get all tags for version comparison
24
+
25
+ - name: Set up Python
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: "3.*"
29
+
30
+ - name: Install uv
31
+ uses: astral-sh/setup-uv@v4
32
+ with:
33
+ version: "latest"
34
+
35
+ - name: Check if version changed
36
+ id: version-check
37
+ run: |
38
+ # Get current version from pyproject.toml
39
+ CURRENT_VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
40
+ echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
41
+
42
+ # Check if this version already has a tag
43
+ if git tag --list | grep -q "^v$CURRENT_VERSION$"; then
44
+ echo "version_changed=false" >> $GITHUB_OUTPUT
45
+ echo "Version v$CURRENT_VERSION already exists as a tag"
46
+ else
47
+ echo "version_changed=true" >> $GITHUB_OUTPUT
48
+ echo "New version v$CURRENT_VERSION detected - will create release"
49
+ fi
50
+
51
+ - name: Create GitHub Release
52
+ if: steps.version-check.outputs.version_changed == 'true'
53
+ uses: softprops/action-gh-release@v2
54
+ with:
55
+ tag_name: v${{ steps.version-check.outputs.current_version }}
56
+ name: Release v${{ steps.version-check.outputs.current_version }}
57
+ draft: false
58
+ prerelease: false
59
+ generate_release_notes: true
60
+
61
+ # Trigger PyPI workflow when after we create a release.
62
+ # Pypi workflow won't with the usual on-release trigger
63
+ # because another workflow (this one) created the release. (avoiding inf recursion)
64
+ - name: Trigger PyPI workflow
65
+ if: steps.version-check.outputs.version_changed == 'true'
66
+ uses: peter-evans/repository-dispatch@v2
67
+ with:
68
+ token: ${{ secrets.GITHUB_TOKEN }}
69
+ event-type: new-release-created
70
+ client-payload: '{"version": "${{ steps.version-check.outputs.current_version }}"}'
@@ -0,0 +1,40 @@
1
+ name: Test
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [ master ]
6
+ workflow_dispatch:
7
+ workflow_call:
8
+
9
+ concurrency: test-${{ github.sha }}
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
17
+ fail-fast: false
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v4
24
+ with:
25
+ version: "latest"
26
+
27
+ - name: Set up Python ${{ matrix.python-version }}
28
+ run: uv python install ${{ matrix.python-version }}
29
+
30
+ - name: Install dependencies
31
+ run: uv sync --group dev
32
+
33
+ - name: Run tests
34
+ run: uv run pytest .
35
+
36
+ - name: Run ruff check
37
+ run: uv run ruff check .
38
+
39
+ - name: Run type checking
40
+ run: uvx ty check . --ignore no-matching-overload
@@ -0,0 +1,53 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ repository_dispatch:
5
+ types: [new-release-created]
6
+ workflow_dispatch:
7
+ workflow_call:
8
+
9
+ jobs:
10
+ build:
11
+ name: Build distribution 📦
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ with:
17
+ persist-credentials: false
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.x"
22
+ - name: Install pypa/build
23
+ run: >-
24
+ python3 -m
25
+ pip install
26
+ uv
27
+ - name: Build a binary wheel and a source tarball
28
+ run: uv build --sdist --wheel --out-dir dist
29
+ - name: Store the distribution packages
30
+ uses: actions/upload-artifact@v4
31
+ with:
32
+ name: python-package-distributions
33
+ path: dist/
34
+
35
+ # publish-to-pypi:
36
+ # name: Publish Python 🐍 distribution 📦 to PyPI
37
+ # needs:
38
+ # - build
39
+ # runs-on: ubuntu-latest
40
+ # environment:
41
+ # name: pypi
42
+ # url: https://pypi.org/p/HeroPy
43
+ # permissions:
44
+ # id-token: write # IMPORTANT: mandatory for trusted publishing
45
+
46
+ # steps:
47
+ # - name: Download all the dists
48
+ # uses: actions/download-artifact@v4
49
+ # with:
50
+ # name: python-package-distributions
51
+ # path: dist/
52
+ # - name: Publish distribution 📦 to PyPI
53
+ # uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,70 @@
1
+ name: Auto-release
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ rel-test:
10
+ uses: ./.github/workflows/test.yml
11
+
12
+ new-release:
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ contents: write
16
+ needs: rel-test
17
+ outputs:
18
+ version_changed: ${{ steps.version-check.outputs.version_changed }}
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ with:
23
+ fetch-depth: 0 # Needed to get all tags for version comparison
24
+
25
+ - name: Set up Python
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: "3.*"
29
+
30
+ - name: Install uv
31
+ uses: astral-sh/setup-uv@v4
32
+ with:
33
+ version: "latest"
34
+
35
+ - name: Check if version changed
36
+ id: version-check
37
+ run: |
38
+ # Get current version from pyproject.toml
39
+ CURRENT_VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
40
+ echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
41
+
42
+ # Check if this version already has a tag
43
+ if git tag --list | grep -q "^v$CURRENT_VERSION$"; then
44
+ echo "version_changed=false" >> $GITHUB_OUTPUT
45
+ echo "Version v$CURRENT_VERSION already exists as a tag"
46
+ else
47
+ echo "version_changed=true" >> $GITHUB_OUTPUT
48
+ echo "New version v$CURRENT_VERSION detected - will create release"
49
+ fi
50
+
51
+ - name: Create GitHub Release
52
+ if: steps.version-check.outputs.version_changed == 'true'
53
+ uses: softprops/action-gh-release@v2
54
+ with:
55
+ tag_name: v${{ steps.version-check.outputs.current_version }}
56
+ name: Release v${{ steps.version-check.outputs.current_version }}
57
+ draft: false
58
+ prerelease: false
59
+ generate_release_notes: true
60
+
61
+ # Trigger PyPI workflow when after we create a release.
62
+ # Pypi workflow won't with the usual on-release trigger
63
+ # because another workflow (this one) created the release. (avoiding inf recursion)
64
+ - name: Trigger PyPI workflow
65
+ if: steps.version-check.outputs.version_changed == 'true'
66
+ uses: peter-evans/repository-dispatch@v2
67
+ with:
68
+ token: ${{ secrets.GITHUB_TOKEN }}
69
+ event-type: new-release-created
70
+ client-payload: '{"version": "${{ steps.version-check.outputs.current_version }}"}'
@@ -0,0 +1,32 @@
1
+ name: Test
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [ master ]
6
+ workflow_dispatch:
7
+ workflow_call:
8
+
9
+ concurrency: test-${{ github.sha }}
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v4
20
+ with:
21
+ version: "latest"
22
+ - name: Install dependencies
23
+ run: uv sync --all-extras
24
+
25
+ - name: Run ruff check
26
+ run: uvx ruff check .
27
+
28
+ # - name: Run type checking
29
+ # run: uvx ty check . --ignore no-matching-overload
30
+
31
+ # - name: Run tests
32
+ # run: uv run pytest .