pkgreach 0.0.2__tar.gz → 0.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.
- {pkgreach-0.0.2 → pkgreach-0.0.3}/PKG-INFO +1 -1
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/platforms/pypi.py +11 -1
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pyproject.toml +1 -1
- {pkgreach-0.0.2 → pkgreach-0.0.3}/tests/test_pkgreach.py +13 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/.gitattributes +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/.gitignore +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/LICENSE +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/README.md +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/action.yml +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/__init__.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/__main__.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/analyze.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/collect.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/config.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/http.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/platforms/__init__.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/platforms/crates.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/platforms/ecosystems.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/platforms/github.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/platforms/npm.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/report.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/scaffold.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/tables.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach/tools.py +0 -0
- {pkgreach-0.0.2 → pkgreach-0.0.3}/pkgreach.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pkgreach
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: Track how your packages are really used across PyPI, npm, crates.io and GitHub: downloads against a noise floor, dependents, stars; a weekly GitHub Action keeps the history and publishes a report.
|
|
5
5
|
Project-URL: Homepage, https://github.com/thorwhalen/pkgreach
|
|
6
6
|
Project-URL: Repository, https://github.com/thorwhalen/pkgreach
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
pure noise. Older days are gone: hence a history kept weekly.
|
|
9
9
|
- **Metadata**: ``pypi.org/pypi/{name}/json`` (latest version, summary, source
|
|
10
10
|
repository, first upload, number of releases).
|
|
11
|
+
|
|
12
|
+
A package pypistats does not know yet (published in the last day or two, or
|
|
13
|
+
never downloaded) answers 404 there: that reads as no downloads, not an error.
|
|
11
14
|
"""
|
|
12
15
|
|
|
13
16
|
from __future__ import annotations
|
|
@@ -17,6 +20,8 @@ import xmlrpc.client
|
|
|
17
20
|
from collections.abc import Iterator
|
|
18
21
|
from datetime import date
|
|
19
22
|
|
|
23
|
+
from pkgreach.http import HttpError
|
|
24
|
+
|
|
20
25
|
XMLRPC_URL = "https://pypi.org/pypi"
|
|
21
26
|
STATS_URL = "https://pypistats.org/api/packages/{name}/overall"
|
|
22
27
|
JSON_URL = "https://pypi.org/pypi/{name}/json"
|
|
@@ -50,7 +55,12 @@ def _repository(info: dict) -> str:
|
|
|
50
55
|
def fetch(record: dict, *, http, today: date, since: date | None = None) -> dict:
|
|
51
56
|
"""Daily downloads (both series), versions, and metadata of one package."""
|
|
52
57
|
name = record["package"]
|
|
53
|
-
|
|
58
|
+
try:
|
|
59
|
+
stats = http(STATS_URL.format(name=name)).get("data", [])
|
|
60
|
+
except HttpError as e:
|
|
61
|
+
if e.status != 404:
|
|
62
|
+
raise
|
|
63
|
+
stats = [] # pypistats has no row yet: a new or never-downloaded package
|
|
54
64
|
lo = since.isoformat() if since else ""
|
|
55
65
|
downloads = [
|
|
56
66
|
{"date": r["date"], "series": SERIES[r["category"]], "count": r["downloads"]}
|
|
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "pkgreach"
|
|
9
|
-
version = "0.0.
|
|
9
|
+
version = "0.0.3"
|
|
10
10
|
description = "Track how your packages are really used across PyPI, npm, crates.io and GitHub: downloads against a noise floor, dependents, stars; a weekly GitHub Action keeps the history and publishes a report."
|
|
11
11
|
readme = "README.md"
|
|
12
12
|
requires-python = ">=3.11"
|
|
@@ -317,3 +317,16 @@ def test_named_packages_bypass_where_and_unlisted_are_pruned(tmp_path):
|
|
|
317
317
|
)
|
|
318
318
|
for t in ("packages", "metrics"):
|
|
319
319
|
assert "b" not in {r["package"] for r in read_table(store, TABLES[t])}
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def test_pypi_package_unknown_to_pypistats_is_not_an_error():
|
|
323
|
+
from pkgreach.http import HttpError
|
|
324
|
+
from pkgreach.platforms import pypi
|
|
325
|
+
|
|
326
|
+
def http(url, **kw):
|
|
327
|
+
if "pypistats" in url:
|
|
328
|
+
raise HttpError(404, "Not Found", url=url)
|
|
329
|
+
return {"info": {"version": "0.1", "summary": "s"}, "releases": {"0.1": []}}
|
|
330
|
+
|
|
331
|
+
got = pypi.fetch({"package": "new-pkg"}, http=http, today=TODAY)
|
|
332
|
+
assert got["downloads"] == [] and got["info"]["latest_version"] == "0.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|