orthonym.jars#
Note
Internal API. Names and behaviour may change between releases.
The two Java jars Orthonym uses, and where to find them.
- Orthonym does not ship any jar. It uses two, pinned to one version and one
checksum each, and downloads them from their official releases:
OPSIN 2.9.0 (name -> structure), for the round-trip check of names.
centres 1.2.1, for CIP stereo descriptors.
Resolution order for each jar:
ORTHONYM_OPSIN_JAR/ORTHONYM_CENTRES_JAR– a path to the jar.The jar directory (
ORTHONYM_JAR_DIR, else<cache>/jarswhere<cache>isORTHONYM_CACHE_DIR,$XDG_CACHE_HOME/orthonymor~/.cache/orthonym), if the file there has the pinned checksum.A download into the jar directory, unless
ORTHONYM_NO_DOWNLOAD=1.
A jar that cannot be found is an error (JarUnavailable): naming
without it would silently change names (no OPSIN check, a different CIP
labeller). ORTHONYM_ALLOW_REDUCED=1 opts in to that reduced mode, in which
the finders return None as before.
This module uses only the standard library, so the install-time build hook can load it by file path before Orthonym itself is installed.
- class orthonym.jars.JarSpec(kind: str, version: str, filename: str, url: str, sha256: str, env_var: str)#
Bases:
object- kind: str#
- version: str#
- filename: str#
- url: str#
- sha256: str#
- env_var: str#
Bases:
RuntimeErrorA pinned jar is missing and reduced mode was not requested.
Deliberately NOT an
OrthonymLimitError:Orthonym.nameturns those into ‘unknown organic compound’, and a missing jar must stop the run.
- orthonym.jars.allow_reduced()#
True when the user opted in to naming without the jars.
- orthonym.jars.jar_dir()#
Directory where downloaded jars are kept (not created here).
- orthonym.jars.find_jar(kind, version=None, download=True)#
Absolute path to the pinned
kindjar (‘opsin’ or ‘centres’).A
versionother than the pinned one returnsNone(only pinned, checksummed jars are ever used). The outcome – a path or a failure – is resolved once per process and then reused, so a run never switches mode half-way. On failure: raises:class:JarUnavailable, or returnsNonewhenORTHONYM_ALLOW_REDUCED=1.
- orthonym.jars.require_all()#
Raise:class:JarUnavailable unless every pinned jar is available (or reduced mode was requested). Called once when a namer is created.
- orthonym.jars.fetch_all(verbose=True)#
Download (if needed) and verify every pinned jar; return kind -> path.
Ignores
ORTHONYM_NO_DOWNLOADand reduced mode: this is the explicit fetch. Raises:class:JarUnavailable on the first failure.