Skip to content

Commit cc4ad71

Browse files
author
FaydSpeare
committed
pre-commit ruff
1 parent 4628985 commit cc4ad71

File tree

7 files changed

+55
-42
lines changed

7 files changed

+55
-42
lines changed

.github/workflows/release.yml

+38-37
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,38 @@ name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
22

33
on: push
44
jobs:
5+
56
build:
67
name: Build distribution 📦
78
runs-on: ubuntu-latest
89

910
steps:
10-
- uses: actions/checkout@v4
11-
- name: Set up Python
12-
uses: actions/setup-python@v5
13-
with:
14-
python-version: "3.x"
11+
- uses: actions/checkout@v4
12+
- name: Set up Python
13+
uses: actions/setup-python@v5
14+
with:
15+
python-version: "3.x"
1516

16-
- name: Install pypa/build
17-
run: >-
18-
python3 -m
19-
pip install
20-
build
21-
--user
17+
- name: Install pypa/build
18+
run: >-
19+
python3 -m
20+
pip install
21+
build
22+
--user
2223
23-
- name: Build a binary wheel and a source tarball
24-
run: python3 -m build
24+
- name: Build a binary wheel and a source tarball
25+
run: python3 -m build
2526

26-
- name: Store the distribution packages
27-
uses: actions/upload-artifact@v3
28-
with:
29-
name: python-package-distributions
30-
path: dist/
27+
- name: Store the distribution packages
28+
uses: actions/upload-artifact@v3
29+
with:
30+
name: python-package-distributions
31+
path: dist/
3132

3233
publish-to-testpypi:
3334
name: Publish Python 🐍 distribution 📦 to TestPyPI
3435
needs:
35-
- build
36+
- build
3637
runs-on: ubuntu-latest
3738

3839
environment:
@@ -43,34 +44,34 @@ jobs:
4344
id-token: write # IMPORTANT: mandatory for trusted publishing
4445

4546
steps:
46-
- name: Download all the dists
47-
uses: actions/download-artifact@v3
48-
with:
49-
name: python-package-distributions
50-
path: dist/
51-
- name: Publish distribution 📦 to TestPyPI
52-
uses: pypa/gh-action-pypi-publish@release/v1
53-
with:
54-
repository-url: https://test.pypi.org/legacy/
55-
skip-existing: true
47+
- name: Download all the dists
48+
uses: actions/download-artifact@v3
49+
with:
50+
name: python-package-distributions
51+
path: dist/
52+
- name: Publish distribution 📦 to TestPyPI
53+
uses: pypa/gh-action-pypi-publish@release/v1
54+
with:
55+
repository-url: https://test.pypi.org/legacy/
56+
skip-existing: true
5657

5758
publish-to-pypi:
5859
name: >-
5960
Publish Python 🐍 distribution 📦 to PyPI
6061
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
6162
needs:
62-
- build
63+
- build
6364
runs-on: ubuntu-latest
6465
environment:
6566
name: pypi
6667
url: https://pypi.org/p/ensembledata
6768
permissions:
6869
id-token: write # IMPORTANT: mandatory for trusted publishing
6970
steps:
70-
- name: Download all the dists
71-
uses: actions/download-artifact@v3
72-
with:
73-
name: python-package-distributions
74-
path: dist/
75-
- name: Publish distribution 📦 to PyPI
76-
uses: pypa/gh-action-pypi-publish@release/v1
71+
- name: Download all the dists
72+
uses: actions/download-artifact@v3
73+
with:
74+
name: python-package-distributions
75+
path: dist/
76+
- name: Publish distribution 📦 to PyPI
77+
uses: pypa/gh-action-pypi-publish@release/v1

.pre-commit-config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.5.7
4+
hooks:
5+
- id: ruff
6+
# - id: ruff-format

ensembledata/api/_requester.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import httpx
88

99
from ._response import EDResponse
10-
from .errors import EDError
1110
from ._version import version
11+
from .errors import EDError
1212

1313
BASE_URL = "https://ensembledata.com/apis"
1414
USER_AGENT = f"ensembledata-python/{version}"

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ Homepage = "https://ensembledata.com"
4747
Documenation = "https://ensembledata.com/apis/docs"
4848
Repository = "https://github.com/ensembledata/ensembledata-python"
4949

50+
[tool.mypy]
51+
strict = true
52+
5053
[tool.ruff]
5154
target-version = "py37"
5255
line-length = 100

requirements.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
ruff==0.5.6
1+
ruff==0.5.7
22
mypy==1.11.1
33
pytest==7.4.4
4-
pytest-asyncio=0.21.2
4+
pytest-asyncio=0.21.2
5+
pre-commit==2.21.0

tests/__init__.py

Whitespace-only changes.

tests/test_clients.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3-
from ensembledata.api import EDClient, EDAsyncClient, EDError, errors
3+
from ensembledata.api import EDAsyncClient, EDClient, EDError, errors
4+
45

56
def test_client():
67
client = EDClient("xxx")
8+
79
with pytest.raises(EDError) as e:
810
client.customer.get_usage("2024-01-01")
911

@@ -17,4 +19,4 @@ async def test_async_client():
1719
with pytest.raises(EDError) as e:
1820
await client.customer.get_usage("2024-01-01")
1921

20-
assert e.value.status_code == errors.STATUS_491_INVALID_TOKEN
22+
assert e.value.status_code == errors.STATUS_491_INVALID_TOKEN

0 commit comments

Comments
 (0)