-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
9 changed files
with
809 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,35 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
# Have at most one workflow instance per PR or branch SHA | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: pipx install poetry==$POETRY_VERSION | ||
env: | ||
POETRY_VERSION: 1.8.2 | ||
- name: Set up python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.8" | ||
cache: poetry | ||
- run: poetry check | ||
- run: poetry install --no-interaction | ||
- name: Add poetry venv to path | ||
run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH | ||
- run: ruff check --output-format=github . | ||
- run: mypy | ||
- uses: jakebailey/pyright-action@v2 |
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,80 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
release: | ||
types: | ||
- published | ||
workflow_dispatch: | ||
# XXX(ddn): For testing | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: hynek/build-and-inspect-python-package@v2 | ||
|
||
check-install: | ||
# Create clean python environment to verify package works from scratch | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.8' | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Packages | ||
path: dist | ||
- run: pip install pyright mypy | ||
- run: pip install ./dist/google_re2_stubs*.whl | ||
- run: pyright tests/api | ||
- run: mypy tests/api | ||
|
||
release-test-pypi: | ||
name: Release to test.pypi.org | ||
runs-on: ubuntu-latest | ||
environment: test-pypi | ||
permissions: | ||
# Required for trusted publishing | ||
id-token: write | ||
needs: | ||
- build | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Packages | ||
path: dist | ||
- name: Upload package to test.pypi.org | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
|
||
release-pypi: | ||
name: Release to pypi.org | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/google-re2-stubs | ||
permissions: | ||
# Required for trusted publishing | ||
id-token: write | ||
needs: | ||
- build | ||
if: github.event.action == 'published' | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Packages | ||
path: dist | ||
- name: Upload package to pypi.org | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
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,5 @@ | ||
# google-re2-stubs | ||
|
||
# Corvic Engine [](https://github.com/ddn0/google-re2-stubs/actions/workflows/ci.yaml) | ||
|
||
Python stubs for [google-re2](https://github.com/google/re2) package. |
Large diffs are not rendered by default.
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,154 @@ | ||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.poetry] | ||
# PEP-621 (standard project specification) will be part of Poetry 2.0 | ||
# https://github.com/python-poetry/roadmap/issues/3 | ||
# until then, use [tool.poetry] instead of [project] | ||
name = "google-re2-stubs" | ||
description = "Typestubs for google-re2" | ||
authors = ["Donald Nguyen"] | ||
license = "MIT" | ||
version = "0.1.0" | ||
readme = "README.md" | ||
packages = [ | ||
{ include = "re2-stubs", from = "src" } | ||
] | ||
|
||
[tool.poetry.dependencies] | ||
google-re2 = ">=1.0" | ||
python = "^3.8.0" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
pyright = "^1.1.365" | ||
mypy = "^1.10.0" | ||
ruff = "^0.4.7" | ||
|
||
[tool.ruff] | ||
force-exclude = true | ||
line-length = 88 | ||
target-version = "py38" | ||
src = ["src", "tests"] | ||
|
||
[tool.ruff.lint] | ||
select = [ | ||
"B", | ||
"C", | ||
"COM", | ||
"D", | ||
"DTZ", | ||
"E", | ||
"ERA", | ||
"EXE", | ||
"F", | ||
"FA", | ||
"FBT", | ||
"FIX", | ||
"G", | ||
"I", | ||
"ICN", | ||
"INP", | ||
"ISC002", | ||
"N", | ||
"NPY", | ||
"PD", | ||
"PERF", | ||
"PGH", | ||
"PIE", | ||
"PL", | ||
"PLC", | ||
"PLR", | ||
"PT", | ||
"PTH", | ||
"PYI", | ||
"Q", | ||
"RET", | ||
"RSE", | ||
"RUF", | ||
"SIM", | ||
"SLF", | ||
"SLOT", | ||
"T10", | ||
"T20", | ||
"TD", | ||
"TID", | ||
"TRY", | ||
"UP", | ||
"W", | ||
"YTT", | ||
] | ||
|
||
ignore = [ | ||
# Conflicts with ruff format | ||
"COM812", | ||
# Allow explicit concatenation | ||
"ISC003", | ||
# Having issue link with TODO is not necessary | ||
"TD003", | ||
# Allow TODO to exist | ||
"FIX002", | ||
# Do not complain about raising exception without arguments | ||
"RSE102", | ||
# Allow non-trivial exception messages | ||
"TRY003", | ||
# Allow use of print | ||
"T201", | ||
# Don't require docstrings on public methods | ||
"D102", | ||
# Don't require docstrings on public functions | ||
"D103", | ||
# Don't require docstrings on magic methods | ||
"D105", | ||
# Don't complain about __init__ method docstrings | ||
"D107", | ||
# Commented out code is allowed | ||
"ERA001", | ||
# We use `+` to concat long log messages across lines | ||
"G003", | ||
] | ||
[tool.ruff.lint.per-file-ignores] | ||
"src/**.pyi" = [ | ||
"N801", | ||
"N802", | ||
"N818", | ||
"FBT001", | ||
"FBT002", | ||
] | ||
|
||
[tool.ruff.lint.pydocstyle] | ||
convention = "google" | ||
|
||
[tool.ruff.lint.pylint] | ||
max-args = 8 | ||
|
||
[tool.ruff.format] | ||
docstring-code-format = true | ||
|
||
[tool.ruff.lint.pycodestyle] | ||
max-doc-length = 88 | ||
|
||
[tool.ruff.lint.flake8-tidy-imports] | ||
ban-relative-imports = "all" | ||
|
||
[tool.ruff.lint.isort] | ||
known-first-party = [ | ||
"re2", | ||
] | ||
|
||
[tool.pyright] | ||
include = ["src", "tests"] | ||
typeCheckingMode = "strict" | ||
# Enable additional checks beyond strict | ||
reportCallInDefaultInitializer = "error" | ||
reportImplicitOverride = "error" | ||
reportImplicitStringConcatenation = "error" | ||
reportImportCycles = "error" | ||
reportPropertyTypeMismatch = "error" | ||
reportShadowedImports = "error" | ||
reportUninitializedInstanceVariable = "error" | ||
reportUnnecessaryTypeIgnoreComment = "error" | ||
|
||
[tool.mypy] | ||
strict = true | ||
packages = "re2-stubs" |
Oops, something went wrong.