Version
*******

exception psynet.version.VersionMismatchError(message)

   Bases: "ClickException", "ValueError"

   The installed PsyNet or Dallinger does not match its pin; click
   shows it without a traceback.

psynet.version.check_core_dependency_versions_match_requirements(skip=())

   Check that the installed PsyNet and Dallinger match the versions
   the deployment installs.

   Each package is compared with its exact pin in "requirements.txt"
   or, failing that, "constraints.txt" (where "psynet setup" pins
   Dallinger). One line per package reports what was compared.

   Parameters:
      **skip** (*collection** of **str*) -- Lowercase names of
      packages (""psynet"", ""dallinger"") not to check.

   Raises:
      **VersionMismatchError** -- If any specified package version
      does not match the installed version.

psynet.version.check_installed_dallinger_version_is_recommended()

   Warn or abort if the installed Dallinger version is not the
   recommended one.

psynet.version.collect_core_dependency_version_info_from_requirements(file_content, skip=(), constraints_content=None)

   Compare the PsyNet and Dallinger pins with the installed versions.

   Parameters:
      * **file_content** (*str*) -- Contents of a requirements.txt
        file.

      * **skip** (*collection** of **str*) -- Lowercase names of
        packages not to check; they are omitted from the result
        without their installed version being looked up.

      * **constraints_content** (*str**, **optional*) -- Contents of
        constraints.txt, consulted for packages that requirements.txt
        does not pin exactly.

   Returns:
      Mapping of package name to a dict containing "specified",
      "installed", "source" (the file the pin came from), "status"
      ("consistent", "inconsistent", or "skipped"), and optional
      "skip_reason" and "warning" messages.

   Return type:
      dict

   Raises:
      **ValueError** -- If a commit pin is checked against an editable
      install whose     Git commit cannot be determined.

psynet.version.get_installed_commit_or_version(package_name)

   Return the installed Git commit of a package, or its version.

   Inspects the running interpreter's distribution metadata rather
   than whatever "pip" is on "PATH". VCS installs report the commit
   recorded in PEP 610 "direct_url.json"; editable installs report the
   current "HEAD" of the Git checkout they point at (uncommitted
   changes are not reflected). Other installs report the version
   string.

   Parameters:
      **package_name** (*str*) -- Distribution name, e.g. ""PsyNet""
      or ""Dallinger"".

   Returns:
      A 40-character commit hash or a version string.

   Return type:
      str

   Raises:
      **ValueError** -- If the package is not installed, or is
      installed editable from a     directory that is not the root of
      a readable Git checkout.

psynet.version.get_installed_version_for_package(package_name)

   Return the installed version string for PsyNet or Dallinger.

psynet.version.is_development_version(version)

   Check whether a version string is a development version.

   A development version is defined as three numbers
   (major.minor.patch) followed by a letter and then numbers, e.g.
   "13.2.0a0a0".

   Parameters:
      **version** (*str*) -- Version string to check

   Returns:
      True if the version is a development version, False otherwise

   Return type:
      bool

psynet.version.is_release_version_specifier(specified)

   Return whether a requirement pins a release version rather than a
   branch or commit.

   Release pins are stable or release-candidate versions, with or
   without a leading "v" ("v14.0.0", "14.0.0rc2"). Alpha versions are
   never tagged, and branch names that merely start with "v" (e.g.
   "vocal-fixes") are not release pins.

psynet.version.is_version_greater(x, y, strict=True)

   Returns True if version number x is (strictly) greater than version
   number y.

psynet.version.parse_version_triplet(x)

   Parse a version string into a (major, minor, patch) integer tuple.

psynet.version.specified_version(requirement)

   Return the version, tag or commit that a requirement line pins.

   Handles Git requirements
   ("...@git+https://host/repo@<ref>#egg=psynet", whatever the
   repository is called) and standard ones ("psynet==10.0.0"). A bare
   package name is returned unchanged.

psynet.version.spinner(text)

   Return a green yaspin spinner on a terminal, or a no-op context
   manager otherwise.

   Off a terminal the context manager yields "None", so callers must
   check before calling "ok" or "fail".
