-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 401269c
Showing
18 changed files
with
1,155 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: check | ||
|
||
on: push | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- python-version: "3.9" | ||
usable-python-version: "3.9" | ||
- python-version: "3.10" | ||
usable-python-version: "3.10" | ||
- python-version: "3.11" | ||
usable-python-version: "3.11" | ||
- python-version: "3.12" | ||
usable-python-version: "3.12" | ||
- python-version: "3.13" | ||
usable-python-version: "3.13" | ||
env: | ||
# Configure a constant location for the uv cache | ||
UV_CACHE_DIR: /tmp/.uv-cache | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Restore px cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./.pyprojectx | ||
key: uv-${{ runner.os }}-${{ hashFiles('pw.lock') }} | ||
restore-keys: | | ||
uv-${{ runner.os }}-${{ hashFiles('pw.lock') }} | ||
uv-${{ runner.os }} | ||
- name: Restore uv cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: /tmp/.uv-cache | ||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | ||
restore-keys: | | ||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | ||
uv-${{ runner.os }} | ||
- name: Install the project | ||
run: ./pw install | ||
|
||
- name: Run tests | ||
run: ./pw uv run pytest tests | ||
- name: typecheck | ||
run: ./pw uv run mypy | ||
- name: lint | ||
This comment has been minimized.
Sorry, something went wrong. |
||
run: ./pw uv run ruff check --output-format github | ||
- name: lint | ||
run: ./pw uv run ruff format --check --diff | ||
|
||
- name: set minimum deps | ||
if: ${{ matrix.python-version != '3.13' }} # no wheels | ||
run: ./pw uv pip install pydantic==2.4.2 | ||
- name: Run tests | ||
if: ${{ matrix.python-version != '3.13' }} # no wheels | ||
run: ./pw uv run pytest tests | ||
- name: typecheck | ||
if: ${{ matrix.python-version != '3.13' }} # no wheels | ||
run: ./pw uv run mypy | ||
|
||
- name: Minimize uv cache | ||
run: ./pw uv cache prune --ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: publish | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
# Configure a constant location for the uv cache | ||
UV_CACHE_DIR: /tmp/.uv-cache | ||
python_version: "3.13" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: $python_version | ||
|
||
- name: Restore px cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./.pyprojectx | ||
key: uv-${{ runner.os }}-${{ hashFiles('pw.lock') }} | ||
restore-keys: | | ||
uv-${{ runner.os }}-${{ hashFiles('pw.lock') }} | ||
uv-${{ runner.os }} | ||
- name: Restore uv cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: /tmp/.uv-cache | ||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | ||
restore-keys: | | ||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | ||
uv-${{ runner.os }} | ||
- run: ./pw uv build | ||
- run: ./pw uv publish | ||
env: | ||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | ||
|
||
# Upload wheel as a release asset | ||
- name: Upload Release Asset | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: gh release upload ${{ github.event.release.tag_name }} ./dist/* | ||
|
||
- name: Minimize uv cache | ||
run: ./pw uv cache prune --ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# PyCharm | ||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can | ||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore | ||
# and can be added to the global gitignore or merged into this file. For a more nuclear | ||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
#.idea/ | ||
|
||
/.pyprojectx |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# pydantic-basedtyping | ||
|
||
support for basedtyping features with pydantic: | ||
|
||
```py | ||
from pydantic import BaseModel | ||
|
||
class A(BaseModel): | ||
a: 1 | 2 | ||
A(a=1) # A(a=1) | ||
A(a=2) # A(a=2) | ||
A(a=3) # ValidationError | ||
``` | ||
|
||
# installation | ||
|
||
1. add `pydantic-basedtyping` as a dependency | ||
2. install the plugin with: | ||
```console | ||
python -m pydantic_basedtyping install | ||
``` | ||
|
||
this can be configured with pyprojectx: | ||
```toml | ||
[tool.pyprojectx] | ||
This comment has been minimized.
Sorry, something went wrong. |
||
install = "uv sync; uv run python -m pydantic_basedtyping install" | ||
``` |
Oops, something went wrong.
don't need to lint in the matrix