Skip to content

Commit 273356e

Browse files
committed
fix github actions ci
1 parent 4777ea9 commit 273356e

9 files changed

Lines changed: 48 additions & 69 deletions

File tree

.github/workflows/actions.yaml

Lines changed: 8 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
test:
77
strategy:
88
matrix:
9-
os: [ ubuntu-latest, macos-latest ]
9+
os: [ ubuntu-latest, macos-latest, windows-latest ]
1010
python-version: ['3.10', '3.11', '3.12']
1111

1212
runs-on: ${{ matrix.os }}
@@ -28,63 +28,25 @@ jobs:
2828
run: uv sync --all-extras --dev
2929

3030
- name: Run style check
31-
run: uv run ruff format --check --diff $(package)
31+
run: uv run ruff format --check --diff extapi tests
3232

3333
- name: Run ruff
34-
run: uv run ruff check $(package)
34+
run: uv run ruff check extapi tests
3535

3636
- name: Run mypy
37-
run: uv run mypy --enable-error-code ignore-without-code $(package)
37+
run: uv run mypy --enable-error-code ignore-without-code extapi tests
3838

3939
- name: Run deptry
4040
run: uv run deptry . -e 'env|\.env|venv|\.venv|\..+'
4141

4242
- name: Run tests
4343
run: uv run pytest .
4444

45-
build-wheels:
46-
name: Build wheels on ${{ matrix.os }}
47-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
48-
runs-on: ${{ matrix.os }}
49-
strategy:
50-
matrix:
51-
os: [ ubuntu-latest, windows-latest, macos-latest ]
52-
needs:
53-
- test
54-
55-
steps:
56-
- uses: actions/checkout@v4
57-
with:
58-
submodules: recursive
59-
60-
- name: Install uv
61-
uses: astral-sh/setup-uv@v3
62-
63-
- uses: actions/setup-python@v5
64-
65-
- name: Install the project
66-
run: uv sync --all-extras --dev
67-
env:
68-
UV_SYSTEM_PYTHON: 1
69-
70-
- name: Install cibuildwheel
71-
run: pip install --upgrade cibuildwheel
72-
73-
- name: Build wheels
74-
run: python -m cibuildwheel --output-dir wheelhouse
75-
env:
76-
CIBW_BUILD: "cp310-* cp311-* cp312-*"
77-
78-
- uses: actions/upload-artifact@v4
79-
with:
80-
name: wheels-${{ matrix.os }}
81-
path: ./wheelhouse/*.whl
82-
8345
publish:
84-
name: Publish wheels
46+
name: Publish to PyPI
8547
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
8648
needs:
87-
- build-wheels
49+
- test
8850
runs-on: ubuntu-latest
8951
steps:
9052
- name: Get tag
@@ -106,26 +68,11 @@ jobs:
10668
run: |
10769
python -m pip install --upgrade pip setuptools wheel twine build
10870
109-
- uses: actions/download-artifact@v4
110-
with:
111-
name: wheels-ubuntu-latest
112-
path: wheels-ubuntu
113-
114-
- uses: actions/download-artifact@v4
115-
with:
116-
name: wheels-macos-latest
117-
path: wheels-macos
118-
119-
- uses: actions/download-artifact@v4
120-
with:
121-
name: wheels-windows-latest
122-
path: wheels-windows
123-
12471
- name: Publish dist
12572
run: |
12673
python -m build . -s
127-
tree dist wheels-ubuntu wheels-macos wheels-windows
128-
twine upload dist/* wheels-ubuntu/*.whl wheels-macos/*.whl wheels-windows/*.whl
74+
tree dist
75+
twine upload dist/*
12976
env:
13077
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
13178
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
@@ -136,7 +83,4 @@ jobs:
13683
prerelease: false
13784
title: ${{ steps.get_tag.outputs.TAG }}
13885
files: |
139-
wheels-ubuntu/*.whl
140-
wheels-macos/*.whl
141-
wheels-windows/*.whl
14286
dist/*

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 0.1.6
2+
* moved to github
3+
14
# 0.1.5
25
* removed unnecessary `asyncio.sleep` after the last retry in `RetryableExecutor.execute`
36

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# extapi
22

3+
[![Build](https://github.com/ktsstudio/extapi/actions/workflows/actions.yaml/badge.svg?branch=main)](https://github.com/ktsstudio/extapi/actions)
4+
[![PyPI](https://img.shields.io/pypi/v/extapi.svg)](https://pypi.python.org/pypi/extapi)
5+
36
Library for performing HTTP calls to external systems. Made to be modular, extensible and easy to use.
47

58
## Installation

extapi/_meta.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import importlib.util
2+
import sys
23

4+
PY311 = sys.version_info >= (3, 11)
35
has_open_telemetry = importlib.util.find_spec("opentelemetry") is not None
46
has_prometheus = importlib.util.find_spec("prometheus_client") is not None

extapi/http/abc.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import abc
22
from collections.abc import Mapping
3-
from typing import Any, Generic, Protocol, Self, TypeVar, runtime_checkable
3+
from typing import Any, Generic, Protocol, TypeVar, runtime_checkable
44

55
from multidict import CIMultiDict
66
from yarl import URL
77

8+
from extapi._meta import PY311
9+
810
from .types import RequestData, Response, StrOrURL
911

12+
if PY311:
13+
from typing import Self # type: ignore[attr-defined]
14+
else:
15+
from typing_extensions import Self
16+
1017
T_co = TypeVar("T_co", covariant=True)
1118
T_contr = TypeVar("T_contr", contravariant=True)
1219
T = TypeVar("T")

extapi/http/types.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,20 @@
66
Generic,
77
Literal,
88
Protocol,
9-
Self,
109
TypeVar,
1110
runtime_checkable,
1211
)
1312

1413
from multidict import CIMultiDict
1514
from yarl import URL
1615

16+
from extapi._meta import PY311
17+
18+
if PY311:
19+
from typing import Self # type: ignore[attr-defined]
20+
else:
21+
from typing_extensions import Self
22+
1723
HttpMethod = Literal["GET", "POST", "PUT", "PATCH", "DELETE"] | str
1824
StrOrURL = str | URL
1925

extapi/limiters/concurrency/abc.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import abc
2-
from typing import Protocol, Self
2+
from typing import Protocol
3+
4+
from extapi._meta import PY311
5+
6+
if PY311:
7+
from typing import Self # type: ignore[attr-defined]
8+
else:
9+
from typing_extensions import Self
310

411

512
class AbstractSemaphore(metaclass=abc.ABCMeta):

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "extapi"
3-
version = "0.1.5"
3+
version = "0.1.6b1"
44
description = "External API library"
55
authors = [
66
{ name = "KTS", email = "hello@kts.tech" }
@@ -25,6 +25,7 @@ readme = "README.md"
2525
dependencies = [
2626
"multidict",
2727
"yarl",
28+
"typing-extensions; python_version < '3.11'",
2829
]
2930

3031
[project.optional-dependencies]

tests/exthttp/test_abstract.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
from typing import Any, assert_type
1+
from typing import Any
22

33
import pytest
44
from multidict import CIMultiDict
55

6+
from extapi._meta import PY311
67
from extapi.http.abc import AbstractExecutor, Addon
78
from extapi.http.types import RequestData, Response
89

10+
if PY311:
11+
from typing import assert_type # type: ignore[attr-defined]
12+
else:
13+
from typing_extensions import assert_type
14+
915

1016
class TestAbstractExecutor:
1117
@pytest.mark.parametrize("method", ["get", "post", "put", "patch", "delete"])

0 commit comments

Comments
 (0)