diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 76ce671..893a651 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,7 +3,6 @@ on: pull_request: branches: - main - - release/** workflow_dispatch: {} jobs: @@ -13,12 +12,13 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10.2.0 - uses: actions/setup-python@v7 with: python-version: "3.14" - - run: pip install --group lint -e . - - run: pre-commit run --all-files - - run: mypy looptime --strict + - run: uv sync --no-dev --group lint + - run: uv run --no-sync pre-commit run --all-files + - run: uv run --no-sync mypy unit-tests: strategy: @@ -26,34 +26,35 @@ jobs: matrix: # Assumption: if free-threaded works in one version, it works in all versions. python-version: [ "3.11", "3.12", "3.13", "3.14", "3.14t" ] - name: Python ${{ matrix.python-version }}${{ matrix.install-extras && ', ' || '' }}${{ matrix.install-extras }} + name: Python ${{ matrix.python-version }} runs-on: ubuntu-26.04 timeout-minutes: 5 steps: - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10.2.0 - uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }} - - run: pip install --group dev -e . - - run: pip install "${{ matrix.install-extras }}" - if: ${{ matrix.install-extras }} - - run: pytest --color=yes --cov=looptime --cov-branch + - run: uv sync --no-dev --group test + - run: uv run --no-sync coverage run --branch --source=looptime -m pytest --color=yes - name: Publish coverage to Coveralls.io + uses: coverallsapp/github-action@v2 + with: + parallel: true + flag-name: ${{ matrix.python-version }} if: success() - run: coveralls --service=github - env: - GITHUB_TOKEN: ${{ secrets.github_token }} - continue-on-error: true + continue-on-error: true # tends to fail with no code changes (e.g. only CI/docs) - name: Publish coverage to CodeCov.io - uses: codecov/codecov-action@v3 - if: success() + uses: codecov/codecov-action@v7 env: PYTHON: ${{ matrix.python-version }} with: flags: unit env_vars: PYTHON + token: ${{ secrets.CODECOV_TOKEN }} + if: success() continue-on-error: true # No coverage: PyPy performs extremely poorly with tracing/coverage. @@ -67,21 +68,20 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10.2.0 - uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }} - - run: pip install --group dev -e . - - run: pytest --color=yes --no-cov + - run: uv sync --no-dev --group test + - run: uv run --no-sync pytest --color=yes --no-cov coveralls-finish: name: Finalize coveralls.io needs: [unit-tests] runs-on: ubuntu-26.04 steps: - - uses: actions/setup-python@v7 - - run: pip install coveralls - - run: coveralls --service=github --finish - env: - GITHUB_TOKEN: ${{ secrets.github_token }} - continue-on-error: true + - name: Finish coverage at Coveralls.io + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true diff --git a/.github/workflows/thorough.yaml b/.github/workflows/thorough.yaml index c99c308..3314b8b 100644 --- a/.github/workflows/thorough.yaml +++ b/.github/workflows/thorough.yaml @@ -3,7 +3,6 @@ on: push: branches: - main - - release/** schedule: - cron: "13 3 * * 6" workflow_dispatch: {} @@ -15,12 +14,13 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10.2.0 - uses: actions/setup-python@v7 with: python-version: "3.14" - - run: pip install --group dev --group lint -e . - - run: pre-commit run --all-files - - run: mypy looptime --strict + - run: uv sync --no-dev --group lint + - run: uv run --no-sync pre-commit run --all-files + - run: uv run --no-sync mypy unit-tests: strategy: @@ -33,27 +33,30 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10.2.0 - uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }} - - run: pip install --group dev -e . - - run: pytest --color=yes --cov=looptime --cov-branch + - run: uv sync --no-dev --group test + - run: uv run --no-sync coverage run --branch --source=looptime -m pytest --color=yes - name: Publish coverage to Coveralls.io + uses: coverallsapp/github-action@v2 + with: + parallel: true + flag-name: ${{ matrix.python-version }} if: success() - run: coveralls --service=github - env: - GITHUB_TOKEN: ${{ secrets.github_token }} - continue-on-error: true + continue-on-error: true # tends to fail with no code changes (e.g. only CI/docs) - name: Publish coverage to CodeCov.io - uses: codecov/codecov-action@v3 - if: success() + uses: codecov/codecov-action@v7 env: PYTHON: ${{ matrix.python-version }} with: flags: unit env_vars: PYTHON + token: ${{ secrets.CODECOV_TOKEN }} + if: success() continue-on-error: true # No coverage: PyPy performs extremely poorly with tracing/coverage. @@ -67,21 +70,20 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v10.2.0 - uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }} - - run: pip install --group dev -e . - - run: pytest --color=yes --no-cov + - run: uv sync --no-dev --group test + - run: uv run --no-sync pytest --color=yes --no-cov coveralls-finish: name: Finalize coveralls.io needs: [unit-tests] runs-on: ubuntu-26.04 steps: - - uses: actions/setup-python@v7 - - run: pip install coveralls - - run: coveralls --service=github --finish - env: - GITHUB_TOKEN: ${{ secrets.github_token }} - continue-on-error: true + - name: Finish coverage at Coveralls.io + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true diff --git a/pyproject.toml b/pyproject.toml index 5c31d74..d75f585 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ docs = [ "sphinx-llm>=0.1.4", "furo", ] -dev = [ +test = [ "async-timeout", "codecov", "coverage", @@ -61,19 +61,42 @@ dev = [ "pytest-mock", ] lint = [ - {include-group = "dev"}, + {include-group = "test"}, "mypy==2.3.1", "pre-commit", "isort", ] +dev = [ + {include-group = "docs"}, + {include-group = "lint"}, + {include-group = "test"}, +] [tool.setuptools_scm] version_file = "looptime/_version.py" +[tool.uv] +exclude-newer = "7 days" +# MyPy is pinned, so the intent is explicit, no need for time constraints. +exclude-newer-package = { mypy=false } + [tool.mypy] +strict = true +packages = ["looptime"] +exclude = ['(^|/)test_.*\.py$'] +python_version = "3.11" +exclude_gitignore = true warn_unused_configs = true ignore_missing_imports = true +[tool.pytest] +minversion = "9.0" +asyncio_mode = "auto" +asyncio_default_fixture_loop_scope = "function" +log_format = "%(asctime)s %(levelname)s %(message)s" +log_date_format = "%Y-%m-%d %H:%M:%S" +addopts = ["--strict-markers"] + [tool.isort] line_length = 120 multi_line_output = 11