Skip to content
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9eef933
Significant improvements to the `checkers` module
chrimaho Jul 9, 2025
a4b4a15
Update all code docstrings examples to use `pycon` syntax for better …
chrimaho Jul 10, 2025
d4d0b98
Update `pre-commit` hooks versions and remove outdated poetry check
chrimaho Jul 10, 2025
58653a3
Add additional `@overload`'s for `list_columns` and `retry` functions…
chrimaho Jul 10, 2025
b730c3b
Add new `str_to_list()` function with overloads and corresponding tests
chrimaho Jul 10, 2025
1169733
Add validation to the `list_columns()` function and improve code stru…
chrimaho Jul 10, 2025
a8e99cb
Refactors exception handling for the `retry()` function and add loggi…
chrimaho Jul 10, 2025
3bee8e3
Add new `generators` module for on-demand data generation
chrimaho Jul 10, 2025
f789f2f
Improve `checkers` module documentation and formatting
chrimaho Jul 10, 2025
8c35b50
Fix typo
chrimaho Jul 10, 2025
e8a9e6f
Fix error with repo icon in docs page
chrimaho Jul 10, 2025
6c6c265
Add comprehensive docstring validation system
chrimaho Jul 12, 2025
86d0332
Add project scripts and update build system dependencies
chrimaho Jul 12, 2025
2fb403d
Fix typo
chrimaho Jul 12, 2025
b60a092
Refactor command execution to support space expansion and simplify co…
chrimaho Jul 12, 2025
44c6b07
Add functions to check docstrings in all Python files and in a specif…
chrimaho Jul 12, 2025
de2729a
Fix typos in all docstrings
chrimaho Jul 12, 2025
251e4d0
Add a more robust way of capturing errors when checking docstrings
chrimaho Jul 12, 2025
7673113
Refactor CI and CD workflows to replace 'make' commands with 'uv' com…
chrimaho Jul 12, 2025
6ec8292
Add `git_checks.sh` script to capture git logs and diffs
chrimaho Jul 13, 2025
f6ad6de
Update `bump_version` util to be better compatable with CLI execution
chrimaho Jul 13, 2025
8d55c79
Move `scripts.py` from`src/cli` to `src/utils` and add functions to h…
chrimaho Jul 13, 2025
48c7d1e
Reorganise the `[project.scripts]` table
chrimaho Jul 13, 2025
22b3942
Refactor CD workflow to replace all 'make' commands with 'uv run' com…
chrimaho Jul 13, 2025
4987831
Add input validation for retry parameters using `assert_is_valid`
chrimaho Jul 13, 2025
d4ae239
Refactor test files to replace any `import pytest` with `from pytest …
chrimaho Jul 13, 2025
d4f4e06
Fix typo in `retry` module
chrimaho Jul 13, 2025
fa1f050
Fix typo in `generators` module
chrimaho Jul 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 36 additions & 41 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ concurrency:
group: "pages"
cancel-in-progress: true

env:
VERSION: ${{ github.event.release.tag_name }}
UV_LINK_MODE: copy
UV_NATIVE_TLS: true
UV_NO_SYNC: true

jobs:

debug:
Expand Down Expand Up @@ -123,30 +129,26 @@ jobs:
with:
python-version: '3.13'

- name: Install dependencies
id: install-dependencies
run: uv sync --no-cache --all-groups

- name: Set up Git
id: setup-git
env:
GITHUB_ACTOR: ${{ github.actor }}
run: |
make configure-git
make git-switch-to-main-branch
make git-refresh-current-branch

- name: Install dependencies
id: install-dependencies
run: make install-all
uv run add-git-credentials
uv run git-switch-to-main-branch
uv run git-refresh-current-branch

- name: Run checks
id: run-checks
run: make check

- name: Copy coverage report
id: copy-coverage-report
run: make copy-coverage-report
run: uv run check

- name: Commit coverage report
id: commit-coverage-report
run: make commit-coverage-report
- name: Add coverage report
id: add-coverage-report
run: uv run git-add-coverage-report

- name: Upload coverage
id: upload-coverage
Expand Down Expand Up @@ -185,41 +187,37 @@ jobs:

- name: Check VERSION
id: check-version
env:
VERSION: ${{ github.event.release.tag_name }}
run: |
if [ -z "${VERSION}" ]; then
echo "/$VERSION is missing. Please try again."
exit 1
fi

- name: Install dependencies
run: make install
run: uv sync --no-cache

- name: Setup Git
id: setup-git
env:
GITHUB_ACTOR: ${{ github.actor }}
run: |
make configure-git
make git-switch-to-main-branch
make git-refresh-current-branch
uv run add-git-credentials
uv run git-switch-to-main-branch
uv run git-refresh-current-branch

- name: Bump version
id: bump-version
env:
VERSION: ${{ github.event.release.tag_name }}
run: make bump-version
run: uv run bump-version --verbose=true version=${VERSION}

- name: Update Git Version
id: update-git-version
run: uv run git-update-version

- name: Update Git
id: update-git
env:
VERSION: ${{ github.event.release.tag_name }}
run: make update-git
- name: Fix tag reference
id: fix-tag-reference
run: uv run git-fix-tag-reference

- name: Build package
id: build-package
run: make build-package
run: uv build --out-dir=dist

- name: Upload assets
id: upload-assets
Expand Down Expand Up @@ -270,7 +268,7 @@ jobs:
id: publish-package
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: make publish-package
run: uv publish --token ${PYPI_TOKEN}

- name: Check
id: check
Expand Down Expand Up @@ -343,20 +341,17 @@ jobs:

- name: Install dependencies
id: install-dependencies
run: make install-docs
run: uv sync --group=docs

- name: Setup Git
id: setup-git
env:
GITHUB_ACTOR: ${{ github.actor }}
run: |
make configure-git
make git-switch-to-main-branch
make git-refresh-current-branch
uv run add-git-credentials
uv run git-switch-to-main-branch
uv run git-refresh-current-branch

- name: Build docs
id: build-docs
env:
VERSION: ${{ github.event.release.tag_name }}
GITHUB_ACTOR: ${{ github.actor }}
run: make build-versioned-docs
run: uv run build-versioned-docs
13 changes: 9 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: CI

on: [push, pull_request]

env:
UV_LINK_MODE: copy
UV_NATIVE_TLS: true
UV_NO_SYNC: true

jobs:

debug:
Expand Down Expand Up @@ -103,10 +108,10 @@ jobs:
python-version-file: "pyproject.toml"

- name: Install dependencies
run: make install-all
run: uv sync --no-cache --all-groups

- name: Run checks
run: make check
run: uv run check

ci:

Expand Down Expand Up @@ -135,7 +140,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: make install-all
run: uv sync --no-cache --all-groups

- name: Run checks
run: make check
run: uv run check
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ poetry.lock
Pipfile
Pipfile.lock
.vscode/
git_output/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
24 changes: 14 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ repos:

# Run MyPy type checks
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.15.0"
rev: "v1.16.1"
hooks:
- id: mypy
files: src/toolbox_python
args:
- "--install-types"
- "--config-file=pyproject.toml"
- "--allow-redefinition"

# Reorder Python imports
- repo: https://github.com/pycqa/isort
Expand All @@ -67,7 +68,7 @@ repos:

# Find any outdated syntax and replace with modern equivalents
- repo: https://github.com/asottile/pyupgrade
rev: "v3.19.1"
rev: "v3.20.0"
hooks:
- id: pyupgrade
name: Upgrade Python features
Expand All @@ -93,24 +94,20 @@ repos:
args:
- "--all"

# # Check poetry configs
# - repo: https://github.com/python-poetry/poetry
# rev: "2.1.1"
# hooks:
# - id: poetry-check

# Check uv configs
- repo: https://github.com/astral-sh/uv-pre-commit
rev: "0.6.12"
rev: "0.7.20"
hooks:
- id: uv-lock
- id: uv-sync
# args:
# - "--all-groups"

# Run Pylint
# Everything run locally
- repo: local
hooks:

# Run Pylint
- id: pylint
name: pylint
entry: pipenv run pylint
Expand All @@ -120,3 +117,10 @@ repos:
- "--rcfile=pyproject.toml"
- "-rn" # Only display messages
- "-sn" # Don't display the score

# Check
- id: check-docstrings
name: Check Docstrings
entry: uv run --no-sync --link-mode=copy check-docstrings
language: system
types: [python]
16 changes: 16 additions & 0 deletions docs/code/checkers.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
-


## Constants

::: toolbox_python.checkers
options:
show_root_heading: false
members:
- OPERATORS


## `is_*()` functions

::: toolbox_python.checkers
Expand All @@ -17,6 +26,7 @@
- is_value_in_iterable
- is_all_values_in_iterable
- is_any_values_in_iterable
- is_valid_value


## `is_*()` function aliases
Expand All @@ -31,6 +41,7 @@
- is_in
- is_any_in
- is_all_in
- is_valid


## `assert_*()` functions
Expand All @@ -45,6 +56,7 @@
- assert_value_in_iterable
- assert_any_values_in_iterable
- assert_all_values_in_iterable
- assert_is_valid_value


## `assert_*()` function aliases
Expand All @@ -54,11 +66,15 @@
show_root_heading: false
members:
- assert_type
- assert_is_type
- assert_all_type
- assert_all_is_type
- assert_any_type
- assert_any_is_type
- assert_in
- assert_any_in
- assert_all_in
- assert_is_valid


## `*_contains()` functions
Expand Down
1 change: 1 addition & 0 deletions docs/code/generators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: toolbox_python.generators
23 changes: 12 additions & 11 deletions docs/code/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@

These are the modules used in this package:

| Module | Description |
|-----------------------------------|-------------|
| [Classes](./classes.md) | The `classes` module is designed for functions to be executed _on_ classes; not _within_ classes.<br>For any methods/functions that should be added _to_ classes, you should consider re-designing the original class, or sub-classing it to make further alterations.
| [Bools](./bools.md) | The `bools` module is used how to manipulate and enhance Python booleans.<br>Primarily, this module is used to store the `strtobool()` function, which used to be found in the `distutils.util` module, until it was deprecated. As mentioned in [PEP632](https://peps.python.org/pep-0632/#migration-advice), we should re-implement this function in our own code. And that's what we've done here.
| [Lists](./lists.md) | The `lists` module is used how to manipulate and enhance Python lists.<br>Note that functions in this module will only take-in and manipulate existing `#!py list` objects, and also output `#!py list` objects. It will not sub-class the base `#!py list` object, or create new '`#!py list`-like' objects. It will always remain pure python types at it's core.
| [Strings](./strings.md) | The `strings` module is for manipulating and checking certain string objects.
| [Dictionaries](./dictionaries.md) | The `dictionaries` module is used how to manipulate and enhance Python dictionaries.<br>Note that functions in this module will only take-in and manipulate existing `#!py dict` objects, and also output `#!py dict` objects. It will not sub-class the base `#!py dict` object, or create new '`#!py dict`-like' objects. It will always remain pure python types at it's core.
| [Checkers](./checkers.md) | Check certain values against other objects.
| [Output](./output.md) | The `output` module is for streamlining how data is outputted.<br>This includes `#!py print()`'ing to the terminal and `#!py log()`'ing to files.
| [Retry](./retry.md) | The `retry` module is for enabling automatic retrying of a given function when a specific `Exception` is thrown.
| [Defaults](./defaults.md) | The `defaults` module is used how to set and control default values for our various Python processes.
| Module | Description |
| --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Classes](./classes.md) | The `classes` module is designed for functions to be executed _on_ classes; not _within_ classes.<br>For any methods/functions that should be added _to_ classes, you should consider re-designing the original class, or sub-classing it to make further alterations. |
| [Bools](./bools.md) | The `bools` module is used how to manipulate and enhance Python booleans.<br>Primarily, this module is used to store the `strtobool()` function, which used to be found in the `distutils.util` module, until it was deprecated. As mentioned in [PEP632](https://peps.python.org/pep-0632/#migration-advice), we should re-implement this function in our own code. And that's what we've done here. |
| [Lists](./lists.md) | The `lists` module is used how to manipulate and enhance Python lists.<br>Note that functions in this module will only take-in and manipulate existing `#!py list` objects, and also output `#!py list` objects. It will not sub-class the base `#!py list` object, or create new '`#!py list`-like' objects. It will always remain pure python types at it's core. |
| [Strings](./strings.md) | The `strings` module is for manipulating and checking certain string objects. |
| [Dictionaries](./dictionaries.md) | The `dictionaries` module is used how to manipulate and enhance Python dictionaries.<br>Note that functions in this module will only take-in and manipulate existing `#!py dict` objects, and also output `#!py dict` objects. It will not sub-class the base `#!py dict` object, or create new '`#!py dict`-like' objects. It will always remain pure python types at it's core. |
| [Generators](./generators.md) | The `generators` module is for generating information as needed.<br>Such functions are typically used to generate data that is not stored in a database or file, but rather computed on-the-fly based on input parameters. |
| [Checkers](./checkers.md) | The `checkers` module provides functions to check certain values against other objects. It includes type checking, value validation, and membership checks. |
| [Output](./output.md) | The `output` module is for streamlining how data is outputted.<br>This includes `#!py print()`'ing to the terminal and `#!py log()`'ing to files. |
| [Retry](./retry.md) | The `retry` module is for enabling automatic retrying of a given function when a specific `Exception` is thrown. |
| [Defaults](./defaults.md) | The `defaults` module is used how to set and control default values for our various Python processes. |

## Testing

Expand Down
5 changes: 2 additions & 3 deletions mkdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ theme:
coverpage_icon: ./assets/images/python.svg
custom_dir: docs/overrides
palette:
# primary: teal
primary: blue grey
accent: indigo
features:
Expand All @@ -37,8 +36,7 @@ theme:
- content.action.view
logo: ./assets/images/python.svg
icon:
repo: material/gitlab
# logo: fontawesome/brands/python
repo: material/github
edit: material/file-edit-outline
view: material/file-eye-outline

Expand All @@ -53,6 +51,7 @@ nav:
- Lists: code/lists.md
- Strings: code/strings.md
- Dictionaries: code/dictionaries.md
- Generators: code/generators.md
- Checkers: code/checkers.md
- Output: code/output.md
- Retry: code/retry.md
Expand Down
Loading
Loading