Skip to content

Commit fdc8e53

Browse files
Merge pull request #72 from PagerDuty/issue-71-linter-formatter
feat(71): Add a standard chosen linter/formatter, format and fix linter errors
2 parents e38937a + 4c8cb77 commit fdc8e53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+7319
-3112
lines changed

.circleci/config.yml

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,56 @@
11
version: 2.1
22

33
test: &test
4-
name: Setup Virtualenv, install dependencies and test
4+
name: Run tests
55
command: |
6-
virtualenv .python
7-
. .python/bin/activate
8-
which python
9-
python -V
10-
which pip
11-
pip -V
126
./test.sh
137
8+
uv: &uv
9+
name: Install uv
10+
command: |
11+
curl -LsSf https://astral.sh/uv/install.sh | sh
12+
13+
ruff: &ruff
14+
name: Install ruff for linting and formatting
15+
command: |
16+
uv tool install ruff@latest
17+
1418
jobs:
1519

20+
lint:
21+
docker:
22+
- image: cimg/python:3.13
23+
steps:
24+
- checkout
25+
- run:
26+
<<: *uv
27+
- run:
28+
<<: *ruff
29+
- run:
30+
command: |
31+
uvx ruff check
32+
33+
format:
34+
docker:
35+
- image: cimg/python:3.13
36+
steps:
37+
- checkout
38+
- run:
39+
<<: *uv
40+
- run:
41+
<<: *ruff
42+
- run:
43+
command: |
44+
uvx ruff format --check
45+
1646
py3_6:
1747
docker:
1848
- image: cimg/python:3.6
1949
steps:
2050
- checkout
2151
- run:
52+
environment:
53+
NO_UV: 1
2254
<<: *test
2355

2456
py3_7:
@@ -27,13 +59,17 @@ jobs:
2759
steps:
2860
- checkout
2961
- run:
62+
environment:
63+
NO_UV: 1
3064
<<: *test
3165

3266
py3_8:
3367
docker:
3468
- image: cimg/python:3.8
3569
steps:
3670
- checkout
71+
- run:
72+
<<: *uv
3773
- run:
3874
<<: *test
3975

@@ -42,6 +78,8 @@ jobs:
4278
- image: cimg/python:3.9
4379
steps:
4480
- checkout
81+
- run:
82+
<<: *uv
4583
- run:
4684
<<: *test
4785

@@ -50,6 +88,8 @@ jobs:
5088
- image: cimg/python:3.10
5189
steps:
5290
- checkout
91+
- run:
92+
<<: *uv
5393
- run:
5494
<<: *test
5595

@@ -58,6 +98,8 @@ jobs:
5898
- image: cimg/python:3.11
5999
steps:
60100
- checkout
101+
- run:
102+
<<: *uv
61103
- run:
62104
<<: *test
63105

@@ -66,6 +108,8 @@ jobs:
66108
- image: cimg/python:3.12
67109
steps:
68110
- checkout
111+
- run:
112+
<<: *uv
69113
- run:
70114
<<: *test
71115

@@ -74,6 +118,8 @@ jobs:
74118
- image: cimg/python:3.13
75119
steps:
76120
- checkout
121+
- run:
122+
<<: *uv
77123
- run:
78124
<<: *test
79125

@@ -89,4 +135,6 @@ workflows:
89135
- py3_11
90136
- py3_12
91137
- py3_13
138+
- lint
139+
- format
92140

CHANGELOG.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
**2025-11-19: 6.1.0: Add uv and ruff and fix errors and formatting**
2+
3+
This release adopts `uv <https://docs.astral.sh/uv/>`_ as the project's chosen package manager and build tool, and `ruff <https://docs.astral.sh/ruff/>`_ as its chosen linter and formatter.
4+
5+
* **Fixes:**
6+
* Resolve ``NameError`` in the following methods:
7+
* ``RestApiV2Client.api_key_access``
8+
* ``RestApiV2Client.iter_history``
9+
* ``RestApiV2Client.account_has_ability``
10+
* **Features:**
11+
* Revise the exception message for status 401 Unauthorized to include a suggestion that the service region / base URL are wrong; this is in some use cases the most common reason for the error.
12+
* Rewrite the end-to-end package publish testing script to use uv, and perform deeper inspection of the resulting installed package.
13+
* New-and-improved development workflow using ``uv`` and ``ruff``
14+
115
**2025-10-24: 6.0.0: Change base HTTP client to python-httpx**
216

317
The underlying HTTP client on which this library is based has been changed to `python-httpx <https://www.python-httpx.org>`_. The primary motivation of this change is to provide thread safety with a very similar interface to ``requests``, and the possibility to add support for asynchronous usage in future releases.

Makefile

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
%: build
22

3-
build: pagerduty/* pyproject.toml
4-
rm -f dist/* && python3 -m build
3+
build: uv.lock pagerduty/* pyproject.toml
4+
rm -f dist/* && uv build
55

66
docs/index.html: build pyproject.toml pagerduty/* CHANGELOG.rst sphinx/source/*
7-
rm -fr ./docs && cd sphinx && make html && cd .. && mv sphinx/build/html ./docs && touch ./docs/.nojekyll
7+
rm -fr ./docs && cd sphinx && uv run make html && cd .. && mv sphinx/build/html ./docs && touch ./docs/.nojekyll
88

9-
docs: docs/index.html pagerduty/__pycache__
10-
11-
# Require the module be compiled first so metadata can be used:
12-
pagerduty/__pycache__:
13-
pip install .
9+
docs: docs/index.html build
1410

1511
testpublish: build
16-
./publish-test.sh
12+
./test/publish-test.sh
1713

1814
publish: build
19-
twine upload dist/*.tar.gz dist/*.whl
15+
uv publish --username __token__
16+
17+
uv.lock: pyproject.toml
18+
uv sync

docs/changelog.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,34 @@
7676

7777
<section id="changelog">
7878
<h1>Changelog<a class="headerlink" href="#changelog" title="Link to this heading"></a></h1>
79+
<p><strong>2025-11-19: 6.1.0: Add uv and ruff and fix errors and formatting</strong></p>
80+
<p>This release adopts <a class="reference external" href="https://docs.astral.sh/uv/">uv</a> as the project’s chosen package manager and build tool, and <a class="reference external" href="https://docs.astral.sh/ruff/">ruff</a> as its chosen linter and formatter.</p>
81+
<ul class="simple">
82+
<li><dl class="simple">
83+
<dt><strong>Fixes:</strong></dt><dd><ul>
84+
<li><dl class="simple">
85+
<dt>Resolve <code class="docutils literal notranslate"><span class="pre">NameError</span></code> in the following methods:</dt><dd><ul>
86+
<li><p><code class="docutils literal notranslate"><span class="pre">RestApiV2Client.api_key_access</span></code></p></li>
87+
<li><p><code class="docutils literal notranslate"><span class="pre">RestApiV2Client.iter_history</span></code></p></li>
88+
<li><p><code class="docutils literal notranslate"><span class="pre">RestApiV2Client.account_has_ability</span></code></p></li>
89+
</ul>
90+
</dd>
91+
</dl>
92+
</li>
93+
</ul>
94+
</dd>
95+
</dl>
96+
</li>
97+
<li><dl class="simple">
98+
<dt><strong>Features:</strong></dt><dd><ul>
99+
<li><p>Revise the exception message for status 401 Unauthorized to include a suggestion that the service region / base URL are wrong; this is in some use cases the most common reason for the error.</p></li>
100+
<li><p>Rewrite the end-to-end package publish testing script to use uv, and perform deeper inspection of the resulting installed package.</p></li>
101+
<li><p>New-and-improved development workflow using <code class="docutils literal notranslate"><span class="pre">uv</span></code> and <code class="docutils literal notranslate"><span class="pre">ruff</span></code></p></li>
102+
</ul>
103+
</dd>
104+
</dl>
105+
</li>
106+
</ul>
79107
<p><strong>2025-10-24: 6.0.0: Change base HTTP client to python-httpx</strong></p>
80108
<p>The underlying HTTP client on which this library is based has been changed to <a class="reference external" href="https://www.python-httpx.org">python-httpx</a>. The primary motivation of this change is to provide thread safety with a very similar interface to <code class="docutils literal notranslate"><span class="pre">requests</span></code>, and the possibility to add support for asynchronous usage in future releases.</p>
81109
<ul class="simple">

0 commit comments

Comments
 (0)