Skip to content

Commit 3d77262

Browse files
authored
Merge pull request #367 from openedx/bmtcril/fix_build
build: Fix builds by updating action to use Python 3.11
2 parents 3c33877 + 2076fb1 commit 3d77262

6 files changed

Lines changed: 65 additions & 51 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ jobs:
1515
matrix:
1616
os: [ubuntu-latest]
1717
python-version: ["3.11", "3.12"]
18-
toxenv:
19-
[
20-
django42-drflatest,django52-drflatest,quality
21-
]
18+
toxenv: [django52-drflatest, quality]
2219

2320
steps:
2421
- uses: actions/checkout@v4

.github/workflows/pypi-publish.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ name: Publish package to PyPi
33
on:
44
push:
55
tags:
6-
- '*'
6+
- "*"
77

88
jobs:
9-
109
push:
1110
runs-on: ubuntu-latest
1211

@@ -16,7 +15,7 @@ jobs:
1615
- name: setup python
1716
uses: actions/setup-python@v5
1817
with:
19-
python-version: 3.8
18+
python-version: 3.11
2019

2120
- name: Install pip
2221
run: pip install -r requirements/pip.txt
@@ -32,4 +31,3 @@ jobs:
3231
with:
3332
user: __token__
3433
password: ${{ secrets.PYPI_UPLOAD_TOKEN }}
35-

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Change Log
1414
Unreleased
1515
----------
1616

17+
2.1.2 - 2026-01-39
18+
------------------
19+
* Fix builds to PyPI
20+
1721
2.1.1 - 2026-01-39
1822
------------------
1923
* Fix make upgrade, update dependencies

edx_api_doc_tools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@
4646
)
4747

4848

49-
__version__ = "2.1.1"
49+
__version__ = "2.1.2"

setup.py

Lines changed: 56 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ def get_version(*file_paths):
1919
Extract the version string from the file at the given relative path fragments.
2020
"""
2121
filename = os.path.join(os.path.dirname(__file__), *file_paths)
22-
version_file = open(filename, encoding='utf-8').read()
23-
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
24-
version_file, re.M)
22+
version_file = open(filename, encoding="utf-8").read()
23+
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
2524
if version_match:
2625
return version_match.group(1)
27-
raise RuntimeError('Unable to find version string.')
26+
raise RuntimeError("Unable to find version string.")
2827

2928

3029
def load_requirements(*requirements_paths):
@@ -49,14 +48,14 @@ def check_name_consistent(package):
4948
with extras we don't constrain it without mentioning the extras (since
5049
that too would interfere with matching constraints.)
5150
"""
52-
canonical = package.lower().replace('_', '-').split('[')[0]
51+
canonical = package.lower().replace("_", "-").split("[")[0]
5352
seen_spelling = by_canonical_name.get(canonical)
5453
if seen_spelling is None:
5554
by_canonical_name[canonical] = package
5655
elif seen_spelling != package:
5756
raise RuntimeError(
5857
f'Encountered both "{seen_spelling}" and "{package}" in requirements '
59-
'and constraints files; please use just one or the other.'
58+
"and constraints files; please use just one or the other."
6059
)
6160

6261
requirements = {}
@@ -70,7 +69,9 @@ def check_name_consistent(package):
7069
% (re_package_name_base_chars, re_package_name_base_chars)
7170
)
7271

73-
def add_version_constraint_or_raise(current_line, current_requirements, add_if_not_present):
72+
def add_version_constraint_or_raise(
73+
current_line, current_requirements, add_if_not_present
74+
):
7475
regex_match = requirement_line_regex.match(current_line)
7576
if regex_match:
7677
package = regex_match.group(1)
@@ -79,11 +80,16 @@ def add_version_constraint_or_raise(current_line, current_requirements, add_if_n
7980
existing_version_constraints = current_requirements.get(package, None)
8081
# It's fine to add constraints to an unconstrained package,
8182
# but raise an error if there are already constraints in place.
82-
if existing_version_constraints and existing_version_constraints != version_constraints:
83-
raise BaseException(f'Multiple constraint definitions found for {package}:'
84-
f' "{existing_version_constraints}" and "{version_constraints}".'
85-
f'Combine constraints into one location with {package}'
86-
f'{existing_version_constraints},{version_constraints}.')
83+
if (
84+
existing_version_constraints
85+
and existing_version_constraints != version_constraints
86+
):
87+
raise BaseException(
88+
f"Multiple constraint definitions found for {package}:"
89+
f' "{existing_version_constraints}" and "{version_constraints}".'
90+
f"Combine constraints into one location with {package}"
91+
f"{existing_version_constraints},{version_constraints}."
92+
)
8793
if add_if_not_present or package in current_requirements:
8894
current_requirements[package] = version_constraints
8995

@@ -94,8 +100,12 @@ def add_version_constraint_or_raise(current_line, current_requirements, add_if_n
94100
for line in reqs:
95101
if is_requirement(line):
96102
add_version_constraint_or_raise(line, requirements, True)
97-
if line and line.startswith('-c') and not line.startswith('-c http'):
98-
constraint_files.add(os.path.dirname(path) + '/' + line.split('#')[0].replace('-c', '').strip())
103+
if line and line.startswith("-c") and not line.startswith("-c http"):
104+
constraint_files.add(
105+
os.path.dirname(path)
106+
+ "/"
107+
+ line.split("#")[0].replace("-c", "").strip()
108+
)
99109

100110
# process constraint files: add constraints to existing requirements
101111
for constraint_file in constraint_files:
@@ -105,7 +115,9 @@ def add_version_constraint_or_raise(current_line, current_requirements, add_if_n
105115
add_version_constraint_or_raise(line, requirements, False)
106116

107117
# process back into list of pkg><=constraints strings
108-
constrained_requirements = [f'{pkg}{version or ""}' for (pkg, version) in sorted(requirements.items())]
118+
constrained_requirements = [
119+
f"{pkg}{version or ''}" for (pkg, version) in sorted(requirements.items())
120+
]
109121
return constrained_requirements
110122

111123

@@ -119,48 +131,53 @@ def is_requirement(line):
119131
"""
120132
# UPDATED VIA SEMGREP - if you need to remove/modify this method remove this line and add a comment specifying why
121133

122-
return line and line.strip() and not line.startswith(('-r', '#', '-e', 'git+', '-c'))
134+
return (
135+
line and line.strip() and not line.startswith(("-r", "#", "-e", "git+", "-c"))
136+
)
123137

124138

125-
VERSION = get_version('edx_api_doc_tools', '__init__.py')
139+
VERSION = get_version("edx_api_doc_tools", "__init__.py")
126140

127-
if sys.argv[-1] == 'tag':
141+
if sys.argv[-1] == "tag":
128142
print("Tagging the version on github:")
129143
os.system("git tag -a %s -m 'version %s'" % (VERSION, VERSION))
130144
os.system("git push --tags")
131145
sys.exit()
132146

133-
README = open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8').read()
134-
CHANGELOG = open(os.path.join(os.path.dirname(__file__), 'CHANGELOG.rst'), encoding='utf-8').read()
147+
README = open(
148+
os.path.join(os.path.dirname(__file__), "README.rst"), encoding="utf-8"
149+
).read()
150+
CHANGELOG = open(
151+
os.path.join(os.path.dirname(__file__), "CHANGELOG.rst"), encoding="utf-8"
152+
).read()
135153

136154
setup(
137-
name='edx-api-doc-tools',
155+
name="edx-api-doc-tools",
138156
version=VERSION,
139157
description="Tools for writing and generating API documentation for edX REST APIs",
140-
long_description=README + '\n\n' + CHANGELOG,
158+
long_description=README + "\n\n" + CHANGELOG,
141159
long_description_content_type="text/x-rst",
142-
author='Open edX Project',
143-
author_email='oscm@openedx.org',
144-
url='https://github.com/openedx/api-doc-tools',
160+
author="Open edX Project",
161+
author_email="oscm@openedx.org",
162+
url="https://github.com/openedx/api-doc-tools",
145163
packages=[
146-
'edx_api_doc_tools',
164+
"edx_api_doc_tools",
147165
],
148166
include_package_data=True,
149-
install_requires=load_requirements('requirements/base.in'),
167+
install_requires=load_requirements("requirements/base.in"),
150168
license="Apache Software License 2.0",
151169
zip_safe=False,
152-
keywords='Django edx',
170+
keywords="Django edx",
153171
classifiers=[
154-
'Development Status :: 3 - Alpha',
155-
'Framework :: Django',
156-
'Framework :: Django :: 4.2',
157-
'Framework :: Django :: 5.2',
158-
'Intended Audience :: Developers',
159-
'License :: OSI Approved :: Apache Software License',
160-
'Natural Language :: English',
161-
'Programming Language :: Python :: 3',
162-
'Programming Language :: Python :: 3.8',
163-
'Programming Language :: Python :: 3.11',
164-
'Programming Language :: Python :: 3.12',
172+
"Development Status :: 3 - Alpha",
173+
"Framework :: Django",
174+
"Framework :: Django :: 4.2",
175+
"Framework :: Django :: 5.2",
176+
"Intended Audience :: Developers",
177+
"License :: OSI Approved :: Apache Software License",
178+
"Natural Language :: English",
179+
"Programming Language :: Python :: 3",
180+
"Programming Language :: Python :: 3.11",
181+
"Programming Language :: Python :: 3.12",
165182
],
166183
)

tox.ini

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
envlist =
3-
py{38,311,312}-django{42,52}-drf{latest} # Django 4.2 is not supported by DRF < 3.14
3+
py{311,312}-django{52}-drf{latest}
44
quality
55

66
[pytest]
@@ -10,7 +10,6 @@ norecursedirs = .* docs requirements
1010

1111
[testenv]
1212
deps =
13-
django42: Django>=4.2,<4.3
1413
django52: Django>=5.2,<5.3
1514
drflatest: djangorestframework
1615
-r{toxinidir}/requirements/test.txt
@@ -40,4 +39,3 @@ deps =
4039
-r{toxinidir}/requirements/quality.txt
4140
commands =
4241
make quality
43-

0 commit comments

Comments
 (0)