edx-api-doc-tools 2.0.0__tar.gz → 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/CHANGELOG.rst +4 -0
  2. {edx_api_doc_tools-2.0.0/edx_api_doc_tools.egg-info → edx_api_doc_tools-2.1.0}/PKG-INFO +6 -1
  3. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/edx_api_doc_tools/__init__.py +1 -1
  4. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0/edx_api_doc_tools.egg-info}/PKG-INFO +6 -1
  5. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/setup.py +36 -6
  6. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/LICENSE.txt +0 -0
  7. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/MANIFEST.in +0 -0
  8. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/README.rst +0 -0
  9. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/edx_api_doc_tools/apps.py +0 -0
  10. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/edx_api_doc_tools/conf_utils.py +0 -0
  11. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/edx_api_doc_tools/data.py +0 -0
  12. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/edx_api_doc_tools/internal_utils.py +0 -0
  13. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/edx_api_doc_tools/urls.py +0 -0
  14. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/edx_api_doc_tools/view_utils.py +0 -0
  15. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/edx_api_doc_tools.egg-info/SOURCES.txt +0 -0
  16. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/edx_api_doc_tools.egg-info/dependency_links.txt +0 -0
  17. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/edx_api_doc_tools.egg-info/not-zip-safe +0 -0
  18. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/edx_api_doc_tools.egg-info/requires.txt +0 -0
  19. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/edx_api_doc_tools.egg-info/top_level.txt +0 -0
  20. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/requirements/base.in +0 -0
  21. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/requirements/constraints.txt +0 -0
  22. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/setup.cfg +0 -0
  23. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/tests/test_doc_tools.py +0 -0
  24. {edx_api_doc_tools-2.0.0 → edx_api_doc_tools-2.1.0}/tests/test_example.py +0 -0
@@ -14,6 +14,10 @@ Change Log
14
14
  Unreleased
15
15
  ----------
16
16
 
17
+ 2.1.0 - 2025-04-18
18
+ ---------------------
19
+ * Added Support for ``django 5.2``.
20
+
17
21
  2.0.0 --- 2024-09-09
18
22
  --------------------
19
23
  * Drop support for Python 3.8
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: edx-api-doc-tools
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Tools for writing and generating API documentation for edX REST APIs
5
5
  Home-page: https://github.com/openedx/api-doc-tools
6
6
  Author: Open edX Project
@@ -10,6 +10,7 @@ Keywords: Django edx
10
10
  Classifier: Development Status :: 3 - Alpha
11
11
  Classifier: Framework :: Django
12
12
  Classifier: Framework :: Django :: 4.2
13
+ Classifier: Framework :: Django :: 5.2
13
14
  Classifier: Intended Audience :: Developers
14
15
  Classifier: License :: OSI Approved :: Apache Software License
15
16
  Classifier: Natural Language :: English
@@ -139,6 +140,10 @@ Change Log
139
140
  Unreleased
140
141
  ----------
141
142
 
143
+ 2.1.0 - 2025-04-18
144
+ ---------------------
145
+ * Added Support for ``django 5.2``.
146
+
142
147
  2.0.0 --- 2024-09-09
143
148
  --------------------
144
149
  * Drop support for Python 3.8
@@ -46,4 +46,4 @@ from .view_utils import (
46
46
  )
47
47
 
48
48
 
49
- __version__ = '2.0.0'
49
+ __version__ = '2.1.0'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: edx-api-doc-tools
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Tools for writing and generating API documentation for edX REST APIs
5
5
  Home-page: https://github.com/openedx/api-doc-tools
6
6
  Author: Open edX Project
@@ -10,6 +10,7 @@ Keywords: Django edx
10
10
  Classifier: Development Status :: 3 - Alpha
11
11
  Classifier: Framework :: Django
12
12
  Classifier: Framework :: Django :: 4.2
13
+ Classifier: Framework :: Django :: 5.2
13
14
  Classifier: Intended Audience :: Developers
14
15
  Classifier: License :: OSI Approved :: Apache Software License
15
16
  Classifier: Natural Language :: English
@@ -139,6 +140,10 @@ Change Log
139
140
  Unreleased
140
141
  ----------
141
142
 
143
+ 2.1.0 - 2025-04-18
144
+ ---------------------
145
+ * Added Support for ``django 5.2``.
146
+
142
147
  2.0.0 --- 2024-09-09
143
148
  --------------------
144
149
  * Drop support for Python 3.8
@@ -37,20 +37,48 @@ def load_requirements(*requirements_paths):
37
37
  """
38
38
  # UPDATED VIA SEMGREP - if you need to remove/modify this method remove this line and add a comment specifying why.
39
39
 
40
+ # e.g. {"django": "Django", "confluent-kafka": "confluent_kafka[avro]"}
41
+ by_canonical_name = {}
42
+
43
+ def check_name_consistent(package):
44
+ """
45
+ Raise exception if package is named different ways.
46
+
47
+ This ensures that packages are named consistently so we can match
48
+ constraints to packages. It also ensures that if we require a package
49
+ with extras we don't constrain it without mentioning the extras (since
50
+ that too would interfere with matching constraints.)
51
+ """
52
+ canonical = package.lower().replace('_', '-').split('[')[0]
53
+ seen_spelling = by_canonical_name.get(canonical)
54
+ if seen_spelling is None:
55
+ by_canonical_name[canonical] = package
56
+ elif seen_spelling != package:
57
+ raise RuntimeError(
58
+ f'Encountered both "{seen_spelling}" and "{package}" in requirements '
59
+ 'and constraints files; please use just one or the other.'
60
+ )
61
+
40
62
  requirements = {}
41
63
  constraint_files = set()
42
64
 
43
- # groups "my-package-name<=x.y.z,..." into ("my-package-name", "<=x.y.z,...")
44
- requirement_line_regex = re.compile(r"([a-zA-Z0-9-_.]+)([<>=][^#\s]+)?")
65
+ # groups "pkg<=x.y.z,..." into ("pkg", "<=x.y.z,...")
66
+ re_package_name_base_chars = r"a-zA-Z0-9\-_." # chars allowed in base package name
67
+ # Two groups: name[maybe,extras], and optionally a constraint
68
+ requirement_line_regex = re.compile(
69
+ r"([%s]+(?:\[[%s,\s]+\])?)([<>=][^#\s]+)?"
70
+ % (re_package_name_base_chars, re_package_name_base_chars)
71
+ )
45
72
 
46
73
  def add_version_constraint_or_raise(current_line, current_requirements, add_if_not_present):
47
74
  regex_match = requirement_line_regex.match(current_line)
48
75
  if regex_match:
49
76
  package = regex_match.group(1)
50
77
  version_constraints = regex_match.group(2)
78
+ check_name_consistent(package)
51
79
  existing_version_constraints = current_requirements.get(package, None)
52
- # it's fine to add constraints to an unconstrained package, but raise an error if there are already
53
- # constraints in place
80
+ # It's fine to add constraints to an unconstrained package,
81
+ # but raise an error if there are already constraints in place.
54
82
  if existing_version_constraints and existing_version_constraints != version_constraints:
55
83
  raise BaseException(f'Multiple constraint definitions found for {package}:'
56
84
  f' "{existing_version_constraints}" and "{version_constraints}".'
@@ -59,7 +87,8 @@ def load_requirements(*requirements_paths):
59
87
  if add_if_not_present or package in current_requirements:
60
88
  current_requirements[package] = version_constraints
61
89
 
62
- # process .in files and store the path to any constraint files that are pulled in
90
+ # Read requirements from .in files and store the path to any
91
+ # constraint files that are pulled in.
63
92
  for path in requirements_paths:
64
93
  with open(path) as reqs:
65
94
  for line in reqs:
@@ -68,7 +97,7 @@ def load_requirements(*requirements_paths):
68
97
  if line and line.startswith('-c') and not line.startswith('-c http'):
69
98
  constraint_files.add(os.path.dirname(path) + '/' + line.split('#')[0].replace('-c', '').strip())
70
99
 
71
- # process constraint files and add any new constraints found to existing requirements
100
+ # process constraint files: add constraints to existing requirements
72
101
  for constraint_file in constraint_files:
73
102
  with open(constraint_file) as reader:
74
103
  for line in reader:
@@ -125,6 +154,7 @@ setup(
125
154
  'Development Status :: 3 - Alpha',
126
155
  'Framework :: Django',
127
156
  'Framework :: Django :: 4.2',
157
+ 'Framework :: Django :: 5.2',
128
158
  'Intended Audience :: Developers',
129
159
  'License :: OSI Approved :: Apache Software License',
130
160
  'Natural Language :: English',