Skip to content

Commit 9f32bcc

Browse files
authored
Merge pull request #36 from data-science-extensions/updates
Comprehensive Package Enhancement and Tooling Migration with new modules, improved validation, and modernized CI/CD workflows
2 parents 03d5d4c + fa1f050 commit 9f32bcc

31 files changed

Lines changed: 2031 additions & 459 deletions

.github/workflows/cd.yml

Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ concurrency:
1414
group: "pages"
1515
cancel-in-progress: true
1616

17+
env:
18+
VERSION: ${{ github.event.release.tag_name }}
19+
UV_LINK_MODE: copy
20+
UV_NATIVE_TLS: true
21+
UV_NO_SYNC: true
22+
1723
jobs:
1824

1925
debug:
@@ -123,30 +129,26 @@ jobs:
123129
with:
124130
python-version: '3.13'
125131

132+
- name: Install dependencies
133+
id: install-dependencies
134+
run: uv sync --no-cache --all-groups
135+
126136
- name: Set up Git
127137
id: setup-git
128138
env:
129139
GITHUB_ACTOR: ${{ github.actor }}
130140
run: |
131-
make configure-git
132-
make git-switch-to-main-branch
133-
make git-refresh-current-branch
134-
135-
- name: Install dependencies
136-
id: install-dependencies
137-
run: make install-all
141+
uv run add-git-credentials
142+
uv run git-switch-to-main-branch
143+
uv run git-refresh-current-branch
138144
139145
- name: Run checks
140146
id: run-checks
141-
run: make check
142-
143-
- name: Copy coverage report
144-
id: copy-coverage-report
145-
run: make copy-coverage-report
147+
run: uv run check
146148

147-
- name: Commit coverage report
148-
id: commit-coverage-report
149-
run: make commit-coverage-report
149+
- name: Add coverage report
150+
id: add-coverage-report
151+
run: uv run git-add-coverage-report
150152

151153
- name: Upload coverage
152154
id: upload-coverage
@@ -185,41 +187,37 @@ jobs:
185187

186188
- name: Check VERSION
187189
id: check-version
188-
env:
189-
VERSION: ${{ github.event.release.tag_name }}
190190
run: |
191191
if [ -z "${VERSION}" ]; then
192192
echo "/$VERSION is missing. Please try again."
193193
exit 1
194194
fi
195195
196196
- name: Install dependencies
197-
run: make install
197+
run: uv sync --no-cache
198198

199199
- name: Setup Git
200200
id: setup-git
201-
env:
202-
GITHUB_ACTOR: ${{ github.actor }}
203201
run: |
204-
make configure-git
205-
make git-switch-to-main-branch
206-
make git-refresh-current-branch
202+
uv run add-git-credentials
203+
uv run git-switch-to-main-branch
204+
uv run git-refresh-current-branch
207205
208206
- name: Bump version
209207
id: bump-version
210-
env:
211-
VERSION: ${{ github.event.release.tag_name }}
212-
run: make bump-version
208+
run: uv run bump-version --verbose=true version=${VERSION}
209+
210+
- name: Update Git Version
211+
id: update-git-version
212+
run: uv run git-update-version
213213

214-
- name: Update Git
215-
id: update-git
216-
env:
217-
VERSION: ${{ github.event.release.tag_name }}
218-
run: make update-git
214+
- name: Fix tag reference
215+
id: fix-tag-reference
216+
run: uv run git-fix-tag-reference
219217

220218
- name: Build package
221219
id: build-package
222-
run: make build-package
220+
run: uv build --out-dir=dist
223221

224222
- name: Upload assets
225223
id: upload-assets
@@ -270,7 +268,7 @@ jobs:
270268
id: publish-package
271269
env:
272270
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
273-
run: make publish-package
271+
run: uv publish --token ${PYPI_TOKEN}
274272

275273
- name: Check
276274
id: check
@@ -343,20 +341,17 @@ jobs:
343341

344342
- name: Install dependencies
345343
id: install-dependencies
346-
run: make install-docs
344+
run: uv sync --group=docs
347345

348346
- name: Setup Git
349347
id: setup-git
350348
env:
351349
GITHUB_ACTOR: ${{ github.actor }}
352350
run: |
353-
make configure-git
354-
make git-switch-to-main-branch
355-
make git-refresh-current-branch
351+
uv run add-git-credentials
352+
uv run git-switch-to-main-branch
353+
uv run git-refresh-current-branch
356354
357355
- name: Build docs
358356
id: build-docs
359-
env:
360-
VERSION: ${{ github.event.release.tag_name }}
361-
GITHUB_ACTOR: ${{ github.actor }}
362-
run: make build-versioned-docs
357+
run: uv run build-versioned-docs

.github/workflows/ci.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: CI
22

33
on: [push, pull_request]
44

5+
env:
6+
UV_LINK_MODE: copy
7+
UV_NATIVE_TLS: true
8+
UV_NO_SYNC: true
9+
510
jobs:
611

712
debug:
@@ -103,10 +108,10 @@ jobs:
103108
python-version-file: "pyproject.toml"
104109

105110
- name: Install dependencies
106-
run: make install-all
111+
run: uv sync --no-cache --all-groups
107112

108113
- name: Run checks
109-
run: make check
114+
run: uv run check
110115

111116
ci:
112117

@@ -135,7 +140,7 @@ jobs:
135140
python-version: ${{ matrix.python-version }}
136141

137142
- name: Install dependencies
138-
run: make install-all
143+
run: uv sync --no-cache --all-groups
139144

140145
- name: Run checks
141-
run: make check
146+
run: uv run check

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ poetry.lock
44
Pipfile
55
Pipfile.lock
66
.vscode/
7+
git_output/
78

89
# Byte-compiled / optimized / DLL files
910
__pycache__/

.pre-commit-config.yaml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ repos:
4848

4949
# Run MyPy type checks
5050
- repo: https://github.com/pre-commit/mirrors-mypy
51-
rev: "v1.15.0"
51+
rev: "v1.16.1"
5252
hooks:
5353
- id: mypy
5454
files: src/toolbox_python
5555
args:
5656
- "--install-types"
5757
- "--config-file=pyproject.toml"
58+
- "--allow-redefinition"
5859

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

6869
# Find any outdated syntax and replace with modern equivalents
6970
- repo: https://github.com/asottile/pyupgrade
70-
rev: "v3.19.1"
71+
rev: "v3.20.0"
7172
hooks:
7273
- id: pyupgrade
7374
name: Upgrade Python features
@@ -93,24 +94,20 @@ repos:
9394
args:
9495
- "--all"
9596

96-
# # Check poetry configs
97-
# - repo: https://github.com/python-poetry/poetry
98-
# rev: "2.1.1"
99-
# hooks:
100-
# - id: poetry-check
101-
10297
# Check uv configs
10398
- repo: https://github.com/astral-sh/uv-pre-commit
104-
rev: "0.6.12"
99+
rev: "0.7.20"
105100
hooks:
106101
- id: uv-lock
107102
- id: uv-sync
108103
# args:
109104
# - "--all-groups"
110105

111-
# Run Pylint
106+
# Everything run locally
112107
- repo: local
113108
hooks:
109+
110+
# Run Pylint
114111
- id: pylint
115112
name: pylint
116113
entry: pipenv run pylint
@@ -120,3 +117,10 @@ repos:
120117
- "--rcfile=pyproject.toml"
121118
- "-rn" # Only display messages
122119
- "-sn" # Don't display the score
120+
121+
# Check
122+
- id: check-docstrings
123+
name: Check Docstrings
124+
entry: uv run --no-sync --link-mode=copy check-docstrings
125+
language: system
126+
types: [python]

docs/code/checkers.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
-
66

77

8+
## Constants
9+
10+
::: toolbox_python.checkers
11+
options:
12+
show_root_heading: false
13+
members:
14+
- OPERATORS
15+
16+
817
## `is_*()` functions
918

1019
::: toolbox_python.checkers
@@ -17,6 +26,7 @@
1726
- is_value_in_iterable
1827
- is_all_values_in_iterable
1928
- is_any_values_in_iterable
29+
- is_valid_value
2030

2131

2232
## `is_*()` function aliases
@@ -31,6 +41,7 @@
3141
- is_in
3242
- is_any_in
3343
- is_all_in
44+
- is_valid
3445

3546

3647
## `assert_*()` functions
@@ -45,6 +56,7 @@
4556
- assert_value_in_iterable
4657
- assert_any_values_in_iterable
4758
- assert_all_values_in_iterable
59+
- assert_is_valid_value
4860

4961

5062
## `assert_*()` function aliases
@@ -54,11 +66,15 @@
5466
show_root_heading: false
5567
members:
5668
- assert_type
69+
- assert_is_type
5770
- assert_all_type
71+
- assert_all_is_type
5872
- assert_any_type
73+
- assert_any_is_type
5974
- assert_in
6075
- assert_any_in
6176
- assert_all_in
77+
- assert_is_valid
6278

6379

6480
## `*_contains()` functions

docs/code/generators.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: toolbox_python.generators

docs/code/index.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44

55
These are the modules used in this package:
66

7-
| Module | Description |
8-
|-----------------------------------|-------------|
9-
| [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.
10-
| [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.
11-
| [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.
12-
| [Strings](./strings.md) | The `strings` module is for manipulating and checking certain string objects.
13-
| [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.
14-
| [Checkers](./checkers.md) | Check certain values against other objects.
15-
| [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.
16-
| [Retry](./retry.md) | The `retry` module is for enabling automatic retrying of a given function when a specific `Exception` is thrown.
17-
| [Defaults](./defaults.md) | The `defaults` module is used how to set and control default values for our various Python processes.
7+
| Module | Description |
8+
| --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
9+
| [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. |
10+
| [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. |
11+
| [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. |
12+
| [Strings](./strings.md) | The `strings` module is for manipulating and checking certain string objects. |
13+
| [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. |
14+
| [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. |
15+
| [Checkers](./checkers.md) | The `checkers` module provides functions to check certain values against other objects. It includes type checking, value validation, and membership checks. |
16+
| [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. |
17+
| [Retry](./retry.md) | The `retry` module is for enabling automatic retrying of a given function when a specific `Exception` is thrown. |
18+
| [Defaults](./defaults.md) | The `defaults` module is used how to set and control default values for our various Python processes. |
1819

1920
## Testing
2021

mkdocs.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ theme:
1919
coverpage_icon: ./assets/images/python.svg
2020
custom_dir: docs/overrides
2121
palette:
22-
# primary: teal
2322
primary: blue grey
2423
accent: indigo
2524
features:
@@ -37,8 +36,7 @@ theme:
3736
- content.action.view
3837
logo: ./assets/images/python.svg
3938
icon:
40-
repo: material/gitlab
41-
# logo: fontawesome/brands/python
39+
repo: material/github
4240
edit: material/file-edit-outline
4341
view: material/file-eye-outline
4442

@@ -53,6 +51,7 @@ nav:
5351
- Lists: code/lists.md
5452
- Strings: code/strings.md
5553
- Dictionaries: code/dictionaries.md
54+
- Generators: code/generators.md
5655
- Checkers: code/checkers.md
5756
- Output: code/output.md
5857
- Retry: code/retry.md

0 commit comments

Comments
 (0)