commonpy 1.13.0__tar.gz → 1.13.2__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 (29) hide show
  1. {commonpy-1.13.0 → commonpy-1.13.2}/PKG-INFO +37 -12
  2. {commonpy-1.13.0 → commonpy-1.13.2}/README.md +17 -8
  3. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/__init__.py +1 -1
  4. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy.egg-info/PKG-INFO +37 -12
  5. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy.egg-info/requires.txt +2 -2
  6. {commonpy-1.13.0 → commonpy-1.13.2}/setup.cfg +3 -3
  7. {commonpy-1.13.0 → commonpy-1.13.2}/LICENSE +0 -0
  8. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/data_structures.py +0 -0
  9. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/data_utils.py +0 -0
  10. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/exceptions.py +0 -0
  11. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/file_utils.py +0 -0
  12. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/interrupt.py +0 -0
  13. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/module_utils.py +0 -0
  14. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/network_utils.py +0 -0
  15. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/string_utils.py +0 -0
  16. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy/system_utils.py +0 -0
  17. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy.egg-info/SOURCES.txt +0 -0
  18. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy.egg-info/dependency_links.txt +0 -0
  19. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy.egg-info/not-zip-safe +0 -0
  20. {commonpy-1.13.0 → commonpy-1.13.2}/commonpy.egg-info/top_level.txt +0 -0
  21. {commonpy-1.13.0 → commonpy-1.13.2}/setup.py +0 -0
  22. {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_data_structures.py +0 -0
  23. {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_data_utils.py +0 -0
  24. {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_exceptions.py +0 -0
  25. {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_file_utils.py +0 -0
  26. {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_module_utils.py +0 -0
  27. {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_network_utils.py +0 -0
  28. {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_string_utils.py +0 -0
  29. {commonpy-1.13.0 → commonpy-1.13.2}/tests/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: commonpy
3
- Version: 1.13.0
3
+ Version: 1.13.2
4
4
  Summary: Assortment of Python helper functions and utility classes
5
5
  Home-page: https://github.com/caltechlibrary/commonpy
6
6
  Author: Michael Hucka
@@ -18,10 +18,26 @@ Classifier: Operating System :: POSIX
18
18
  Classifier: Operating System :: POSIX :: Linux
19
19
  Classifier: Operating System :: Unix
20
20
  Classifier: Programming Language :: Python
21
- Classifier: Programming Language :: Python :: 3.6
22
- Requires-Python: >=3.6
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Requires-Python: >=3.10
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
+ Requires-Dist: PyYAML>=5.3.1
26
+ Requires-Dist: boltons==21.0.0
27
+ Requires-Dist: dateparser==1.1.8
28
+ Requires-Dist: deprecation==2.1.0
29
+ Requires-Dist: h2>=4.4.1
30
+ Requires-Dist: httpx>=0.28.1
31
+ Requires-Dist: humanize>=3.9.0
32
+ Requires-Dist: python_dateutil==2.8.2
33
+ Requires-Dist: pywin32>=301; sys_platform == "win32"
34
+ Requires-Dist: regex<=2022.3.2
35
+ Requires-Dist: setuptools>=67.5.1
36
+ Requires-Dist: sidetrack>=2.0.0
37
+ Requires-Dist: tldextract==3.0.2
38
+ Requires-Dist: validator-collection==1.5.0
39
+ Dynamic: license-file
40
+ Dynamic: requires-dist
25
41
 
26
42
  CommonPy<img width="12%" align="right" src="https://github.com/caltechlibrary/commonpy/raw/main/.graphics/commonpy-icon.png">
27
43
  ===============================================
@@ -30,7 +46,7 @@ This is a collection of common utility functions and classes that we at the Calt
30
46
 
31
47
  [![Latest release](https://img.shields.io/github/v/release/caltechlibrary/commonpy.svg?style=flat-square&color=b44e88&label=Latest%20release)](https://github.com/caltechlibrary/commonpy/releases)
32
48
  [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg?style=flat-square)](https://choosealicense.com/licenses/bsd-3-clause)
33
- [![Python](https://img.shields.io/badge/Python-3.6+-brightgreen.svg?style=flat-square)](http://shields.io)
49
+ [![Python](https://img.shields.io/badge/Python-3.10+-brightgreen.svg?style=flat-square)](http://shields.io)
34
50
  [![PyPI](https://img.shields.io/pypi/v/commonpy.svg?style=flat-square&color=orange&label=PyPI)](https://pypi.org/project/commonpy/)
35
51
 
36
52
  Table of contents
@@ -171,28 +187,37 @@ The `network_utils` module provides several functions that are useful when perfo
171
187
  | `hostname(url)` | Returns the hostname portion of a URL |
172
188
  | `net(...)` | See below |
173
189
  | `netlock(url)` | Returns the hostname, port number (if any), and login info (if any) |
190
+ | `network(...)` | See below |
174
191
  | `network_available()` | Returns `True` if external hosts are reacheable over the network |
175
192
  | `on_localhost(url)` | Returns `True` if the address of `url` points to the local host |
176
193
  | `scheme(url)` | Returns the protocol portion of the url; e.g., "https" |
177
194
 
178
195
 
179
- #### _`net`_
196
+ #### _`network` and `net`_
180
197
 
181
- The `net` function in the `network_utils` module implements a fairly high-level network operation interface that internally handles timeouts, rate limits, polling, HTTP/2, and more. The function signature is:
198
+ The `network` and `net` functions in the `network_utils` module implements a fairly high-level network operation interface that internally handles timeouts, rate limits, polling, HTTP/2, and more. The function signatures are identical to this:
182
199
 
183
200
  ```python
184
- net(method, url, client = None, handle_rate = True, polling = False, recursing = 0, **kwargs)
201
+ network(method, url, client = None, handle_rate = True, polling = False, **kwargs)
185
202
  ```
186
203
 
187
- The `method` parameter should have a value such as `'get'`, `'post'`, `'head'`, or similar. The function returns a tuple of (response, exception), where the first element is the response from the get or post HTTP call, and the second element is an exception object if an exception occurred. If no exception occurred, the second element will be `None`. This allows the caller to inspect the response even in cases where exceptions are raised.
204
+ The difference between the two functions is their behavior with respect to exceptions. The function `network` returns only a `response` object, and raises an exception if any error occurs. The `net` function returns two values: `response, error` and does not raise exceptions except in the case of bad arguments; instead, any exceptions are returned as the `error` value in the list of return values. This allows the caller to inspect the `response` object even in cases where exceptions are raised.
188
205
 
189
- If keyword `client` is not `None`, it's assumed to be a [Python HTTPX Client](https://www.python-httpx.org) object to use for the network call. Settings such as timeouts should be done by the caller creating appropriately-configured [Client](https://www.python-httpx.org/api/#client) objects.
206
+ The `response` object returned by both `net` and `network` is the response from the get or post HTTP call. This object comes from the Python [HTTPX](https://www.python-httpx.org) module used by
190
207
 
191
- If keyword `handle_rate` is `True`, this function will automatically pause and retry if it receives an HTTP code 429 ("too many requests") from the server. If `False`, it will return the exception `CommonPy.RateLimitExceeded` instead.
208
+ The `method` parameter value must be a string chosen from the list of known HTTP methods: `"get"`, `"post"`, `"head"`, `"options"`, `"put"`, `"delete"`, or `"patch"`.
209
+
210
+ The `url` parameter value must be the URL to which the HTTP method will be applied.
211
+
212
+ If keyword `client` is not `None`, it's assumed to be a [HTTPX Client](https://www.python-httpx.org/api/#client) object to use for the network call. Settings such as timeouts should be done by the caller creating appropriately-configured [Client](https://www.python-httpx.org/api/#client) objects.
213
+
214
+ If keyword `handle_rate` is `True`, both functions will automatically pause and retry if it receives an HTTP code 429 ("too many requests") from the server. If `False`, it will return the exception `CommonPy.exceptions.RateLimitExceeded` instead.
192
215
 
193
216
  If keyword `polling` is `True`, certain statuses like 404 are ignored and the response is returned; otherwise, they are considered errors. The behavior when `True` is useful in situations where a URL does not exist until something is ready at the server, and the caller is repeatedly checking the URL. It is up to the caller to implement the polling schedule and call this function (with `polling = True`) as needed.
194
217
 
195
- This method always passes the argument `allow_redirects = True` to the underlying Python HTTPX library network calls.
218
+ Additional keyword arguments understood by [HTTPX](https://www.python-httpx.org) can be passed to both `network` and `net`.
219
+
220
+ Both methods always pass the argument `allow_redirects = True` to the underlying Python HTTPX library network calls.
196
221
 
197
222
 
198
223
  #### _`download` and `download_file`_
@@ -5,7 +5,7 @@ This is a collection of common utility functions and classes that we at the Calt
5
5
 
6
6
  [![Latest release](https://img.shields.io/github/v/release/caltechlibrary/commonpy.svg?style=flat-square&color=b44e88&label=Latest%20release)](https://github.com/caltechlibrary/commonpy/releases)
7
7
  [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg?style=flat-square)](https://choosealicense.com/licenses/bsd-3-clause)
8
- [![Python](https://img.shields.io/badge/Python-3.6+-brightgreen.svg?style=flat-square)](http://shields.io)
8
+ [![Python](https://img.shields.io/badge/Python-3.10+-brightgreen.svg?style=flat-square)](http://shields.io)
9
9
  [![PyPI](https://img.shields.io/pypi/v/commonpy.svg?style=flat-square&color=orange&label=PyPI)](https://pypi.org/project/commonpy/)
10
10
 
11
11
  Table of contents
@@ -146,28 +146,37 @@ The `network_utils` module provides several functions that are useful when perfo
146
146
  | `hostname(url)` | Returns the hostname portion of a URL |
147
147
  | `net(...)` | See below |
148
148
  | `netlock(url)` | Returns the hostname, port number (if any), and login info (if any) |
149
+ | `network(...)` | See below |
149
150
  | `network_available()` | Returns `True` if external hosts are reacheable over the network |
150
151
  | `on_localhost(url)` | Returns `True` if the address of `url` points to the local host |
151
152
  | `scheme(url)` | Returns the protocol portion of the url; e.g., "https" |
152
153
 
153
154
 
154
- #### _`net`_
155
+ #### _`network` and `net`_
155
156
 
156
- The `net` function in the `network_utils` module implements a fairly high-level network operation interface that internally handles timeouts, rate limits, polling, HTTP/2, and more. The function signature is:
157
+ The `network` and `net` functions in the `network_utils` module implements a fairly high-level network operation interface that internally handles timeouts, rate limits, polling, HTTP/2, and more. The function signatures are identical to this:
157
158
 
158
159
  ```python
159
- net(method, url, client = None, handle_rate = True, polling = False, recursing = 0, **kwargs)
160
+ network(method, url, client = None, handle_rate = True, polling = False, **kwargs)
160
161
  ```
161
162
 
162
- The `method` parameter should have a value such as `'get'`, `'post'`, `'head'`, or similar. The function returns a tuple of (response, exception), where the first element is the response from the get or post HTTP call, and the second element is an exception object if an exception occurred. If no exception occurred, the second element will be `None`. This allows the caller to inspect the response even in cases where exceptions are raised.
163
+ The difference between the two functions is their behavior with respect to exceptions. The function `network` returns only a `response` object, and raises an exception if any error occurs. The `net` function returns two values: `response, error` and does not raise exceptions except in the case of bad arguments; instead, any exceptions are returned as the `error` value in the list of return values. This allows the caller to inspect the `response` object even in cases where exceptions are raised.
163
164
 
164
- If keyword `client` is not `None`, it's assumed to be a [Python HTTPX Client](https://www.python-httpx.org) object to use for the network call. Settings such as timeouts should be done by the caller creating appropriately-configured [Client](https://www.python-httpx.org/api/#client) objects.
165
+ The `response` object returned by both `net` and `network` is the response from the get or post HTTP call. This object comes from the Python [HTTPX](https://www.python-httpx.org) module used by
165
166
 
166
- If keyword `handle_rate` is `True`, this function will automatically pause and retry if it receives an HTTP code 429 ("too many requests") from the server. If `False`, it will return the exception `CommonPy.RateLimitExceeded` instead.
167
+ The `method` parameter value must be a string chosen from the list of known HTTP methods: `"get"`, `"post"`, `"head"`, `"options"`, `"put"`, `"delete"`, or `"patch"`.
168
+
169
+ The `url` parameter value must be the URL to which the HTTP method will be applied.
170
+
171
+ If keyword `client` is not `None`, it's assumed to be a [HTTPX Client](https://www.python-httpx.org/api/#client) object to use for the network call. Settings such as timeouts should be done by the caller creating appropriately-configured [Client](https://www.python-httpx.org/api/#client) objects.
172
+
173
+ If keyword `handle_rate` is `True`, both functions will automatically pause and retry if it receives an HTTP code 429 ("too many requests") from the server. If `False`, it will return the exception `CommonPy.exceptions.RateLimitExceeded` instead.
167
174
 
168
175
  If keyword `polling` is `True`, certain statuses like 404 are ignored and the response is returned; otherwise, they are considered errors. The behavior when `True` is useful in situations where a URL does not exist until something is ready at the server, and the caller is repeatedly checking the URL. It is up to the caller to implement the polling schedule and call this function (with `polling = True`) as needed.
169
176
 
170
- This method always passes the argument `allow_redirects = True` to the underlying Python HTTPX library network calls.
177
+ Additional keyword arguments understood by [HTTPX](https://www.python-httpx.org) can be passed to both `network` and `net`.
178
+
179
+ Both methods always pass the argument `allow_redirects = True` to the underlying Python HTTPX library network calls.
171
180
 
172
181
 
173
182
  #### _`download` and `download_file`_
@@ -21,7 +21,7 @@ file "LICENSE" for more information.
21
21
  # | by the Makefile. Manual changes to these values will be lost. |
22
22
  # ╰────────────────────── Notice ── Notice ── Notice ─────────────────────╯
23
23
 
24
- __version__ = '1.13.0'
24
+ __version__ = '1.13.2'
25
25
  __description__ = 'Assortment of Python helper functions and utility classes'
26
26
  __url__ = 'https://github.com/caltechlibrary/commonpy'
27
27
  __author__ = 'Michael Hucka'
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: commonpy
3
- Version: 1.13.0
3
+ Version: 1.13.2
4
4
  Summary: Assortment of Python helper functions and utility classes
5
5
  Home-page: https://github.com/caltechlibrary/commonpy
6
6
  Author: Michael Hucka
@@ -18,10 +18,26 @@ Classifier: Operating System :: POSIX
18
18
  Classifier: Operating System :: POSIX :: Linux
19
19
  Classifier: Operating System :: Unix
20
20
  Classifier: Programming Language :: Python
21
- Classifier: Programming Language :: Python :: 3.6
22
- Requires-Python: >=3.6
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Requires-Python: >=3.10
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
+ Requires-Dist: PyYAML>=5.3.1
26
+ Requires-Dist: boltons==21.0.0
27
+ Requires-Dist: dateparser==1.1.8
28
+ Requires-Dist: deprecation==2.1.0
29
+ Requires-Dist: h2>=4.4.1
30
+ Requires-Dist: httpx>=0.28.1
31
+ Requires-Dist: humanize>=3.9.0
32
+ Requires-Dist: python_dateutil==2.8.2
33
+ Requires-Dist: pywin32>=301; sys_platform == "win32"
34
+ Requires-Dist: regex<=2022.3.2
35
+ Requires-Dist: setuptools>=67.5.1
36
+ Requires-Dist: sidetrack>=2.0.0
37
+ Requires-Dist: tldextract==3.0.2
38
+ Requires-Dist: validator-collection==1.5.0
39
+ Dynamic: license-file
40
+ Dynamic: requires-dist
25
41
 
26
42
  CommonPy<img width="12%" align="right" src="https://github.com/caltechlibrary/commonpy/raw/main/.graphics/commonpy-icon.png">
27
43
  ===============================================
@@ -30,7 +46,7 @@ This is a collection of common utility functions and classes that we at the Calt
30
46
 
31
47
  [![Latest release](https://img.shields.io/github/v/release/caltechlibrary/commonpy.svg?style=flat-square&color=b44e88&label=Latest%20release)](https://github.com/caltechlibrary/commonpy/releases)
32
48
  [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg?style=flat-square)](https://choosealicense.com/licenses/bsd-3-clause)
33
- [![Python](https://img.shields.io/badge/Python-3.6+-brightgreen.svg?style=flat-square)](http://shields.io)
49
+ [![Python](https://img.shields.io/badge/Python-3.10+-brightgreen.svg?style=flat-square)](http://shields.io)
34
50
  [![PyPI](https://img.shields.io/pypi/v/commonpy.svg?style=flat-square&color=orange&label=PyPI)](https://pypi.org/project/commonpy/)
35
51
 
36
52
  Table of contents
@@ -171,28 +187,37 @@ The `network_utils` module provides several functions that are useful when perfo
171
187
  | `hostname(url)` | Returns the hostname portion of a URL |
172
188
  | `net(...)` | See below |
173
189
  | `netlock(url)` | Returns the hostname, port number (if any), and login info (if any) |
190
+ | `network(...)` | See below |
174
191
  | `network_available()` | Returns `True` if external hosts are reacheable over the network |
175
192
  | `on_localhost(url)` | Returns `True` if the address of `url` points to the local host |
176
193
  | `scheme(url)` | Returns the protocol portion of the url; e.g., "https" |
177
194
 
178
195
 
179
- #### _`net`_
196
+ #### _`network` and `net`_
180
197
 
181
- The `net` function in the `network_utils` module implements a fairly high-level network operation interface that internally handles timeouts, rate limits, polling, HTTP/2, and more. The function signature is:
198
+ The `network` and `net` functions in the `network_utils` module implements a fairly high-level network operation interface that internally handles timeouts, rate limits, polling, HTTP/2, and more. The function signatures are identical to this:
182
199
 
183
200
  ```python
184
- net(method, url, client = None, handle_rate = True, polling = False, recursing = 0, **kwargs)
201
+ network(method, url, client = None, handle_rate = True, polling = False, **kwargs)
185
202
  ```
186
203
 
187
- The `method` parameter should have a value such as `'get'`, `'post'`, `'head'`, or similar. The function returns a tuple of (response, exception), where the first element is the response from the get or post HTTP call, and the second element is an exception object if an exception occurred. If no exception occurred, the second element will be `None`. This allows the caller to inspect the response even in cases where exceptions are raised.
204
+ The difference between the two functions is their behavior with respect to exceptions. The function `network` returns only a `response` object, and raises an exception if any error occurs. The `net` function returns two values: `response, error` and does not raise exceptions except in the case of bad arguments; instead, any exceptions are returned as the `error` value in the list of return values. This allows the caller to inspect the `response` object even in cases where exceptions are raised.
188
205
 
189
- If keyword `client` is not `None`, it's assumed to be a [Python HTTPX Client](https://www.python-httpx.org) object to use for the network call. Settings such as timeouts should be done by the caller creating appropriately-configured [Client](https://www.python-httpx.org/api/#client) objects.
206
+ The `response` object returned by both `net` and `network` is the response from the get or post HTTP call. This object comes from the Python [HTTPX](https://www.python-httpx.org) module used by
190
207
 
191
- If keyword `handle_rate` is `True`, this function will automatically pause and retry if it receives an HTTP code 429 ("too many requests") from the server. If `False`, it will return the exception `CommonPy.RateLimitExceeded` instead.
208
+ The `method` parameter value must be a string chosen from the list of known HTTP methods: `"get"`, `"post"`, `"head"`, `"options"`, `"put"`, `"delete"`, or `"patch"`.
209
+
210
+ The `url` parameter value must be the URL to which the HTTP method will be applied.
211
+
212
+ If keyword `client` is not `None`, it's assumed to be a [HTTPX Client](https://www.python-httpx.org/api/#client) object to use for the network call. Settings such as timeouts should be done by the caller creating appropriately-configured [Client](https://www.python-httpx.org/api/#client) objects.
213
+
214
+ If keyword `handle_rate` is `True`, both functions will automatically pause and retry if it receives an HTTP code 429 ("too many requests") from the server. If `False`, it will return the exception `CommonPy.exceptions.RateLimitExceeded` instead.
192
215
 
193
216
  If keyword `polling` is `True`, certain statuses like 404 are ignored and the response is returned; otherwise, they are considered errors. The behavior when `True` is useful in situations where a URL does not exist until something is ready at the server, and the caller is repeatedly checking the URL. It is up to the caller to implement the polling schedule and call this function (with `polling = True`) as needed.
194
217
 
195
- This method always passes the argument `allow_redirects = True` to the underlying Python HTTPX library network calls.
218
+ Additional keyword arguments understood by [HTTPX](https://www.python-httpx.org) can be passed to both `network` and `net`.
219
+
220
+ Both methods always pass the argument `allow_redirects = True` to the underlying Python HTTPX library network calls.
196
221
 
197
222
 
198
223
  #### _`download` and `download_file`_
@@ -2,8 +2,8 @@ PyYAML>=5.3.1
2
2
  boltons==21.0.0
3
3
  dateparser==1.1.8
4
4
  deprecation==2.1.0
5
- h2==4.0.0
6
- httpx==0.23.1
5
+ h2>=4.4.1
6
+ httpx>=0.28.1
7
7
  humanize>=3.9.0
8
8
  python_dateutil==2.8.2
9
9
  regex<=2022.3.2
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = commonpy
3
- version = 1.13.0
3
+ version = 1.13.2
4
4
  description = Assortment of Python helper functions and utility classes
5
5
  author = Michael Hucka
6
6
  author_email = mhucka@caltech.edu
@@ -21,14 +21,14 @@ classifiers =
21
21
  Operating System :: POSIX :: Linux
22
22
  Operating System :: Unix
23
23
  Programming Language :: Python
24
- Programming Language :: Python :: 3.6
24
+ Programming Language :: Python :: 3.10
25
25
  long_description = file:README.md
26
26
  long_description_content_type = text/markdown
27
27
 
28
28
  [options]
29
29
  packages = find:
30
30
  zip_safe = False
31
- python_requires = >= 3.6
31
+ python_requires = >= 3.10
32
32
 
33
33
  [egg_info]
34
34
  tag_build =
File without changes
File without changes