diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9e44b35..00835fb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,13 +9,13 @@ on: jobs: linters: name: Linting and static analysis - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 5 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.13" - run: pip install -r requirements.txt - run: pre-commit run --all-files - run: mypy looptime --strict @@ -24,13 +24,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.7", "3.8", "3.9", "3.10" ] + python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] name: Python ${{ matrix.python-version }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 5 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -45,7 +45,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.github_token }} continue-on-error: true - name: Publish coverage to CodeCov.io - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v3 if: success() env: PYTHON: ${{ matrix.python-version }} @@ -59,13 +59,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "pypy-3.7", "pypy-3.8" ] + python-version: [ "pypy-3.9", "pypy-3.10", "pypy-3.11" ] name: Python ${{ matrix.python-version }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 5 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -76,9 +76,9 @@ jobs: coveralls-finish: name: Finalize coveralls.io needs: [unit-tests] - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5 - run: pip install coveralls - run: coveralls --service=github --finish env: diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 1a2f551..ec46ebe 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -11,10 +11,10 @@ on: jobs: publish: name: Build and publish - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: "3.10" - run: pip install --upgrade setuptools wheel twine diff --git a/.github/workflows/thorough.yaml b/.github/workflows/thorough.yaml index 4970cf5..2206545 100644 --- a/.github/workflows/thorough.yaml +++ b/.github/workflows/thorough.yaml @@ -11,13 +11,13 @@ on: jobs: linters: name: Linting and static analysis - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 5 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.13" - run: pip install -r requirements.txt - run: pre-commit run --all-files - run: mypy looptime --strict @@ -26,13 +26,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.7", "3.8", "3.9", "3.10" ] + python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] name: Python ${{ matrix.python-version }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 5 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -47,7 +47,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.github_token }} continue-on-error: true - name: Publish coverage to CodeCov.io - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v3 if: success() env: PYTHON: ${{ matrix.python-version }} @@ -61,13 +61,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "pypy-3.7", "pypy-3.8" ] + python-version: [ "pypy-3.9", "pypy-3.10", "pypy-3.11" ] name: Python ${{ matrix.python-version }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 5 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -78,9 +78,9 @@ jobs: coveralls-finish: name: Finalize coveralls.io needs: [unit-tests] - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5 - run: pip install coveralls - run: coveralls --service=github --finish env: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8d7f392..ad81251 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ exclude: | ) repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 + rev: v5.0.0 hooks: - id: check-ast - id: trailing-whitespace @@ -46,7 +46,7 @@ repos: # - id: double-quote-string-fixer - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.8.0 + rev: v1.10.0 hooks: - id: python-check-blanket-noqa - id: python-check-mock-methods @@ -59,7 +59,7 @@ repos: - id: text-unicode-replacement-char - repo: https://github.com/PyCQA/isort - rev: 5.8.0 + rev: 6.0.1 hooks: - id: isort name: isort-source-code diff --git a/looptime/loops.py b/looptime/loops.py index 21d763d..fe4a6d2 100644 --- a/looptime/loops.py +++ b/looptime/loops.py @@ -96,7 +96,7 @@ def setup_looptime( def time(self) -> float: return self.__int2time(self.__now) - def run_in_executor(self, executor: Any, func: Any, *args: Any) -> AnyFuture: + def run_in_executor(self, executor: Any, func: Any, *args: Any) -> AnyFuture: # type: ignore future = super().run_in_executor(executor, func, *args) if isinstance(future, asyncio.Future): self.__sync_futures.add(future) diff --git a/looptime/math.py b/looptime/math.py index 40831ef..6ac3b13 100644 --- a/looptime/math.py +++ b/looptime/math.py @@ -1,6 +1,7 @@ from __future__ import annotations import abc +from typing import Any class Numeric(metaclass=abc.ABCMeta): @@ -108,5 +109,6 @@ def __mod__(self, other: object) -> float: else: return NotImplemented - def __pow__(self, power: float, modulo: None = None) -> float: + # See the StdLib's comments on pow() on why it is Any, not float. + def __pow__(self, power: float, modulo: None = None) -> Any: return pow(round(self._value * self.__rr), power, modulo) / pow(self.__rr, power, modulo) diff --git a/looptime/plugin.py b/looptime/plugin.py index e825340..6b6405a 100644 --- a/looptime/plugin.py +++ b/looptime/plugin.py @@ -8,7 +8,7 @@ from looptime import loops, patchers -@pytest.hookimpl(hookwrapper=True) # type: ignore +@pytest.hookimpl(hookwrapper=True) def pytest_fixture_setup(fixturedef: Any, request: Any) -> Any: if fixturedef.argname == "event_loop": result = yield diff --git a/requirements.txt b/requirements.txt index 8b2f6e4..ec4f742 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,10 +6,9 @@ codecov coverage coveralls isort -# Mypy requires typed-ast, which is broken on PyPy 3.7 (could work in PyPy 3.8). -mypy==0.920; implementation_name == "cpython" +mypy==1.16.0 pre-commit pytest -pytest-asyncio +pytest-asyncio<1.0.0 pytest-cov pytest-mock diff --git a/setup.py b/setup.py index c60e8a9..b459ccd 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ ] }, - python_requires='>=3.7', + python_requires='>=3.9', setup_requires=[ 'setuptools_scm', ],