Skip to content

Commit 8aa9c3c

Browse files
committed
refactor(api): Update type hints and docstrings for clarity and consistency
Update type hints and docstrings across various modules to improve code readability and maintainability. Signed-off-by: longhao <[email protected]>
1 parent a3f7267 commit 8aa9c3c

File tree

15 files changed

+505
-2178
lines changed

15 files changed

+505
-2178
lines changed

.github/workflows/publish_docs.yml

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,40 @@
1-
name: Deploy Documentation
2-
3-
on:
4-
push:
5-
branches: [ main ]
6-
paths:
7-
- 'docs/**'
8-
- 'mkdocs.yml'
9-
- '.github/workflows/publish_docs.yml'
10-
- 'pyproject.toml'
11-
- 'poetry.lock'
12-
workflow_dispatch:
13-
14-
jobs:
15-
deploy-docs:
16-
runs-on: ubuntu-latest
17-
steps:
18-
- uses: actions/checkout@v4
19-
with:
20-
fetch-depth: 0
21-
22-
- name: Set up Python
23-
uses: actions/setup-python@v5
24-
with:
25-
python-version: '3.9'
26-
cache: 'pip'
27-
28-
- name: Install dependencies
29-
run: |
30-
python -m pip install --upgrade pip
31-
pip install poetry
32-
poetry config virtualenvs.create false
33-
poetry install --only docs
34-
35-
- name: Configure Git
36-
run: |
37-
git config --global user.name "github-actions[bot]"
38-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
39-
40-
- name: Deploy documentation
41-
run: |
42-
mkdocs gh-deploy --force
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'docs/**'
8+
- 'mkdocs.yml'
9+
- '.github/workflows/publish_docs.yml'
10+
- 'pyproject.toml'
11+
- 'poetry.lock'
12+
workflow_dispatch:
13+
14+
jobs:
15+
deploy-docs:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.9'
26+
cache: 'pip'
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install nox
32+
33+
- name: Configure Git
34+
run: |
35+
git config --global user.name "github-actions[bot]"
36+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
37+
38+
- name: Build and deploy documentation
39+
run: |
40+
nox -s docs

.github/workflows/python-publish.yml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,32 @@ jobs:
1919
token: "${{ secrets.GITHUB_TOKEN }}"
2020
fetch-depth: 0
2121
ref: main
22+
2223
- uses: olegtarasov/[email protected]
2324
id: get_tag_name
2425
with:
2526
tagRegex: "v(?<version>.*)"
27+
2628
- name: Set up Python
2729
uses: actions/setup-python@v5
2830
with:
2931
python-version: '3.x'
32+
cache: 'pip'
33+
3034
- name: Install dependencies
3135
run: |
32-
python -m pip install -U pip poetry mkdocs mkdocs-material
33-
poetry --version
34-
poetry build
35-
# Note that we don't need credentials.
36-
# We rely on https://docs.pypi.org/trusted-publishers/.
36+
python -m pip install --upgrade pip
37+
pip install nox build
38+
39+
- name: Build package
40+
run: |
41+
python -m build
42+
3743
- name: Upload to PyPI
3844
uses: pypa/gh-action-pypi-publish@release/v1
3945
with:
4046
packages-dir: dist
47+
4148
- name: Generate changelog
4249
id: changelog
4350
uses: jaywcjlove/changelog-generator@main
@@ -50,12 +57,22 @@ jobs:
5057
{{fix}}
5158
## Feature
5259
{{feat}}
53-
## Improve
54-
{{refactor,perf,clean}}
55-
## Misc
56-
{{chore,style,ci||🔶 Nothing change}}
57-
## Unknown
58-
{{__unknown__}}
60+
## Breaking Changes
61+
{{breaking}}
62+
## Updates
63+
{{chore}}
64+
## Document
65+
{{docs}}
66+
## Dependency
67+
{{deps}}
68+
## Style
69+
{{style}}
70+
## Test
71+
{{test}}
72+
## CI
73+
{{ci}}
74+
## Other
75+
{{other}}
5976
- uses: ncipollo/release-action@v1
6077
with:
6178
artifacts: "dist/*.whl"

.github/workflows/pythonpackage.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,13 @@ jobs:
1717
uses: actions/setup-python@v5
1818
with:
1919
python-version: ${{ matrix.python-version }}
20+
cache: 'pip'
21+
2022
- name: Install dependencies
2123
run: |
22-
python -m pip install -U pip poetry
23-
poetry --version
24-
poetry install
24+
python -m pip install --upgrade pip
25+
pip install nox
2526
26-
- name: Run tests and linters
27+
- name: Run linting checks
2728
run: |
28-
#!/bin/sh -e
29-
git config --global user.email "[email protected]"
30-
git config --global user.name "GitHub Action"
31-
export PREFIX="poetry run python -m "
32-
if [ -d 'venv' ] ; then
33-
export PREFIX="venv/bin/"
34-
fi
35-
36-
${PREFIX}black photoshop --check
37-
${PREFIX}isort --check-only photoshop
38-
${PREFIX}flake8 photoshop --max-line-length 120
29+
nox -s pre-commit

.github/workflows/test_docs.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- '.github/workflows/test_docs.yml'
1010
- 'pyproject.toml'
1111
- 'poetry.lock'
12+
- 'noxfile.py'
1213

1314
jobs:
1415
test-docs:
@@ -30,17 +31,8 @@ jobs:
3031
- name: Install dependencies
3132
run: |
3233
python -m pip install --upgrade pip
33-
pip install poetry==${{ vars.POETRY_VERSION || '1.7.1' }}
34-
poetry config virtualenvs.create false
35-
poetry install --with docs
34+
pip install nox
3635
3736
- name: Test documentation build
3837
run: |
39-
mkdocs build --strict
40-
41-
- name: Check for documentation warnings
42-
run: |
43-
if grep -r "WARNING" site/; then
44-
echo "Documentation contains warnings"
45-
exit 1
46-
fi
38+
nox -s docs-build

.github/workflows/tests.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
tests:
11+
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
17+
os: [windows-latest]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
cache: 'pip'
29+
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install nox
34+
35+
- name: Run tests
36+
run: |
37+
nox -s tests

0 commit comments

Comments
 (0)