Skip to content

Commit ccb1bb7

Browse files
committed
batman
1 parent 94cb4fb commit ccb1bb7

18 files changed

Lines changed: 1569 additions & 337 deletions

.github/workflows/publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# .github/workflows/publish.yml
2+
3+
name: Publish to PyPI
4+
5+
# This workflow runs when a new tag is pushed that starts with 'v'
6+
# e.g., v0.1.0, v1.2.3
7+
on:
8+
push:
9+
tags:
10+
- 'v*'
11+
12+
jobs:
13+
publish:
14+
name: Build and publish to PyPI
15+
runs-on: ubuntu-latest
16+
17+
# These permissions are necessary to authenticate with PyPI using OpenID Connect.
18+
# It's a more secure method than using a long-lived API token.
19+
permissions:
20+
id-token: write # This is required for trusted publishing
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.x"
30+
31+
- name: Install build dependencies
32+
run: python -m pip install build
33+
34+
- name: Build package
35+
run: python -m build
36+
37+
- name: Publish package to PyPI
38+
uses: pypa/gh-action-pypi-publish@release/v1
39+
# No API token is needed in the 'with' block.
40+
# The action automatically handles authentication via the id-token permission.
Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,46 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
1+
# .github/workflows/python-package.yml
32

4-
name: Python package
3+
name: CI
54

65
on:
76
push:
8-
branches: [ "master" ]
7+
branches: [ "master", "main" ] # Also works on 'main' branch
98
pull_request:
10-
branches: [ "master" ]
9+
branches: [ "master", "main" ]
1110

1211
jobs:
1312
build:
14-
1513
runs-on: ubuntu-latest
1614
strategy:
1715
fail-fast: false
1816
matrix:
19-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
17+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] # Adjusted for modern versions
2018

2119
steps:
22-
- uses: actions/checkout@v3
20+
- name: Checkout code
21+
uses: actions/checkout@v4 # Use the latest version
22+
2323
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v3
24+
uses: actions/setup-python@v5 # Use the latest version
2525
with:
2626
python-version: ${{ matrix.python-version }}
27+
2728
- name: Install dependencies
2829
run: |
2930
python -m pip install --upgrade pip
30-
python -m pip install flake8 goroutine-py
31-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32-
- name: Lint with flake8
31+
# This command installs the project from local files in editable mode (-e)
32+
# and includes the [test] dependencies from pyproject.toml
33+
python -m pip install -e ".[test]"
34+
35+
- name: Lint with flake8, black, and isort
3336
run: |
3437
# stop the build if there are Python syntax errors or undefined names
3538
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
36-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
38-
- name: Test demo
39+
# Check formatting with black
40+
black --check .
41+
# Check import sorting with isort
42+
isort --check .
43+
44+
- name: Run tests with pytest
3945
run: |
40-
python demo.py
46+
pytest

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Build artifacts
7+
build/
8+
dist/
9+
*.egg-info/
10+
*.whl
11+
*.tar.gz
12+
13+
# Virtual environment
14+
venv/
15+
.venv/
16+
17+
# Test artifacts
18+
.pytest_cache/
19+
.coverage
20+
21+
# IDEs
22+
.vscode/
23+
.idea/
24+
25+
# macOS
26+
.DS_Store

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# .pre-commit-config.yaml
2+
repos:
3+
- repo: https://github.com/psf/black
4+
rev: 24.4.2
5+
hooks:
6+
- id: black
7+
- repo: https://github.com/pycqa/isort
8+
rev: 5.13.2
9+
hooks:
10+
- id: isort

.python-version

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

LICENSE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
MIT License
22

3-
Copyright (c) 2022 ZIHAN MA
3+
Copyright (c) 2025 Anton Vice
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
77
in the Software without restriction, including without limitation the rights
88
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
10+
furnished to do so, to the following conditions:
1111

1212
The above copyright notice and this permission notice shall be included in all
1313
copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
IMPLIED, INCLUDING BUT NOTLIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README-CN.md

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)