Skip to content

Commit 53280f8

Browse files
vani2009dependabot[bot]cooperleespre-commit-ci[bot]
authored
Docs: add troubleshooting for Simple API JSON mirroring (#2145)
* Docs: add troubleshooting for Simple API JSON mirroring * Build(deps): Bump s3path from 0.6.4 to 0.6.5 (#2147) Bumps [s3path](https://github.com/liormizr/s3path) from 0.6.4 to 0.6.5. - [Release notes](https://github.com/liormizr/s3path/releases) - [Commits](liormizr/s3path@0.6.4...0.6.5) --- updated-dependencies: - dependency-name: s3path dependency-version: 0.6.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Build(deps): Bump packaging from 25.0 to 26.0 (#2146) Bumps [packaging](https://github.com/pypa/packaging) from 25.0 to 26.0. - [Release notes](https://github.com/pypa/packaging/releases) - [Changelog](https://github.com/pypa/packaging/blob/main/CHANGELOG.rst) - [Commits](pypa/packaging@25.0...26.0) --- updated-dependencies: - dependency-name: packaging dependency-version: '26.0' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cooper Lees <me@cooperlees.com> * Build(deps): Bump coverage from 7.13.2 to 7.13.3 (#2148) Bumps [coverage](https://github.com/coveragepy/coveragepy) from 7.13.2 to 7.13.3. - [Release notes](https://github.com/coveragepy/coveragepy/releases) - [Changelog](https://github.com/coveragepy/coveragepy/blob/main/CHANGES.rst) - [Commits](coveragepy/coveragepy@7.13.2...7.13.3) --- updated-dependencies: - dependency-name: coverage dependency-version: 7.13.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cooper Lees <me@cooperlees.com> * Build(deps): Bump setuptools from 80.10.2 to 82.0.0 (#2149) Bumps [setuptools](https://github.com/pypa/setuptools) from 80.10.2 to 82.0.0. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](pypa/setuptools@v80.10.2...v82.0.0) --- updated-dependencies: - dependency-name: setuptools dependency-version: 82.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cooper Lees <me@cooperlees.com> * Build(deps): Bump boto3 from 1.42.40 to 1.42.44 (#2150) * Build(deps): Bump boto3 from 1.42.40 to 1.42.44 Bumps [boto3](https://github.com/boto/boto3) from 1.42.40 to 1.42.44. - [Release notes](https://github.com/boto/boto3/releases) - [Commits](boto/boto3@1.42.40...1.42.44) --- updated-dependencies: - dependency-name: boto3 dependency-version: 1.42.44 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Update botocore version to 1.42.44 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cooper Lees <me@cooperlees.com> * Docs: add missing changelog fragment * Docs: address review — correct master URL, add PEP 691, JSON requirements, and fail-fast behavior * Docs: link mirror-from-mirror Simple API guide in main index * Docs: finalize review — fix PEP wording and add HTML fallback note * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Docs: add changelog fragment for mirror-from-mirror JSON docs * Add changelog entry for docs: Simple API JSON troubleshooting * Add CHANGES.md entry for PR #2145 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Move changelog entry to Unreleased and remove unused changelog.d file * chore: remove newsfragments files per review * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cooper Lees <me@cooperlees.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 647ba9e commit 53280f8

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Unreleased
2+
3+
## Documentation
4+
5+
- Docs: add troubleshooting for Simple API JSON mirroring `PR #2145`
6+
17
# 7.1.0
28

39
## New Features

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ Contents
4343
serving
4444
CONTRIBUTING
4545
modules
46+
mirror_from_mirror_simple_api
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
Mirror from a mirror (Simple API)
2+
=================================
3+
4+
Bandersnatch can mirror packages from another Python package index that
5+
implements the Simple Repository API (PEP 503 + 691). This allows you
6+
to create a secondary mirror from an existing mirror instead of directly
7+
from PyPI.
8+
9+
Configuration
10+
-------------
11+
12+
Set the ``master`` option in your bandersnatch configuration to the **base
13+
URL** of the upstream mirror.
14+
15+
Example::
16+
17+
[mirror]
18+
master = https://example-mirror.org
19+
20+
Bandersnatch automatically appends ``/simple`` to the configured
21+
``master`` URL.
22+
23+
Requirements
24+
------------
25+
26+
The upstream mirror must support:
27+
28+
- The Simple Repository API with **PEP 691 JSON responses**
29+
(``Accept: application/vnd.pypi.simple.v1+json``)
30+
- The PyPI JSON metadata endpoint:
31+
``/pypi/<project>/json``
32+
33+
Bandersnatch requires JSON responses for correct mirroring.
34+
35+
Notes
36+
-----
37+
38+
- Some mirrors may have partial content or different filtering rules.
39+
- Synchronization speed depends on the upstream mirror performance.
40+
- If the upstream serves only HTML Simple API (PEP 503) and not JSON, mirroring will fail (no automatic fallback).
41+
42+
43+
JSON vs HTML behavior
44+
---------------------
45+
46+
Bandersnatch **only supports the JSON Simple API (PEP 691)**.
47+
48+
If the upstream mirror serves only HTML (PEP 503) and does not provide
49+
JSON responses, bandersnatch will **fail fast** instead of falling back
50+
to HTML parsing.
51+
52+
Use cases
53+
---------
54+
55+
- Creating an internal mirror from an organizational mirror
56+
- Reducing load on PyPI by chaining mirrors
57+
- Regional or offline mirror setups
58+
59+
Troubleshooting
60+
---------------
61+
62+
Bandersnatch 7.0+ uses the PEP 691 Simple API JSON format when available.
63+
64+
If the upstream mirror does not return JSON and instead serves HTML,
65+
bandersnatch may fail with errors such as:
66+
67+
aiohttp.client_exceptions.ContentTypeError:
68+
Attempt to decode JSON with unexpected mimetype: text/html
69+
70+
To verify JSON support, check:
71+
72+
- The ``/simple/`` endpoint responds with JSON when requested with:
73+
74+
Accept: application/vnd.pypi.simple.v1+json
75+
76+
- The response ``Content-Type`` is:
77+
78+
application/vnd.pypi.simple.v1+json

0 commit comments

Comments
 (0)