Package: curies
curiesIdiomatic conversion between URIs and compact URIs (CURIEs).importcuriesconverter=curies.load_prefix_map({"CHEBI":"http://purl.obolibrary.org/obo/CHEBI_",# ... and so on})>>>converter.compress("http://purl.obolibrary.org/obo/CHEBI_1")'CHEBI:1'>>>converter.expand("CHEBI:1")'http://purl.obolibrary.org/obo/CHEBI_1'Full documentation is available atcuries.readthedocs.io.CLI UsageThis package comes with a built-in CLI for running a resolver web application or a IRI mapper web application:# Run a resolverpython-mcuriesresolver--host0.0.0.0--port8764bioregistry# Run a mapperpython-mcuriesmapper--host0.0.0.0--port8764bioregistryThe positional argument can be one of the following:A pre-defined prefix map to get from the web (bioregistry, go, obo, monarch, prefixcommons)A local file path or URL to a prefix map, extended prefix map, or one of several formats. Requires specifying
a--format.The framework can be swapped to use Flask (default) or FastAPI with--framework. The
server can be swapped to use Werkzeug (default) or Uvicorn with--server. These functionalities
are also available programmatically, see the docs for more information.🧑‍🤝‍🧑 RelatedOther packages that convert between CURIEs and URIs:https://github.com/prefixcommons/prefixcommons-py(Python)https://github.com/prefixcommons/curie-util(Java)https://github.com/geneontology/curie-util-py(Python)https://github.com/geneontology/curie-util-es5(Node.js)https://github.com/endoli/curie.rs(Rust)https://github.com/cthoyt/curies4j(Java)🚀 InstallationThe most recent release can be installed fromPyPIwith:$pipinstallcuriesThis package currently supports both Pydantic v1 and v2. See thePydantic migration guidefor updating your code.👐 ContributingContributions, whether filing an issue, making a pull request, or forking, are appreciated. SeeCONTRIBUTING.mdfor more information on getting
involved.👋 Attribution🙏 AcknowledgementsThis package heavily builds on thetriedata structure implemented inpytrie.⚖️ 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/curies.git
$cdcuries
$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/curies.git
$cdcuries
$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/curies/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.