edx-enterprise-subsidy-client 2.0.1__tar.gz → 2.0.3__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 (19) hide show
  1. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/CHANGELOG.rst +8 -0
  2. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/PKG-INFO +9 -1
  3. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/edx_enterprise_subsidy_client/__init__.py +1 -1
  4. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/edx_enterprise_subsidy_client.egg-info/PKG-INFO +9 -1
  5. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/setup.py +38 -6
  6. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/LICENSE +0 -0
  7. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/LICENSE.txt +0 -0
  8. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/MANIFEST.in +0 -0
  9. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/README.rst +0 -0
  10. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/edx_enterprise_subsidy_client/client.py +0 -0
  11. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/edx_enterprise_subsidy_client.egg-info/SOURCES.txt +0 -0
  12. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/edx_enterprise_subsidy_client.egg-info/dependency_links.txt +0 -0
  13. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/edx_enterprise_subsidy_client.egg-info/not-zip-safe +0 -0
  14. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/edx_enterprise_subsidy_client.egg-info/requires.txt +0 -0
  15. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/edx_enterprise_subsidy_client.egg-info/top_level.txt +0 -0
  16. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/requirements/base.in +0 -0
  17. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/requirements/constraints.txt +0 -0
  18. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/setup.cfg +0 -0
  19. {edx_enterprise_subsidy_client-2.0.1 → edx_enterprise_subsidy_client-2.0.3}/tests/test_client.py +0 -0
@@ -14,6 +14,14 @@ Change Log
14
14
  Unreleased
15
15
  **********
16
16
 
17
+ [2.0.3]
18
+ *******
19
+ * chore: Update Python Requirements
20
+
21
+ [2.0.2]
22
+ *******
23
+ * chore: Update Python Requirements
24
+
17
25
  [2.0.1]
18
26
  *******
19
27
  * chore: Update Python Requirements
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: edx-enterprise-subsidy-client
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: Client for interacting with the enterprise-subsidy service.
5
5
  Home-page: https://github.com/openedx/edx-enterprise-subsidy-client
6
6
  Author: edX
@@ -236,6 +236,14 @@ Change Log
236
236
  Unreleased
237
237
  **********
238
238
 
239
+ [2.0.3]
240
+ *******
241
+ * chore: Update Python Requirements
242
+
243
+ [2.0.2]
244
+ *******
245
+ * chore: Update Python Requirements
246
+
239
247
  [2.0.1]
240
248
  *******
241
249
  * chore: Update Python Requirements
@@ -2,6 +2,6 @@
2
2
  Client for interacting with the enterprise-subsidy service..
3
3
  """
4
4
 
5
- __version__ = '2.0.1'
5
+ __version__ = '2.0.3'
6
6
 
7
7
  from .client import EnterpriseSubsidyAPIClient, EnterpriseSubsidyAPIClientV2, get_enterprise_subsidy_api_client
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: edx-enterprise-subsidy-client
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: Client for interacting with the enterprise-subsidy service.
5
5
  Home-page: https://github.com/openedx/edx-enterprise-subsidy-client
6
6
  Author: edX
@@ -236,6 +236,14 @@ Change Log
236
236
  Unreleased
237
237
  **********
238
238
 
239
+ [2.0.3]
240
+ *******
241
+ * chore: Update Python Requirements
242
+
243
+ [2.0.2]
244
+ *******
245
+ * chore: Update Python Requirements
246
+
239
247
  [2.0.1]
240
248
  *******
241
249
  * chore: Update Python Requirements
@@ -34,20 +34,50 @@ def load_requirements(*requirements_paths):
34
34
  with -c in the requirements files.
35
35
  Returns a list of requirement strings.
36
36
  """
37
+ # UPDATED VIA SEMGREP - if you need to remove/modify this method remove this line and add a comment specifying why.
38
+
39
+ # e.g. {"django": "Django", "confluent-kafka": "confluent_kafka[avro]"}
40
+ by_canonical_name = {}
41
+
42
+ def check_name_consistent(package):
43
+ """
44
+ Raise exception if package is named different ways.
45
+
46
+ This ensures that packages are named consistently so we can match
47
+ constraints to packages. It also ensures that if we require a package
48
+ with extras we don't constrain it without mentioning the extras (since
49
+ that too would interfere with matching constraints.)
50
+ """
51
+ canonical = package.lower().replace('_', '-').split('[')[0]
52
+ seen_spelling = by_canonical_name.get(canonical)
53
+ if seen_spelling is None:
54
+ by_canonical_name[canonical] = package
55
+ elif seen_spelling != package:
56
+ raise Exception(
57
+ f'Encountered both "{seen_spelling}" and "{package}" in requirements '
58
+ 'and constraints files; please use just one or the other.'
59
+ )
60
+
37
61
  requirements = {}
38
62
  constraint_files = set()
39
63
 
40
64
  # groups "pkg<=x.y.z,..." into ("pkg", "<=x.y.z,...")
41
- requirement_line_regex = re.compile(r"([a-zA-Z0-9-_.]+)([<>=][^#\s]+)?")
65
+ re_package_name_base_chars = r"a-zA-Z0-9\-_." # chars allowed in base package name
66
+ # Two groups: name[maybe,extras], and optionally a constraint
67
+ requirement_line_regex = re.compile(
68
+ r"([%s]+(?:\[[%s,\s]+\])?)([<>=][^#\s]+)?"
69
+ % (re_package_name_base_chars, re_package_name_base_chars)
70
+ )
42
71
 
43
72
  def add_version_constraint_or_raise(current_line, current_requirements, add_if_not_present):
44
73
  regex_match = requirement_line_regex.match(current_line)
45
74
  if regex_match:
46
75
  package = regex_match.group(1)
47
76
  version_constraints = regex_match.group(2)
77
+ check_name_consistent(package)
48
78
  existing_version_constraints = current_requirements.get(package, None)
49
- # fine to add constraints to an unconstrained package,
50
- # raise an error if there are already constraints in place
79
+ # It's fine to add constraints to an unconstrained package,
80
+ # but raise an error if there are already constraints in place.
51
81
  if existing_version_constraints and existing_version_constraints != version_constraints:
52
82
  raise BaseException(f'Multiple constraint definitions found for {package}:'
53
83
  f' "{existing_version_constraints}" and "{version_constraints}".'
@@ -56,8 +86,8 @@ def load_requirements(*requirements_paths):
56
86
  if add_if_not_present or package in current_requirements:
57
87
  current_requirements[package] = version_constraints
58
88
 
59
- # read requirements from .in
60
- # store the path to any constraint files that are pulled in
89
+ # Read requirements from .in files and store the path to any
90
+ # constraint files that are pulled in.
61
91
  for path in requirements_paths:
62
92
  with open(path) as reqs:
63
93
  for line in reqs:
@@ -86,7 +116,9 @@ def is_requirement(line):
86
116
  bool: True if the line is not blank, a comment,
87
117
  a URL, or an included file
88
118
  """
89
- return line and line.strip() and not line.startswith(("-r", "#", "-e", "git+", "-c"))
119
+ # UPDATED VIA SEMGREP - if you need to remove/modify this method remove this line and add a comment specifying why
120
+
121
+ return line and line.strip() and not line.startswith(('-r', '#', '-e', 'git+', '-c'))
90
122
 
91
123
 
92
124
  VERSION = get_version('edx_enterprise_subsidy_client', '__init__.py')