Skip to content

Commit 067399d

Browse files
Add CI workflow (#1)
1 parent eb6fdf4 commit 067399d

2 files changed

Lines changed: 41 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
lint-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.12'
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install -r requirements-dev.txt
21+
- name: Run black
22+
run: black --check .
23+
- name: Run ruff
24+
run: ruff check .
25+
- name: Run mypy
26+
run: mypy --strict src.py
27+
- name: Run tests
28+
run: pytest --cov --cov-report=term-missing test.py

src.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,20 @@
1313
import sys
1414
import warnings
1515
from contextlib import contextmanager
16-
from functools import update_wrapper, wraps
16+
from functools import update_wrapper
1717
from importlib.metadata import PackageNotFoundError
1818
from importlib.metadata import version as _get_version
19-
from typing import Any, Callable, Dict, Generator, Optional, SupportsInt, Tuple, Union
19+
from typing import (
20+
Any,
21+
Callable,
22+
Dict,
23+
Generator,
24+
Optional,
25+
SupportsInt,
26+
Tuple,
27+
Union,
28+
cast,
29+
)
2030

2131

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

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

203213
def _matches_all_versions(
204214
self, package_versions: list[tuple[str, str, BinOp]]

0 commit comments

Comments
 (0)