careful 0.2.0__tar.gz → 0.2.1__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 (25) hide show
  1. careful-0.2.1/.woodpecker.yml +32 -0
  2. {careful-0.2.0 → careful-0.2.1}/Justfile +2 -2
  3. {careful-0.2.0 → careful-0.2.1}/PKG-INFO +6 -9
  4. {careful-0.2.0 → careful-0.2.1}/README.md +5 -3
  5. {careful-0.2.0 → careful-0.2.1}/docs/index.md +3 -1
  6. {careful-0.2.0 → careful-0.2.1}/docs/reference.md +0 -2
  7. {careful-0.2.0 → careful-0.2.1}/mkdocs.yml +1 -3
  8. {careful-0.2.0 → careful-0.2.1}/pyproject.toml +13 -6
  9. {careful-0.2.0 → careful-0.2.1}/src/careful/httpx/_types.py +1 -1
  10. {careful-0.2.0 → careful-0.2.1}/src/careful/httpx/dev_cache.py +1 -1
  11. {careful-0.2.0 → careful-0.2.1}/tests/fakeresponse.py +0 -2
  12. {careful-0.2.0 → careful-0.2.1}/tests/test_careful.py +2 -2
  13. {careful-0.2.0 → careful-0.2.1}/tests/test_retries.py +3 -1
  14. {careful-0.2.0 → careful-0.2.1}/tests/test_throttle.py +0 -2
  15. {careful-0.2.0 → careful-0.2.1}/.gitignore +0 -0
  16. {careful-0.2.0 → careful-0.2.1}/.pre-commit-config.yaml +0 -0
  17. {careful-0.2.0 → careful-0.2.1}/LICENSE +0 -0
  18. {careful-0.2.0 → careful-0.2.1}/docs/carefully-3681327.svg +0 -0
  19. {careful-0.2.0 → careful-0.2.1}/docs/changelog.md +0 -0
  20. {careful-0.2.0 → careful-0.2.1}/src/careful/__init__.py +0 -0
  21. {careful-0.2.0 → careful-0.2.1}/src/careful/httpx/__init__.py +0 -0
  22. {careful-0.2.0 → careful-0.2.1}/src/careful/httpx/py.typed +0 -0
  23. {careful-0.2.0 → careful-0.2.1}/src/careful/httpx/retries.py +0 -0
  24. {careful-0.2.0 → careful-0.2.1}/src/careful/httpx/throttle.py +0 -0
  25. {careful-0.2.0 → careful-0.2.1}/tests/test_cache.py +0 -0
@@ -0,0 +1,32 @@
1
+ when:
2
+ - event: push
3
+ - event: pull_request
4
+
5
+ matrix:
6
+ PYTHON_VERSION:
7
+ - "3.10"
8
+ - "3.11"
9
+ - "3.12"
10
+ - "3.13"
11
+
12
+ steps:
13
+ lint:
14
+ image: python:3.11
15
+ commands:
16
+ - curl -LsSf https://astral.sh/uv/install.sh | sh
17
+ - "export PATH=/root/.local/bin:$PATH"
18
+ - uv run ruff check .
19
+ - uv run ruff format --check .
20
+ when:
21
+ - matrix:
22
+ PYTHON_VERSION: 3.13
23
+
24
+
25
+ test:
26
+ image: "python:${PYTHON_VERSION}"
27
+ commands:
28
+ - curl -LsSf https://astral.sh/uv/install.sh | sh
29
+ - "export PATH=/root/.local/bin:$PATH"
30
+ - uv run --python ${PYTHON_VERSION} pytest
31
+ depends_on:
32
+ - lint
@@ -7,10 +7,10 @@ lint:
7
7
  preview:
8
8
  uv run mkdocs serve
9
9
 
10
- publish:
10
+ publish-pypi:
11
11
  uv build
12
12
  uv publish
13
13
 
14
- deploy:
14
+ publish-docs:
15
15
  uv run mkdocs build
16
16
  netlify deploy --prod -s careful-docs -d site
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: careful
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: careful extensions to httpx: throttle, retry, cache
5
5
  Project-URL: Repository, https://codeberg.org/jpt/careful
6
6
  Author-email: jpt <dev@jpt.sh>
@@ -18,23 +18,20 @@ Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
19
  Requires-Python: >=3.10
20
20
  Requires-Dist: httpx>=0.28.1
21
- Requires-Dist: mkdocs-material>=9.6.18
22
- Requires-Dist: mkdocstrings-python>=1.18.2
23
- Requires-Dist: mkdocstrings>=0.30.0
24
- Requires-Dist: pytest-httpbin>=2.1.0
25
- Requires-Dist: pytest>=8.4.2
26
21
  Description-Content-Type: text/markdown
27
22
 
28
23
  # careful
29
24
 
30
- <img src="/carefully-3681327.svg" width=100 height=100 alt="logo of a warning sign">
31
-
32
- **careful** is a library for making requests to unreliable websites with httpx.
25
+ <img src="https://careful.jpt.sh/carefully-3681327.svg" width=100 height=100 alt="logo of a warning sign">
33
26
 
27
+ **careful** is a Python library for making requests to unreliable websites with `httpx`.
28
+
34
29
  **Code**: <https://codeberg.org/jpt/careful>
35
30
 
36
31
  **Docs**: <https://careful.jpt.sh>
37
32
 
33
+ [![status-badge](https://ci.codeberg.org/api/badges/15185/status.svg)](https://ci.codeberg.org/repos/15185)
34
+
38
35
  It offers enhancements to
39
36
  [`httpx.Client`](https://www.python-httpx.org)
40
37
  useful for writing long-running scrapers & crawlers, particularly against sites that are slow or have intermittent errors.
@@ -1,13 +1,15 @@
1
1
  # careful
2
2
 
3
- <img src="/carefully-3681327.svg" width=100 height=100 alt="logo of a warning sign">
4
-
5
- **careful** is a library for making requests to unreliable websites with httpx.
3
+ <img src="https://careful.jpt.sh/carefully-3681327.svg" width=100 height=100 alt="logo of a warning sign">
6
4
 
5
+ **careful** is a Python library for making requests to unreliable websites with `httpx`.
6
+
7
7
  **Code**: <https://codeberg.org/jpt/careful>
8
8
 
9
9
  **Docs**: <https://careful.jpt.sh>
10
10
 
11
+ [![status-badge](https://ci.codeberg.org/api/badges/15185/status.svg)](https://ci.codeberg.org/repos/15185)
12
+
11
13
  It offers enhancements to
12
14
  [`httpx.Client`](https://www.python-httpx.org)
13
15
  useful for writing long-running scrapers & crawlers, particularly against sites that are slow or have intermittent errors.
@@ -2,12 +2,14 @@
2
2
 
3
3
  <img src="/carefully-3681327.svg" width=100 height=100 alt="logo of a warning sign">
4
4
 
5
- **careful** is a library for making requests to unreliable websites with httpx.
5
+ **careful** is a Python library for making requests to unreliable websites with `httpx`.
6
6
 
7
7
  **Code**: <https://codeberg.org/jpt/careful>
8
8
 
9
9
  **Docs**: <https://careful.jpt.sh>
10
10
 
11
+ [![status-badge](https://ci.codeberg.org/api/badges/15185/status.svg)](https://ci.codeberg.org/repos/15185)
12
+
11
13
  It offers enhancements to
12
14
  [`httpx.Client`](https://www.python-httpx.org)
13
15
  useful for writing long-running scrapers & crawlers, particularly against sites that are slow or have intermittent errors.
@@ -30,5 +30,3 @@ Most users will only need to call `careful.httpx.make_careful_client`.
30
30
  members: False
31
31
  show_root_heading: true
32
32
 
33
-
34
- ## Individual Wrappers
@@ -5,7 +5,6 @@ site_description: A library for making requests to unreliable sites with httpx.
5
5
  copyright: Copyright &copy; 2025 James Turk
6
6
  repo_url: https://codeberg.org/jpt/careful
7
7
  repo_name: careful
8
- #edit_uri: edit/main/docs/
9
8
 
10
9
  theme:
11
10
  name: material
@@ -29,8 +28,7 @@ theme:
29
28
  - navigation.sections
30
29
  - navigation.top
31
30
  - content.tabs.link
32
- # icon:
33
- # repo:
31
+
34
32
  markdown_extensions:
35
33
  - admonition
36
34
  - def_list
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "careful"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "careful extensions to httpx: throttle, retry, cache"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -22,11 +22,6 @@ classifiers = [
22
22
  ]
23
23
  dependencies = [
24
24
  "httpx>=0.28.1",
25
- "mkdocs-material>=9.6.18",
26
- "mkdocstrings>=0.30.0",
27
- "mkdocstrings-python>=1.18.2",
28
- "pytest>=8.4.2",
29
- "pytest-httpbin>=2.1.0",
30
25
  ]
31
26
  [project.urls]
32
27
  Repository = "https://codeberg.org/jpt/careful"
@@ -35,3 +30,15 @@ Repository = "https://codeberg.org/jpt/careful"
35
30
  [build-system]
36
31
  requires = ["hatchling"]
37
32
  build-backend = "hatchling.build"
33
+
34
+ [dependency-groups]
35
+ dev = [
36
+ "ruff>=0.12.12",
37
+ "mkdocs-material>=9.6.18",
38
+ "mkdocstrings>=0.30.0",
39
+ "mkdocstrings-python>=1.18.2",
40
+ "pytest>=8.4.2",
41
+ ]
42
+ httpbin = [
43
+ "pytest-httpbin>=2.1.0",
44
+ ]
@@ -3,4 +3,4 @@ from typing import Callable
3
3
 
4
4
  ResponsePredicate = Callable[[Response], bool]
5
5
 
6
- CacheKeyfunc = Callable[[str,str,dict], str]
6
+ CacheKeyfunc = Callable[[str, str, dict], str]
@@ -150,7 +150,7 @@ class FileCache(CacheStorageBase):
150
150
 
151
151
  Parameters:
152
152
  cache_dir: directory for storing responses
153
-
153
+
154
154
  Example:
155
155
 
156
156
  make_careful_client(
@@ -1,4 +1,3 @@
1
-
2
1
  class FakeResponse:
3
2
  def __init__(
4
3
  self,
@@ -14,4 +13,3 @@ class FakeResponse:
14
13
  self.text = str(content)
15
14
  self.encoding = encoding
16
15
  self.headers = headers or {}
17
-
@@ -40,8 +40,8 @@ def test_full_careful_client():
40
40
  assert mock_sleep.call_count == 1
41
41
 
42
42
  # a new, throttled call (no retry)
43
- resp = client.get("http://dummy/2")
44
- assert mock_send.call_count == 3
43
+ resp = client.get("http://dummy/2")
44
+ assert mock_send.call_count == 3
45
45
  assert resp.status_code == 404
46
46
  # call was throttled
47
47
  assert mock_sleep.call_count == 2
@@ -31,7 +31,9 @@ def test_retry() -> None:
31
31
 
32
32
 
33
33
  def test_retry_404() -> None:
34
- client = make_retry_client(attempts=3, wait_seconds=0.001, should_retry=retry_all_400s_500s)
34
+ client = make_retry_client(
35
+ attempts=3, wait_seconds=0.001, should_retry=retry_all_400s_500s
36
+ )
35
37
 
36
38
  # On the first call return a 404, then a 200
37
39
  mock_request = mock.Mock(
@@ -26,5 +26,3 @@ def test_request_throttling() -> None:
26
26
  assert mock_sleep.call_count == 2
27
27
  # should have slept for ~2 seconds to aim at 30 per min
28
28
  assert 1.8 <= mock_sleep.call_args[0][0] <= 2.2
29
-
30
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes