diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 13e77b0..d3ff093 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,11 +29,11 @@ jobs: - name: Lint with ruff run: uv run ruff check . - - name: Check formatting with black - run: uv run black --check . + - name: Check formatting with ruff + run: uv run ruff format --check . - - name: Run tests - run: uv run pytest tests/ -q + - name: Run tests with coverage + run: uv run pytest tests/ -q --cov=mistral_ocr --cov-report=term-missing typecheck: runs-on: ubuntu-latest @@ -52,4 +52,4 @@ jobs: - name: Type check with mypy run: uv run mypy mistral_ocr/ --ignore-missing-imports - continue-on-error: true # pre-existing type issues, will enforce once fixed + continue-on-error: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..27a8c86 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,28 @@ +name: Publish to PyPI + +on: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write # trusted publishing + + steps: + - uses: actions/checkout@v4 + + - uses: astral-sh/setup-uv@v4 + with: + version: "latest" + + - name: Set up Python + run: uv python install 3.12 + + - name: Build package + run: uv build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/pyproject.toml b/pyproject.toml index 7abca40..36ec42e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,6 @@ dependencies = [ [project.optional-dependencies] dev = [ "pytest>=8.0.0", - "black>=24.0.0", "ruff>=0.3.0", "mypy>=1.8.0", "pytest-cov>=4.1.0", @@ -56,10 +55,6 @@ build-backend = "hatchling.build" [tool.hatch.build.targets.wheel] packages = ["mistral_ocr"] -[tool.black] -line-length = 100 -target-version = ['py311'] - [tool.ruff] line-length = 100 @@ -67,6 +62,19 @@ line-length = 100 select = ["E", "F", "I", "N", "UP", "B", "C4", "SIM"] ignore = ["E501", "SIM108"] +[tool.pytest.ini_options] +addopts = "--cov=mistral_ocr --cov-report=term-missing --no-header -q" + +[tool.coverage.run] +source = ["mistral_ocr"] + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "if __name__ == .__main__.", + "raise RuntimeError", +] + [tool.mypy] python_version = "3.11" warn_return_any = true