Package: fairsharing-client
FAIRsharing ClientA client to theFAIRsharing API.💪 Getting StartedFAIRsharing is a registry of high-quality metadata about standards, databases,
and policies. However, there are two aspects to FAIRsharing's data that make it
difficult to use:It's licensed under the restrictiveCC-BY-SA 4.0license (
seehttps://fairsharing.org/licence). This makes it difficult to redistribute
the data, even in part. Better options for community reuse areCC-BY 4.0or
ideallyCC0. However, keep in mind that FAIR and Open are emphaticallynot the same thing.Instead of offering a bulk download, there is an API that requires
authentication usingJWT.While there's nothing wrong with JWT, it requires several steps that make
programmatic access inconvenient for less seasoned programmers.
Thefairsharing_clientpackage provides a way to automatically bulk download
all contents from the API and store them locally in a reproducible way, so you
can write code that relies on FAIRsharing data without having to worry about how
to interact with its API nor redistribute its data yourself. Further,
this package does some preprocessing on the content to make it more useful.importfairsharing_clientasfc# Download the data and return the path of the YAML file# This takes about 4 minutes and gets around 4K records.path=fc.ensure_fairsharing()# Download the data and open it for usedata=fc.load_fairsharing()# Get data for a given recordchebi_record=data["FAIRsharing.62qk8w"]There are a few ways to do authentication:Envionment Variables: set theFAIRSHARING_LOGINandFAIRSHARING_PASSWORDenvionrment variablesConfiguration: in the~/.config/fairshairing.inifile, add the
following configuration:[fairsharing]login=cthoyt@gmail.compassword=...Keyword arguments: pass theloginandpasswordkeywords to either of
the example functions.A reminder: this repository does NOT redistribute FAIRsharing's data, it only
provides code for you to get it yourself.🚀 InstallationThe most recent release can be installed fromPyPIwith:$pipinstallfairsharing_clientThe most recent code and data can be installed directly from GitHub with:$pipinstallgit+https://github.com/cthoyt/fairsharing-client.git👐 ContributingContributions, whether filing an issue, making a pull request, or forking, are
appreciated. SeeCONTRIBUTING.mdfor more information on getting involved.👋 Attribution⚖️ LicenseThe code in this package is licensed under the MIT License.🍪 CookiecutterThis package was created
with@audreyfeldroy'scookiecutterpackage
using@cthoyt'scookiecutter-snekpacktemplate.🛠️ For DevelopersSee developer instructionsThe final section of the README is for if you want to get involved by making a
code contribution.Development InstallationTo install in development mode, use the following:$gitclonegit+https://github.com/cthoyt/fairsharing-client.git
$cdfairsharing-client
$pipinstall-e.🥼 TestingAfter cloning the repository and installingtoxwithpip install tox, the
unit tests in thetests/folder can be run reproducibly with:$toxAdditionally, these tests are automatically re-run with each commit in
aGitHub Action.📖 Building the DocumentationThe documentation can be built locally using the following:$gitclonegit+https://github.com/cthoyt/fairsharing-client.git
$cdfairsharing-client
$tox-edocs
$opendocs/build/html/index.htmlThe documentation automatically installs the package as well as thedocsextra specified in thesetup.cfg.sphinxplugins liketexextcan be added there. Additionally, they need to be added to theextensionslist indocs/source/conf.py.📦 Making a ReleaseAfter installing the package in development mode and installingtoxwithpip install tox, the commands for making a new release are
contained within thefinishenvironment intox.ini. Run the following from
the shell:$tox-efinishThis script does the following:UsesBump2Versionto switch the
version number in thesetup.cfg,src/fairsharing_client/version.py,
anddocs/source/conf.pyto not have the-devsuffixPackages the code in both a tar archive and a wheel
usingbuildUploads to PyPI usingtwine. Be sure to
have a.pypircfile configured to avoid the need for manual input at this
stepPush to GitHub. You'll need to make a release going with the commit where the
version was bumped.Bump the version to the next patch. If you made big changes and want to bump
the version by minor, you can usetox -e bumpversion minorafter.