tiny-retriever 0.2.0__tar.gz → 0.3.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.
- tiny_retriever-0.3.0/.github/workflows/docs.yml +45 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/.github/workflows/release.yml +17 -18
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/.github/workflows/test.yml +2 -2
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/.pre-commit-config.yaml +23 -5
- tiny_retriever-0.3.0/CHANGELOG.md +66 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/CODE_OF_CONDUCT.md +4 -4
- tiny_retriever-0.3.0/CONTRIBUTING.md +175 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/PKG-INFO +52 -20
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/README.md +40 -11
- tiny_retriever-0.3.0/docs/examples/hydrodata.ipynb +296 -0
- tiny_retriever-0.3.0/docs/examples/index.md +21 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/mkdocs.yml +9 -7
- tiny_retriever-0.3.0/pyproject.toml +352 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/src/tiny_retriever/__init__.py +2 -1
- tiny_retriever-0.3.0/src/tiny_retriever/py.typed +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/src/tiny_retriever/tiny_retriever.py +316 -52
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/src/tiny_retriever/tiny_retriever.pyi +50 -13
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/tests/test_exceptions.py +8 -4
- tiny_retriever-0.3.0/tests/test_retriever.py +601 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/tests/test_threading.py +17 -0
- tiny_retriever-0.2.0/CHANGELOG.md +0 -57
- tiny_retriever-0.2.0/CONTRIBUTING.md +0 -239
- tiny_retriever-0.2.0/docs/examples/hydrodata.ipynb +0 -322
- tiny_retriever-0.2.0/docs/examples/index.md +0 -18
- tiny_retriever-0.2.0/pyproject.toml +0 -316
- tiny_retriever-0.2.0/tests/test_retriever.py +0 -319
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/.codecov.yml +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/.gitattributes +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/.github/ISSUE_TEMPLATE/bugreport.yml +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/.github/ISSUE_TEMPLATE/newfeature.yml +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/.github/dependabot.yml +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/.gitignore +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/.readthedocs.yaml +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/AUTHORS.md +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/LICENSE +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/docs/assets/logo.png +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/docs/assets/logo.svg +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/docs/docs_hooks.py +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/docs/examples/images/dem.png +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/docs/javascripts/mathjax.js +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/docs/overrides/main.html +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/docs/reference.md +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/docs/stylesheets/extra.css +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/environment.yml +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/src/tiny_retriever/exceptions.py +0 -0
- {tiny_retriever-0.2.0 → tiny_retriever-0.3.0}/tests/test_filename.py +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
tags:
|
|
8
|
+
- v*
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
docs:
|
|
16
|
+
name: Deploy Documentation
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v6
|
|
21
|
+
with:
|
|
22
|
+
fetch-depth: 0
|
|
23
|
+
|
|
24
|
+
- uses: prefix-dev/setup-pixi@v0.9.4
|
|
25
|
+
with:
|
|
26
|
+
pixi-version: v0.66.0
|
|
27
|
+
environments: docs
|
|
28
|
+
activate-environment: docs
|
|
29
|
+
|
|
30
|
+
- name: Configure Git
|
|
31
|
+
run: |-
|
|
32
|
+
git config user.name "github-actions[bot]"
|
|
33
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
34
|
+
|
|
35
|
+
- name: Deploy latest docs (main branch)
|
|
36
|
+
if: github.ref == 'refs/heads/main'
|
|
37
|
+
run: |-
|
|
38
|
+
pixi r docs-deploy
|
|
39
|
+
mike set-default --push latest
|
|
40
|
+
|
|
41
|
+
- name: Deploy release docs (tagged version)
|
|
42
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
43
|
+
run: |-
|
|
44
|
+
pixi r docs-release
|
|
45
|
+
mike set-default --push stable
|
|
@@ -17,25 +17,24 @@ jobs:
|
|
|
17
17
|
runs-on: ubuntu-latest
|
|
18
18
|
steps:
|
|
19
19
|
- uses: actions/checkout@v6
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- name: Github Release
|
|
20
|
+
with:
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
|
|
23
|
+
- name: Generate release notes with git-cliff
|
|
24
|
+
uses: orhun/git-cliff-action@v4
|
|
25
|
+
with:
|
|
26
|
+
config: pyproject.toml
|
|
27
|
+
args: --latest --strip all
|
|
28
|
+
env:
|
|
29
|
+
OUTPUT: release-notes.md
|
|
30
|
+
GITHUB_REPO: ${{ github.repository }}
|
|
31
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
32
|
+
|
|
33
|
+
- name: Create GitHub Release
|
|
35
34
|
uses: softprops/action-gh-release@v2
|
|
36
35
|
if: startsWith(github.ref, 'refs/tags/')
|
|
37
36
|
with:
|
|
38
|
-
body_path:
|
|
37
|
+
body_path: release-notes.md
|
|
39
38
|
env:
|
|
40
39
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
41
40
|
|
|
@@ -59,13 +58,13 @@ jobs:
|
|
|
59
58
|
|
|
60
59
|
steps:
|
|
61
60
|
- name: Download packages built by build-and-inspect-python-package
|
|
62
|
-
uses: actions/download-artifact@
|
|
61
|
+
uses: actions/download-artifact@v8
|
|
63
62
|
with:
|
|
64
63
|
name: Packages
|
|
65
64
|
path: dist
|
|
66
65
|
|
|
67
66
|
- name: Generate artifact attestation for sdist and wheel
|
|
68
|
-
uses: actions/attest-build-provenance@
|
|
67
|
+
uses: actions/attest-build-provenance@v4
|
|
69
68
|
with:
|
|
70
69
|
subject-path: dist
|
|
71
70
|
|
|
@@ -26,9 +26,9 @@ jobs:
|
|
|
26
26
|
|
|
27
27
|
steps:
|
|
28
28
|
- uses: actions/checkout@v6
|
|
29
|
-
- uses: prefix-dev/setup-pixi@v0.9.
|
|
29
|
+
- uses: prefix-dev/setup-pixi@v0.9.4
|
|
30
30
|
with:
|
|
31
|
-
pixi-version: v0.
|
|
31
|
+
pixi-version: v0.66.0
|
|
32
32
|
environments: ${{ matrix.environment }}
|
|
33
33
|
activate-environment: ${{ matrix.environment }}
|
|
34
34
|
- name: Run pixi
|
|
@@ -7,7 +7,9 @@ repos:
|
|
|
7
7
|
- id: mixed-line-ending
|
|
8
8
|
args: [--fix=lf]
|
|
9
9
|
- id: check-ast
|
|
10
|
+
exclude: ^docs/examples/notebooks/.*\.py$
|
|
10
11
|
- id: check-builtin-literals
|
|
12
|
+
exclude: ^docs/examples/notebooks/.*\.py$
|
|
11
13
|
- id: check-case-conflict
|
|
12
14
|
- id: check-docstring-first
|
|
13
15
|
- id: check-shebang-scripts-are-executable
|
|
@@ -16,13 +18,16 @@ repos:
|
|
|
16
18
|
- id: check-toml
|
|
17
19
|
- id: check-xml
|
|
18
20
|
- id: check-yaml
|
|
21
|
+
exclude: mkdocs.yml
|
|
19
22
|
- id: debug-statements
|
|
23
|
+
exclude: ^docs/examples/notebooks/.*\.py$
|
|
20
24
|
- id: destroyed-symlinks
|
|
21
25
|
- id: detect-private-key
|
|
22
26
|
- id: end-of-file-fixer
|
|
23
27
|
exclude: ^LICENSE|\.(html|csv|txt|svg|py)$
|
|
24
28
|
- id: pretty-format-json
|
|
25
29
|
args: [--autofix, --no-ensure-ascii, --no-sort-keys]
|
|
30
|
+
exclude: \.ipynb$
|
|
26
31
|
- id: trailing-whitespace
|
|
27
32
|
args: [--markdown-linebreak-ext=md]
|
|
28
33
|
exclude: \.(html|svg)$
|
|
@@ -32,9 +37,17 @@ repos:
|
|
|
32
37
|
hooks:
|
|
33
38
|
- id: ssort
|
|
34
39
|
name: Sort top level statements with ssort
|
|
40
|
+
exclude: ^docs/examples/notebooks/.*\.py$
|
|
41
|
+
|
|
42
|
+
- repo: https://github.com/mwouts/jupytext
|
|
43
|
+
rev: v1.19.1
|
|
44
|
+
hooks:
|
|
45
|
+
- id: jupytext
|
|
46
|
+
entry: jupytext --sync
|
|
47
|
+
files: ^docs/examples/notebooks/
|
|
35
48
|
|
|
36
49
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
37
|
-
rev: v0.
|
|
50
|
+
rev: v0.15.8
|
|
38
51
|
hooks:
|
|
39
52
|
- id: ruff
|
|
40
53
|
name: Linting with Ruff
|
|
@@ -52,7 +65,7 @@ repos:
|
|
|
52
65
|
args: [--max-line-length, '100']
|
|
53
66
|
|
|
54
67
|
- repo: https://github.com/codespell-project/codespell
|
|
55
|
-
rev: v2.4.
|
|
68
|
+
rev: v2.4.2
|
|
56
69
|
hooks:
|
|
57
70
|
- id: codespell
|
|
58
71
|
name: Check common misspellings in text files with codespell.
|
|
@@ -60,7 +73,7 @@ repos:
|
|
|
60
73
|
- tomli
|
|
61
74
|
|
|
62
75
|
- repo: https://github.com/tox-dev/pyproject-fmt
|
|
63
|
-
rev: v2.
|
|
76
|
+
rev: v2.20.0
|
|
64
77
|
hooks:
|
|
65
78
|
- id: pyproject-fmt
|
|
66
79
|
name: Apply a consistent format to pyproject.toml
|
|
@@ -72,7 +85,7 @@ repos:
|
|
|
72
85
|
args: [--autofix, --indent, '2']
|
|
73
86
|
|
|
74
87
|
- repo: https://github.com/rhysd/actionlint
|
|
75
|
-
rev: v1.7.
|
|
88
|
+
rev: v1.7.12
|
|
76
89
|
hooks:
|
|
77
90
|
- id: actionlint
|
|
78
91
|
files: .github/workflows/
|
|
@@ -83,6 +96,11 @@ repos:
|
|
|
83
96
|
hooks:
|
|
84
97
|
- id: mdformat
|
|
85
98
|
additional_dependencies:
|
|
86
|
-
- mdformat-
|
|
99
|
+
- mdformat-mkdocs
|
|
100
|
+
- mdformat-ruff
|
|
101
|
+
- ruff
|
|
102
|
+
- mdformat-config
|
|
87
103
|
- mdformat-toc
|
|
104
|
+
# - mdformat-admon
|
|
88
105
|
args: [--wrap, '88']
|
|
106
|
+
exclude: ^docs/reference/
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. The format is based
|
|
4
|
+
on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to
|
|
5
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [0.3.0] - 2026-03-30
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Add retry with exponential backoff for transient errors
|
|
12
|
+
|
|
13
|
+
## [0.2.1] - 2026-02-09
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Add a new function to check for corrupted download files.
|
|
18
|
+
|
|
19
|
+
## [0.2.0] - 2026-01-30
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- Rewrite all tests using aioresponses.
|
|
24
|
+
- Add support for toggling ssl verification.
|
|
25
|
+
|
|
26
|
+
## [0.1.3] - 2025-02-20
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Change the timeout from session to request level.
|
|
31
|
+
|
|
32
|
+
## [0.1.2] - 2025-02-18
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- Make \_AsyncLoopThread a singleton
|
|
37
|
+
- More robust handling of thread starting/stopping to avoid issues with other threadsafe
|
|
38
|
+
libraries.
|
|
39
|
+
|
|
40
|
+
## [0.1.1] - 2025-02-12
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- Check if the input query parameters that are apssed to aiohttp are valid
|
|
45
|
+
|
|
46
|
+
## [0.1.0] - 2025-02-12
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
|
|
50
|
+
- Add support for passing a single url/kwargs instead of a list.
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- If the input is a single url/kwargs return a response instead of list.
|
|
55
|
+
|
|
56
|
+
### New Contributors
|
|
57
|
+
|
|
58
|
+
- @ made their first contribution
|
|
59
|
+
- @cheginit made their first contribution
|
|
60
|
+
|
|
61
|
+
[0.1.1]: https://github.com/cheginit/tiny-retriever/compare/v0.1.0...v0.1.1
|
|
62
|
+
[0.1.2]: https://github.com/cheginit/tiny-retriever/compare/v0.1.1...v0.1.2
|
|
63
|
+
[0.1.3]: https://github.com/cheginit/tiny-retriever/compare/v0.1.2...v0.1.3
|
|
64
|
+
[0.2.0]: https://github.com/cheginit/tiny-retriever/compare/v0.1.3...v0.2.0
|
|
65
|
+
[0.2.1]: https://github.com/cheginit/tiny-retriever/compare/v0.2.0...v0.2.1
|
|
66
|
+
[0.3.0]: https://github.com/cheginit/tiny-retriever/compare/v0.2.1...v0.3.0
|
|
@@ -20,19 +20,19 @@ include:
|
|
|
20
20
|
- Being respectful of differing opinions, viewpoints, and experiences
|
|
21
21
|
- Giving and gracefully accepting constructive feedback
|
|
22
22
|
- Accepting responsibility and apologizing to those affected by our mistakes, and
|
|
23
|
-
|
|
23
|
+
learning from the experience
|
|
24
24
|
- Focusing on what is best not just for us as individuals, but for the overall community
|
|
25
25
|
|
|
26
26
|
Examples of unacceptable behavior include:
|
|
27
27
|
|
|
28
28
|
- The use of sexualized language or imagery, and sexual attention or advances of any
|
|
29
|
-
|
|
29
|
+
kind
|
|
30
30
|
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
31
31
|
- Public or private harassment
|
|
32
32
|
- Publishing others' private information, such as a physical or email address, without
|
|
33
|
-
|
|
33
|
+
their explicit permission
|
|
34
34
|
- Other conduct which could reasonably be considered inappropriate in a professional
|
|
35
|
-
|
|
35
|
+
setting
|
|
36
36
|
|
|
37
37
|
## Enforcement Responsibilities
|
|
38
38
|
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Contributing to TinyRetriever
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing!
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
1. Install [pixi](https://pixi.sh) and [gh](https://github.com/cli/cli#installation).
|
|
8
|
+
|
|
9
|
+
1. Fork and clone the repository:
|
|
10
|
+
|
|
11
|
+
```console
|
|
12
|
+
git clone git@github.com:your_name_here/tiny-retriever.git
|
|
13
|
+
cd tiny-retriever
|
|
14
|
+
git remote add upstream git@github.com:cheginit/tiny-retriever.git
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
1. Set up the development environments:
|
|
18
|
+
|
|
19
|
+
```console
|
|
20
|
+
pixi install -e dev
|
|
21
|
+
pixi install -e typecheck
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
1. Install pre-commit hooks:
|
|
25
|
+
|
|
26
|
+
```console
|
|
27
|
+
pixi r pcupdate # optionally bump hooks to latest versions first
|
|
28
|
+
pixi r lint # installs hooks and runs them across the repo
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Commit Messages
|
|
32
|
+
|
|
33
|
+
This project uses
|
|
34
|
+
[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). All commit
|
|
35
|
+
messages **must** follow this format:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
<type>[optional scope]: <description>
|
|
39
|
+
|
|
40
|
+
[optional body]
|
|
41
|
+
|
|
42
|
+
[optional footer(s)]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Types
|
|
46
|
+
|
|
47
|
+
| Type | When to use | Changelog section |
|
|
48
|
+
| ---------- | -------------------------------------- | ----------------- |
|
|
49
|
+
| `feat` | A new feature | Added |
|
|
50
|
+
| `fix` | A bug fix | Fixed |
|
|
51
|
+
| `perf` | A performance improvement | Changed |
|
|
52
|
+
| `refactor` | Code restructuring, no behavior change | Changed |
|
|
53
|
+
| `revert` | Reverting a previous commit | Fixed |
|
|
54
|
+
| `docs` | Documentation only | *(skipped)* |
|
|
55
|
+
| `test` | Adding or updating tests | *(skipped)* |
|
|
56
|
+
| `chore` | Maintenance, dependencies, tooling | *(skipped)* |
|
|
57
|
+
| `ci` | CI/CD changes | *(skipped)* |
|
|
58
|
+
| `build` | Build system or external dependencies | *(skipped)* |
|
|
59
|
+
|
|
60
|
+
### Breaking Changes
|
|
61
|
+
|
|
62
|
+
Append `!` after the type, or add `BREAKING CHANGE:` in the footer:
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
feat!: drop support for Python 3.10
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
feat: new API
|
|
70
|
+
|
|
71
|
+
BREAKING CHANGE: `old_function` has been removed.
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Examples
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
feat: add retry with exponential backoff for transient errors
|
|
78
|
+
fix: handle missing Content-Length in download validation
|
|
79
|
+
chore: bump ruff to v0.15.8
|
|
80
|
+
docs: add example notebook for hydrology data
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Running Tests
|
|
84
|
+
|
|
85
|
+
```console
|
|
86
|
+
pixi r -e test310 test # test against Python 3.10
|
|
87
|
+
pixi r -e test314 test # test against Python 3.14
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Linting
|
|
91
|
+
|
|
92
|
+
```console
|
|
93
|
+
pixi r lint
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Type Checking
|
|
97
|
+
|
|
98
|
+
```console
|
|
99
|
+
pixi r typecheck
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Documentation
|
|
103
|
+
|
|
104
|
+
```console
|
|
105
|
+
pixi r -e docs docs-serve # live preview at http://localhost:8000
|
|
106
|
+
pixi r -e docs docs-build # build static site
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Managing the Changelog
|
|
110
|
+
|
|
111
|
+
The changelog is maintained by [git-cliff](https://git-cliff.org) and generated
|
|
112
|
+
automatically from conventional commit messages. You do not need to edit `CHANGELOG.md`
|
|
113
|
+
manually.
|
|
114
|
+
|
|
115
|
+
```console
|
|
116
|
+
pixi r -e dev changelog # preview unreleased changes
|
|
117
|
+
pixi r -e dev changelog-update # write them to CHANGELOG.md
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Submitting Changes
|
|
121
|
+
|
|
122
|
+
1. Create a feature branch from `main`:
|
|
123
|
+
|
|
124
|
+
```console
|
|
125
|
+
git checkout -b bugfix-or-feature/name-of-your-change
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
1. Make your changes with tests. If you are making breaking changes, update the
|
|
129
|
+
documentation and `README.md` as well.
|
|
130
|
+
|
|
131
|
+
1. Fetch the latest upstream and resolve any merge conflicts:
|
|
132
|
+
|
|
133
|
+
```console
|
|
134
|
+
git fetch upstream
|
|
135
|
+
git merge upstream/main
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
1. Ensure all checks pass:
|
|
139
|
+
|
|
140
|
+
```console
|
|
141
|
+
pixi r lint
|
|
142
|
+
pixi r typecheck
|
|
143
|
+
pixi r -e test314 test
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
1. Commit using conventional commits and push:
|
|
147
|
+
|
|
148
|
+
```console
|
|
149
|
+
git add .
|
|
150
|
+
git commit -m "feat: a detailed description of your changes"
|
|
151
|
+
git push origin bugfix-or-feature/name-of-your-change
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
1. Submit a pull request through the GitHub website.
|
|
155
|
+
|
|
156
|
+
## Reporting Bugs
|
|
157
|
+
|
|
158
|
+
Before submitting a bug report, search existing
|
|
159
|
+
[issues](https://github.com/cheginit/tiny-retriever/issues) to avoid duplicates. When
|
|
160
|
+
filing a new issue:
|
|
161
|
+
|
|
162
|
+
- Provide a clear and descriptive title.
|
|
163
|
+
- Describe the expected behavior vs. the actual behavior.
|
|
164
|
+
- Include a minimal reproducible example.
|
|
165
|
+
- Include your Python version, OS, and relevant package versions.
|
|
166
|
+
|
|
167
|
+
> Security-related issues must be reported by email to <cheginit@gmail.com>, not through
|
|
168
|
+
> the public issue tracker.
|
|
169
|
+
|
|
170
|
+
## Suggesting Enhancements
|
|
171
|
+
|
|
172
|
+
Enhancement suggestions are tracked as
|
|
173
|
+
[GitHub issues](https://github.com/cheginit/tiny-retriever/issues). Please check for
|
|
174
|
+
existing suggestions before opening a new one, and explain why the enhancement would be
|
|
175
|
+
useful to the broader user base.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tiny-retriever
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: A synchronous wrapper for AIOHTTP
|
|
5
|
-
Project-URL: Changelog, https://
|
|
5
|
+
Project-URL: Changelog, https://cheginit.github.io/tiny-retriever/CHANGELOG
|
|
6
6
|
Project-URL: CI, https://github.com/cheginit/tiny-retriever/actions
|
|
7
|
-
Project-URL: Homepage, https://tiny-retriever
|
|
7
|
+
Project-URL: Homepage, https://cheginit.github.io/tiny-retriever
|
|
8
8
|
Project-URL: Issues, https://github.com/cheginit/tiny-retriever/issues
|
|
9
9
|
Author-email: Taher Chegini <cheginit@gmail.com>
|
|
10
10
|
License: MIT
|
|
@@ -42,18 +42,21 @@ Requires-Dist: pytest-asyncio; extra == 'dev'
|
|
|
42
42
|
Requires-Dist: rioxarray; extra == 'dev'
|
|
43
43
|
Requires-Dist: shapely>=2; extra == 'dev'
|
|
44
44
|
Provides-Extra: docs
|
|
45
|
-
Requires-Dist:
|
|
46
|
-
Requires-Dist:
|
|
47
|
-
Requires-Dist: mkdocs-jupyter; extra == 'docs'
|
|
48
|
-
Requires-Dist: mkdocs-
|
|
49
|
-
Requires-Dist:
|
|
45
|
+
Requires-Dist: jupytext; extra == 'docs'
|
|
46
|
+
Requires-Dist: mike>=2; extra == 'docs'
|
|
47
|
+
Requires-Dist: mkdocs-jupyter<0.26,>=0.25; extra == 'docs'
|
|
48
|
+
Requires-Dist: mkdocs-materialx; extra == 'docs'
|
|
49
|
+
Requires-Dist: mkdocs>=1.6; extra == 'docs'
|
|
50
|
+
Requires-Dist: mkdocstrings[python]>=0.27; extra == 'docs'
|
|
51
|
+
Requires-Dist: ruff; extra == 'docs'
|
|
52
|
+
Provides-Extra: json
|
|
53
|
+
Requires-Dist: orjson; extra == 'json'
|
|
50
54
|
Provides-Extra: lint
|
|
51
55
|
Requires-Dist: codespell; extra == 'lint'
|
|
52
56
|
Requires-Dist: pre-commit; extra == 'lint'
|
|
53
57
|
Provides-Extra: test
|
|
54
58
|
Requires-Dist: aioresponses; extra == 'test'
|
|
55
59
|
Requires-Dist: coverage[toml]; extra == 'test'
|
|
56
|
-
Requires-Dist: orjson; extra == 'test'
|
|
57
60
|
Requires-Dist: pytest-cov; extra == 'test'
|
|
58
61
|
Requires-Dist: pytest-sugar; extra == 'test'
|
|
59
62
|
Requires-Dist: shapely>=2; extra == 'test'
|
|
@@ -81,7 +84,7 @@ efficient. TinyRetriever is built on top of AIOHTTP and
|
|
|
81
84
|
[AIOFiles](https://github.com/Tinche/aiofiles), which are popular asynchronous HTTP
|
|
82
85
|
client and file management libraries for Python.
|
|
83
86
|
|
|
84
|
-
📚 Full documentation is available [here](https://tiny-retriever
|
|
87
|
+
📚 Full documentation is available [here](https://cheginit.github.io/tiny-retriever).
|
|
85
88
|
|
|
86
89
|
## Features
|
|
87
90
|
|
|
@@ -93,18 +96,21 @@ TinyRetriever provides the following features:
|
|
|
93
96
|
- **Streaming Support**: Stream large files efficiently with customizable chunk sizes
|
|
94
97
|
- **Unique Filenames**: Generate unique filenames based on query parameters
|
|
95
98
|
- **Works in Jupyter Notebooks**: Easily use TinyRetriever in Jupyter notebooks without
|
|
96
|
-
|
|
99
|
+
any additional setup or dependencies
|
|
100
|
+
- **Automatic Retries**: Exponential backoff with jitter for transient errors (5xx, DNS
|
|
101
|
+
failures, timeouts)
|
|
97
102
|
- **Robust Error Handling**: Optional status raising and comprehensive error messages
|
|
98
103
|
- **Performance Optimized**: Uses [`orjson`](https://github.com/ijl/orjson) when
|
|
99
|
-
|
|
104
|
+
available for faster JSON serialization
|
|
100
105
|
|
|
101
106
|
TinyRetriever does not use `nest-asyncio`, instead it creates and manages a dedicated
|
|
102
107
|
thread for running the event loop. This allows you to use TinyRetriever in Jupyter
|
|
103
108
|
notebooks and other environments where the event loop is already running.
|
|
104
109
|
|
|
105
|
-
There are
|
|
110
|
+
There are four main functions in TinyRetriever:
|
|
106
111
|
|
|
107
112
|
- `download`: Download files concurrently;
|
|
113
|
+
- `check_downloads`: Validate existing downloaded files against remote file sizes;
|
|
108
114
|
- `fetch`: Fetch queries concurrently and return responses as text, JSON, or binary;
|
|
109
115
|
- `unique_filename`: Generate unique filenames based on query parameters.
|
|
110
116
|
|
|
@@ -128,8 +134,8 @@ Alternatively, you can use `conda` or `mamba`.
|
|
|
128
134
|
|
|
129
135
|
## Quick Start Guide
|
|
130
136
|
|
|
131
|
-
Please refer to the [documentation](https://tiny-retriever
|
|
132
|
-
usage instructions and more elaborate examples.
|
|
137
|
+
Please refer to the [documentation](https://cheginit.github.io/tiny-retriever) for
|
|
138
|
+
detailed usage instructions and more elaborate examples.
|
|
133
139
|
|
|
134
140
|
### Downloading Files
|
|
135
141
|
|
|
@@ -162,6 +168,18 @@ text_responses = terry.fetch(urls, "text")
|
|
|
162
168
|
binary_responses = terry.fetch(urls, "binary")
|
|
163
169
|
```
|
|
164
170
|
|
|
171
|
+
### Validating Downloads
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
# Check if previously downloaded files match remote sizes
|
|
175
|
+
invalid = terry.check_downloads(urls, paths)
|
|
176
|
+
if invalid:
|
|
177
|
+
for path, expected_size in invalid.items():
|
|
178
|
+
print(f"{path}: local={path.stat().st_size}, expected={expected_size}")
|
|
179
|
+
else:
|
|
180
|
+
print("All files are valid!")
|
|
181
|
+
```
|
|
182
|
+
|
|
165
183
|
### Generate Unique Filenames
|
|
166
184
|
|
|
167
185
|
```python
|
|
@@ -205,20 +223,34 @@ except ServiceError as e:
|
|
|
205
223
|
print(f"Request failed: {e}")
|
|
206
224
|
```
|
|
207
225
|
|
|
226
|
+
### Retry Configuration
|
|
227
|
+
|
|
228
|
+
All functions retry transient errors (5xx, DNS failures, timeouts) automatically with
|
|
229
|
+
exponential backoff and jitter. You can control the number of attempts:
|
|
230
|
+
|
|
231
|
+
```python
|
|
232
|
+
# Retry up to 5 times on transient errors
|
|
233
|
+
terry.fetch(urls, "json", retries=5)
|
|
234
|
+
|
|
235
|
+
# Disable retries
|
|
236
|
+
terry.download(urls, paths, retries=1)
|
|
237
|
+
```
|
|
238
|
+
|
|
208
239
|
## Configuration
|
|
209
240
|
|
|
210
|
-
TinyRetriever can be configured through environment variables:
|
|
241
|
+
TinyRetriever can be configured through environment variables and function parameters:
|
|
211
242
|
|
|
212
243
|
- `MAX_CONCURRENT_CALLS`: Maximum number of concurrent requests (default: 10)
|
|
213
|
-
- Default chunk size for downloads:
|
|
214
|
-
- Default timeout:
|
|
244
|
+
- Default chunk size for downloads: 1 MB
|
|
245
|
+
- Default timeout: 2 minutes for fetch, 10 minutes for download
|
|
215
246
|
- Default connections per host: 4
|
|
247
|
+
- Default retry attempts: 3
|
|
216
248
|
|
|
217
249
|
## Contributing
|
|
218
250
|
|
|
219
251
|
We welcome contributions! Please see the
|
|
220
|
-
[contributing](https://
|
|
221
|
-
|
|
252
|
+
[contributing](https://cheginit.github.io/tiny-retriever/CONTRIBUTING/) section for
|
|
253
|
+
guidelines and instructions.
|
|
222
254
|
|
|
223
255
|
## License
|
|
224
256
|
|