On this page
Registry version query functions for npm, PyPI, and the Go proxy, returning the latest published version for name availability and dependency checks.
#rlsbl.registry
#rlsbl.registry
Registry version query functions for npm, PyPI, and the Go proxy, returning the latest published version for name availability and dependency checks.
#query_npm_version
def query_npm_version(name)Query the npm registry for the latest version of a package.
Returns {"status": "found", "version": "X.Y.Z"} on success, {"status": "not_found"} if the package does not exist, or {"status": "error", "message": "..."} on failure.
#query_pypi_version
def query_pypi_version(name)Query PyPI for the latest version of a package.
Returns {"status": "found", "version": "X.Y.Z"} on success, {"status": "not_found"} if the package does not exist, or {"status": "error", "message": "..."} on failure.
#query_pypi_release
def query_pypi_release(name, version)Ask PyPI whether ONE specific version of a package is published.
query_pypi_version answers "what is the latest?", which cannot decide whether an older or a just-locked version exists on the index. This one reads the per-release endpoint instead.
Returns {"status": "found"} when the release exists, {"status": "not_found"} when the package or that version does not, or {"status": "error", "message": "..."} on failure. Callers that must be certain treat "error" as a refusal, never as absence.
#query_go_version
def query_go_version(module_path)Query the Go module proxy for the latest version of a module.
Returns {"status": "found", "version": "X.Y.Z"} on success (v prefix stripped), {"status": "not_found"} if the module does not exist, or {"status": "error", "message": "..."} on failure.
The path is escaped the way the proxy demands (see :func:escape_module_path), exactly as :func:query_go_mod does: an unescaped uppercase letter names a module the proxy does not serve, and its 404 would read as "never published" for a module that is.
#escape_module_path
def escape_module_path(module_path)Encode a module path the way the Go module proxy demands.
The proxy's URL space is case-insensitive, so every uppercase letter is written as ! plus its lowercase form. A path sent unescaped resolves to a different (usually absent) module, which would read as "never published" for a module that is published.
#query_go_mod
def query_go_mod(module_path, version)Fetch one version's go.mod text from the Go module proxy.
Returns {"status": "found", "text": "..."}, {"status": "not_found"} when the proxy has no such module or version, or {"status": "error", "message": "..."}. A caller that must be certain treats "error" as a refusal to answer, never as absence.
#go_mod_deprecation
def go_mod_deprecation(text)The deprecation message a go.mod states, or None.
Go's own rule, applied exactly: the notice is a // Deprecated: comment in the comment block IMMEDIATELY BEFORE the module directive, or a comment on the same line. A // Deprecated: anywhere else in the file (inside a retract block, say) deprecates that thing, not the module, so it is deliberately not read here.
#query_go_module_deprecation
def query_go_module_deprecation(module_path)Does the module proxy serve a deprecation notice for module_path?
Two reads: the latest version, then that version's go.mod. Returns {"status": "deprecated", "version": v, "message": m}, {"status": "not_deprecated", "version": v}, {"status": "not_found"} when the module was never published, or {"status": "error", "message": ...}.
#query_registry_version
def query_registry_version(name, registry)Query a registry for the latest version of a package.
The registry argument is a TARGET NAME, and the target answers: each one that has a version API overrides query_latest_version, and the base implementation answers Unknown registry for the rest. This replaced a hand-maintained dispatch dict that had to be edited alongside the target registry and could silently disagree with it.
Returns {"status": "found", "version": "X.Y.Z"} on success, {"status": "not_found"} if the package does not exist, {"status": "error", "message": "..."} on failure, or {"status": "error", "message": "Unknown registry: ..."} for unrecognized registry names.