Bioversions
Bioversions is a Python library (current version 0.8.324) that provides programmatic access to the current version numbers for a wide array of biological databases. It aims to simplify the integration of up-to-date database versions into bioinformatics workflows and tools. The library actively maintains and daily updates a static listing of these versions, reflecting a frequent release cadence for its internal data, while the library itself sees regular patch updates.
Common errors
-
ModuleNotFoundError: No module named 'bioversions'
cause The `bioversions` package has not been installed in the current Python environment.fixRun `pip install bioversions` to install the library. -
AssertionError: This was true on Dec 5th, 2020!
cause This specific assertion, often found in older documentation or copied from examples, fails because the actual version of the biological database (e.g., BioGRID) has since been updated, as `bioversions` correctly reflects the current version.fixUpdate your assertions to reflect the current expected version, or use `bioversions.get_version()` dynamically in your tests without hardcoding a specific version string, if appropriate for your test's intent. -
KeyError: 'some_nonexistent_database'
cause Attempted to retrieve a version for a database name that `bioversions` does not recognize or that is misspelled.fixVerify the correct spelling and availability of the database name by checking the `bioversions` documentation or by iterating through `bioversions.iter_versions()` to see supported names.
Warnings
- gotcha The versions returned by `bioversions` are dynamic and reflect the current state of external biological databases. Hardcoding specific version strings in tests or logic will eventually lead to `AssertionError` or incorrect behavior as databases update.
- gotcha Results are cached locally (default: `~/.data/bioversions`) and refreshed only once per day. If you need immediate updates or are debugging, ensure to consider the cache's daily refresh cycle.
- gotcha The default cache location (`~/.data/bioversions`) can be inconvenient in some environments. While the library is generally stable, its dependence on external databases means their internal APIs or naming conventions might change, potentially affecting the accuracy of retrieved versions.
Install
-
pip install bioversions
Imports
- bioversions
import bioversions
Quickstart
import bioversions
# Get the current version for a specific database (e.g., BioGRID)
biogrid_version = bioversions.get_version('biogrid')
print(f"Current BioGRID version: {biogrid_version}")
# Get more detailed information using resolve()
bioversion_obj = bioversions.resolve('biogrid')
print(f"BioGRID version object: {bioversion_obj.version} (updated {bioversion_obj.date})")