Skip to content

Commit a1c73ce

Browse files
committed
build: Update to latest profile template
1 parent 987f40e commit a1c73ce

File tree

8 files changed

+94
-69
lines changed

8 files changed

+94
-69
lines changed

.github/workflows/lint.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,27 @@ jobs:
66
build:
77
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
88
runs-on: ubuntu-latest
9+
env:
10+
PAT: ${{ secrets.PAT }}
911
steps:
1012
- uses: actions/checkout@v4
13+
with:
14+
token: ${{ secrets.PAT || github.token }}
1115
- uses: actions/setup-python@v5
1216
with:
1317
python-version: '3.10'
1418
cache: pip
1519
cache-dependency-path: '**/requirements*.txt'
20+
- id: changed-files
21+
uses: tj-actions/changed-files@v45
22+
- uses: pre-commit/action@v3.0.1
23+
continue-on-error: true
24+
with:
25+
extra_args: pip-compile --files ${{ steps.changed-files.outputs.all_changed_files }}
26+
- if: ${{ env.PAT }}
27+
uses: stefanzweifel/git-auto-commit-action@v5
28+
with:
29+
commit_message: '[github-actions] pre-commit autoupdate'
1630
- shell: bash
1731
run: curl -s -S --retry 3 $BASEDIR/tests/install.sh | bash -
1832
- shell: bash

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
ci:
2+
autoupdate_schedule: quarterly
3+
skip: [pip-compile]
4+
default_language_version:
5+
python: python3.10
6+
repos:
7+
- repo: https://github.com/astral-sh/ruff-pre-commit
8+
rev: v0.6.9
9+
hooks:
10+
- id: ruff
11+
- id: ruff-format
12+
- repo: https://github.com/astral-sh/uv-pre-commit
13+
rev: 0.4.18
14+
hooks:
15+
- id: pip-compile
16+
name: pip-compile common-requirements.in
17+
args: [common-requirements.in, -o, common-requirements.txt]
18+
files: ^common-requirements\.(in|txt)$

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10

common-requirements.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ linkify-it-py
22
myst-parser
33
ocds-babel
44
Sphinx
5-
-e git+https://github.com/open-contracting/standard_theme.git@open_contracting#egg=standard_theme
5+
git+https://github.com/open-contracting/standard_theme.git@open_contracting#egg=standard_theme
66

77
# Profile
88
ocdsextensionregistry
@@ -19,5 +19,4 @@ selenium
1919

2020
# Development
2121
click
22-
pip-tools
2322
sphinx-autobuild

common-requirements.txt

Lines changed: 40 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
#
2-
# This file is autogenerated by pip-compile with Python 3.10
3-
# by the following command:
4-
#
5-
# pip-compile common-requirements.in
6-
#
7-
-e git+https://github.com/open-contracting/standard_theme.git@open_contracting#egg=standard_theme
8-
# via -r common-requirements.in
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile common-requirements.in -o common-requirements.txt
93
alabaster==0.7.12
104
# via sphinx
5+
anyio==4.4.0
6+
# via
7+
# starlette
8+
# watchfiles
119
async-generator==1.10
1210
# via
1311
# trio
@@ -23,11 +21,9 @@ babel==2.9.1
2321
# via
2422
# sphinx
2523
# sphinx-intl
26-
build==0.10.0
27-
# via pip-tools
2824
cattrs==23.1.2
2925
# via requests-cache
30-
certifi==2023.7.22
26+
certifi==2024.7.4
3127
# via
3228
# elastic-transport
3329
# requests
@@ -38,26 +34,30 @@ click==8.1.3
3834
# via
3935
# -r common-requirements.in
4036
# ocdsindex
41-
# pip-tools
4237
# sphinx-intl
43-
colorama==0.4.4
38+
# uvicorn
39+
colorama==0.4.6
4440
# via sphinx-autobuild
4541
docutils==0.18
4642
# via
4743
# myst-parser
4844
# sphinx
4945
elastic-transport==8.4.0
5046
# via elasticsearch
51-
elasticsearch[requests]==8.6.2
47+
elasticsearch==8.6.2
5248
# via ocdsindex
53-
exceptiongroup==1.0.0
49+
exceptiongroup==1.2.2
5450
# via
51+
# anyio
5552
# cattrs
5653
# pytest
5754
h11==0.13.0
58-
# via wsproto
55+
# via
56+
# uvicorn
57+
# wsproto
5958
idna==3.7
6059
# via
60+
# anyio
6161
# requests
6262
# trio
6363
imagesize==1.4.1
@@ -74,8 +74,6 @@ jsonref==1.0.0.post1
7474
# via ocdsextensionregistry
7575
linkify-it-py==1.0.1
7676
# via -r common-requirements.in
77-
livereload==2.6.3
78-
# via sphinx-autobuild
7977
lxml==4.9.1
8078
# via ocdsindex
8179
markdown-it-py==2.2.0
@@ -90,31 +88,24 @@ mdurl==0.1.2
9088
# via markdown-it-py
9189
myst-parser==0.18.1
9290
# via -r common-requirements.in
93-
ocds-babel==0.3.1
91+
ocds-babel==0.3.6
9492
# via -r common-requirements.in
95-
ocdsextensionregistry==0.3.8
93+
ocdsextensionregistry==0.5.0
9694
# via -r common-requirements.in
9795
ocdsindex==0.2.0
9896
# via -r common-requirements.in
9997
outcome==1.1.0
10098
# via trio
101-
packaging==21.3
99+
packaging==24.1
102100
# via
103-
# build
104101
# pytest
105102
# sphinx
106-
pip-tools==7.3.0
107-
# via -r common-requirements.in
108103
platformdirs==3.9.1
109104
# via requests-cache
110105
pluggy==0.13.1
111106
# via pytest
112107
pygments==2.15.1
113108
# via sphinx
114-
pyparsing==2.4.7
115-
# via packaging
116-
pyproject-hooks==1.0.0
117-
# via build
118109
pysocks==1.7.1
119110
# via urllib3
120111
pytest==7.2.0
@@ -133,12 +124,14 @@ requests-cache==1.1.0
133124
# via ocdsextensionregistry
134125
selenium==4.11.2
135126
# via -r common-requirements.in
127+
setuptools==75.2.0
128+
# via sphinx-intl
136129
six==1.16.0
137-
# via
138-
# livereload
139-
# url-normalize
130+
# via url-normalize
140131
sniffio==1.2.0
141-
# via trio
132+
# via
133+
# anyio
134+
# trio
142135
snowballstemmer==2.1.0
143136
# via sphinx
144137
sortedcontainers==2.4.0
@@ -149,7 +142,7 @@ sphinx==5.3.0
149142
# myst-parser
150143
# sphinx-autobuild
151144
# sphinx-intl
152-
sphinx-autobuild==2021.3.14
145+
sphinx-autobuild==2024.9.3
153146
# via -r common-requirements.in
154147
sphinx-intl==2.2.0
155148
# via -r common-requirements.in
@@ -165,14 +158,12 @@ sphinxcontrib-qthelp==1.0.3
165158
# via sphinx
166159
sphinxcontrib-serializinghtml==1.1.5
167160
# via sphinx
161+
standard-theme @ git+https://github.com/open-contracting/standard_theme.git@07ca0e39979a244656dd6df0658f2ead428184b9#egg=standard_theme
162+
# via -r common-requirements.in
163+
starlette==0.40.0
164+
# via sphinx-autobuild
168165
tomli==2.0.1
169-
# via
170-
# build
171-
# pip-tools
172-
# pyproject-hooks
173-
# pytest
174-
tornado==6.4.1
175-
# via livereload
166+
# via pytest
176167
trio==0.20.0
177168
# via
178169
# selenium
@@ -181,23 +172,25 @@ trio-websocket==0.9.2
181172
# via selenium
182173
typing-extensions==4.4.0
183174
# via
175+
# anyio
184176
# cattrs
185177
# myst-parser
178+
# uvicorn
186179
uc-micro-py==1.0.1
187180
# via linkify-it-py
188181
url-normalize==1.4.3
189182
# via requests-cache
190-
urllib3[socks]==1.26.18
183+
urllib3==1.26.19
191184
# via
192185
# elastic-transport
193186
# requests
194187
# requests-cache
195188
# selenium
196-
wheel==0.38.4
197-
# via pip-tools
189+
uvicorn==0.30.6
190+
# via sphinx-autobuild
191+
watchfiles==0.24.0
192+
# via sphinx-autobuild
193+
websockets==13.0.1
194+
# via sphinx-autobuild
198195
wsproto==1.1.0
199196
# via trio-websocket
200-
201-
# The following packages are considered to be unsafe in a requirements file:
202-
# pip
203-
# setuptools

script/update

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -eu
55
main() {
66
mkdir -p script include tests
77

8-
for f in Makefile common-requirements.in common-requirements.txt .github/dependabot.yml .github/workflows/lint.yml .github/workflows/shell.yml docs/_static/favicon-16x16.ico include/common.mk include/prologue.mk include/header.html script/diff script/update tests/conftest.py tests/test_common.py; do
8+
for f in .pre-commit-config.yaml .python-version Makefile common-requirements.in common-requirements.txt pyproject.toml .github/dependabot.yml .github/workflows/lint.yml .github/workflows/shell.yml docs/_static/favicon-16x16.ico include/common.mk include/prologue.mk include/header.html script/diff script/update tests/conftest.py tests/test_common.py; do
99
curl -sS -o $f https://raw.githubusercontent.com/open-contracting/standard_profile_template/latest/$f
1010
done
1111

tests/conftest.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
from selenium.webdriver.chrome.options import Options
88

99

10-
@pytest.fixture(scope='module')
10+
@pytest.fixture(scope="module")
1111
def browser(request):
1212
options = Options()
13-
options.add_argument('--headless')
14-
options.add_argument('--no-sandbox')
13+
options.add_argument("--headless")
14+
options.add_argument("--no-sandbox")
1515

1616
browser = webdriver.Chrome(options=options)
1717
browser.implicitly_wait(3)
@@ -21,17 +21,17 @@ def browser(request):
2121
browser.quit()
2222

2323

24-
@pytest.fixture(scope='module')
24+
@pytest.fixture(scope="module")
2525
def server(request):
26-
host = 'localhost'
26+
host = "localhost"
2727
port_number = 8331
2828

29-
server = HTTPServer((host, port_number), partial(SimpleHTTPRequestHandler, directory='build'))
29+
server = HTTPServer((host, port_number), partial(SimpleHTTPRequestHandler, directory="build"))
3030

3131
thread = threading.Thread(target=server.serve_forever)
3232
thread.start()
3333

34-
yield f'http://{host}:{port_number}/'
34+
yield f"http://{host}:{port_number}/"
3535

3636
server.shutdown()
3737
thread.join()

tests/test_common.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,31 @@
88
from tests import languages, test_basic_params, test_search_params
99

1010

11-
@pytest.mark.parametrize(('lang', 'text'), test_basic_params.items())
11+
@pytest.mark.parametrize(("lang", "text"), test_basic_params.items())
1212
def test_basic(browser, server, lang, text):
13-
browser.get(f'{server}{lang}')
14-
assert text in browser.find_element(By.TAG_NAME, 'body').text
13+
browser.get(f"{server}{lang}")
14+
assert text in browser.find_element(By.TAG_NAME, "body").text
1515

1616

17-
@pytest.mark.parametrize(('lang', 'regex'), test_search_params)
17+
@pytest.mark.parametrize(("lang", "regex"), test_search_params)
1818
def test_search(browser, server, lang, regex):
19-
browser.get(f'{server}{lang}')
20-
search_box = browser.find_element(By.ID, 'rtd-search-form').find_element(By.TAG_NAME, 'input')
21-
search_box.send_keys('tender\n')
19+
browser.get(f"{server}{lang}")
20+
search_box = browser.find_element(By.ID, "rtd-search-form").find_element(By.TAG_NAME, "input")
21+
search_box.send_keys("tender\n")
2222
time.sleep(3)
23-
assert re.search(regex, browser.find_element(By.TAG_NAME, 'body').text)
23+
assert re.search(regex, browser.find_element(By.TAG_NAME, "body").text)
2424

2525

2626
# This seems to be an issue in Selenium and/or ChromeDriver.
2727
@pytest.mark.filterwarnings("ignore:unclosed <socket.socket fd=:ResourceWarning")
2828
def test_language_switcher(browser, server):
29-
if 'localhost' in server:
29+
if "localhost" in server:
3030
pytest.skip()
3131

32-
browser.get(f'{server}en/')
32+
browser.get(f"{server}en/")
3333

3434
for lang, lang_name in languages.items():
3535
select = Select(browser.find_element(By.XPATH, "//select[@name='lang']"))
3636
select.select_by_visible_text(lang_name)
37-
assert browser.current_url == f'{server}{lang}/'
38-
assert test_basic_params[lang] in browser.find_element(By.TAG_NAME, 'body').text
37+
assert browser.current_url == f"{server}{lang}/"
38+
assert test_basic_params[lang] in browser.find_element(By.TAG_NAME, "body").text

0 commit comments

Comments
 (0)