Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix pre-commit errors #9

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
name: "Publish to PyPi"
name: Publish to PyPi

permissions:
actions: "write"
actions: write

on:
workflow_run:
workflows: ["Python Tests"]
workflows: [Python Tests]
types:
- completed
- completed
branches:
- main
- main

jobs:
pypi-release:
name: "PyPi Release"
runs-on: "ubuntu-latest"
name: PyPi Release
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
- uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
- uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml

- name: Skip if version did not change.
run: |
version_change=$(git diff -r HEAD^1 pyproject.toml | grep -E "^(\+|-)version =")
if [[ -z "$version_change" ]]; then
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Skip if version did not change.
run: |
version_change=$(git diff -r HEAD^1 pyproject.toml | grep -E "^(\+|-)version =")
if [[ -z "$version_change" ]]; then
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build package.
run: |
pipx install poetry
poetry install --only main
poetry build
- name: Build package.
run: |
pipx install poetry
poetry install --only main
poetry build

- name: Publish to PyPi.
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
verbose: true
- name: Publish to PyPi.
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
verbose: true
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python_version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Install poetry
Expand Down Expand Up @@ -54,6 +54,6 @@ jobs:
with:
python-version-file: pyproject.toml
cache: poetry
- run: |
- run: |-
poetry install
poetry run mypy .
poetry run mypy .
10 changes: 6 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ repos:
- repo: https://github.com/python-poetry/poetry
rev: 1.7.1
hooks:
- id: poetry-check
- id: poetry-lock

- id: poetry-check

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
rev: v0.1.8
hooks:
- id: ruff
- id: ruff-format
Expand All @@ -18,6 +17,9 @@ repos:
hooks:
- id: mypy
args: [--ignore-missing-imports]
additional_dependencies:
- types-requests

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.11.0
hooks:
Expand Down
18 changes: 8 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 34 additions & 38 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,14 @@ tox-poetry-installer = "1.0.0b1"
[tool.poetry.group.docs.dependencies]
pdoc = "^14.1.0"

[tool.poetry.extras]
docs = ["pdoc"]
[tool.poetry.scripts]
cloai = 'cloai.__main__:main'

[tool.pytest.ini_options]
pythonpath = [
"src"
]

[tool.poetry.scripts]
cloai = 'cloai.__main__:main'

[tool.tox]
legacy_tox_ini = """
[tox]
Expand All @@ -63,40 +60,39 @@ ignore_missing_imports = true

[tool.ruff]
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv"
]
line-length = 88
indent-width = 4
src=["src"]

src = ["src"]
target-version = "py311"

[tool.ruff.lint]
select = ["ALL"]
ignore = [
"ANN101", # Self should never be type annotated.
"ANN102", # cls should never be type annotated.
"B008", # Allow function call in arguments; this is common in FastAPI.
"ANN101", # Self should never be type annotated.
"ANN102", # cls should never be type annotated.
"B008" # Allow function call in arguments; this is common in FastAPI.
]
fixable = ["ALL"]
unfixable = []
Expand All @@ -113,15 +109,15 @@ convention = "google"

[tool.ruff.per-file-ignores]
"tests/**/*.py" = [
"S101", # Allow assets
"ARG", # Unused arguments are common in tests (fixtures).
"FBT", #Allow positional booleans
"SLF001", # Allow private member access.
"INP001", # No need for namespace packages in tests.
"S101", # Allow assets
"ARG", # Unused arguments are common in tests (fixtures).
"FBT", # Allow positional booleans
"SLF001", # Allow private member access.
"INP001" # No need for namespace packages in tests.
]
"src/**/models.py" = [
"A003", # Allow id as a field name.
"A003" # Allow id as a field name.
]
"src/**/schemas.py" = [
"A003", # Allow id as a field name.
"A003" # Allow id as a field name.
]