Skip to content
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
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
push:
branches:
- main
pull_request:

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Run black
run: black --check .
- name: Run ruff
run: ruff check .
- name: Run mypy
run: mypy --strict src.py
- name: Run tests
run: pytest --cov --cov-report=term-missing test.py
16 changes: 13 additions & 3 deletions src.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,20 @@
import sys
import warnings
from contextlib import contextmanager
from functools import update_wrapper, wraps
from functools import update_wrapper
from importlib.metadata import PackageNotFoundError
from importlib.metadata import version as _get_version
from typing import Any, Callable, Dict, Generator, Optional, SupportsInt, Tuple, Union
from typing import (
Any,
Callable,
Dict,
Generator,
Optional,
SupportsInt,
Tuple,
Union,
cast,
)


__all__ = ["versiondispatch"]
Expand Down Expand Up @@ -198,7 +208,7 @@ def __init__(self, func: AnyFunc) -> None:

# this looks kinda strange but makes it so that the docstring of the
# original function is conserved
self = wraps(self._impl)(self)
update_wrapper(cast(Callable[..., Any], self), self._impl)

def _matches_all_versions(
self, package_versions: list[tuple[str, str, BinOp]]
Expand Down