{"id":21731105,"url":"https://github.com/biopragmatics/curies","last_synced_at":"2025-04-07T12:05:26.895Z","repository":{"id":50710065,"uuid":"519905487","full_name":"biopragmatics/curies","owner":"biopragmatics","description":"🐸 Idiomatic conversion between URIs and compact URIs (CURIEs) in Python","archived":false,"fork":false,"pushed_at":"2025-03-25T17:52:41.000Z","size":716,"stargazers_count":22,"open_issues_count":10,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-31T11:01:42.248Z","etag":null,"topics":["curies","obofoundry","semantic-web","uris"],"latest_commit_sha":null,"homepage":"https://curies.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/biopragmatics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"cthoyt"}},"created_at":"2022-07-31T23:03:16.000Z","updated_at":"2025-03-25T17:52:44.000Z","dependencies_parsed_at":"2023-02-15T22:15:34.858Z","dependency_job_id":"c9b69971-c747-4f75-a2f7-e97624a4cf40","html_url":"https://github.com/biopragmatics/curies","commit_stats":{"total_commits":199,"total_committers":6,"mean_commits":"33.166666666666664","dds":0.03015075376884424,"last_synced_commit":"470f71a69264c17260823d485de113695076a38f"},"previous_names":["cthoyt/curies"],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biopragmatics%2Fcuries","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biopragmatics%2Fcuries/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biopragmatics%2Fcuries/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biopragmatics%2Fcuries/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biopragmatics","download_url":"https://codeload.github.com/biopragmatics/curies/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648976,"owners_count":20972945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["curies","obofoundry","semantic-web","uris"],"created_at":"2024-11-26T04:19:47.706Z","updated_at":"2025-04-07T12:05:26.865Z","avatar_url":"https://github.com/biopragmatics.png","language":"Python","funding_links":["https://github.com/sponsors/cthoyt"],"categories":[],"sub_categories":[],"readme":"\u003c!--\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/biopragmatics/curies/raw/main/docs/source/logo.png\" height=\"150\"\u003e\n\u003c/p\u003e\n--\u003e\n\n\u003ch1 align=\"center\"\u003e\n  CURIEs\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/biopragmatics/curies/actions/workflows/tests.yml\"\u003e\n        \u003cimg alt=\"Tests\" src=\"https://github.com/biopragmatics/curies/actions/workflows/tests.yml/badge.svg\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/curies\"\u003e\n        \u003cimg alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/curies\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/curies\"\u003e\n        \u003cimg alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/curies\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/biopragmatics/curies/blob/main/LICENSE\"\u003e\n        \u003cimg alt=\"PyPI - License\" src=\"https://img.shields.io/pypi/l/curies\" /\u003e\u003c/a\u003e\n    \u003ca href='https://curies.readthedocs.io/en/latest/?badge=latest'\u003e\n        \u003cimg src='https://readthedocs.org/projects/curies/badge/?version=latest' alt='Documentation Status' /\u003e\u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/biopragmatics/curies/branch/main\"\u003e\n        \u003cimg src=\"https://codecov.io/gh/biopragmatics/curies/branch/main/graph/badge.svg\" alt=\"Codecov status\" /\u003e\u003c/a\u003e  \n    \u003ca href=\"https://github.com/cthoyt/cookiecutter-python-package\"\u003e\n        \u003cimg alt=\"Cookiecutter template from @cthoyt\" src=\"https://img.shields.io/badge/Cookiecutter-snekpack-blue\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/astral-sh/ruff\"\u003e\n        \u003cimg src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\" alt=\"Ruff\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/biopragmatics/curies/blob/main/.github/CODE_OF_CONDUCT.md\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg\" alt=\"Contributor Covenant\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://zenodo.org/badge/latestdoi/519905487\"\u003e\n        \u003cimg src=\"https://zenodo.org/badge/519905487.svg\" alt=\"DOI\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nIdiomatic conversion between URIs and compact URIs (CURIEs).\n\n```python\nimport curies\n\nconverter = curies.load_prefix_map({\n    \"CHEBI\": \"http://purl.obolibrary.org/obo/CHEBI_\",\n    # ... and so on\n})\n\n\u003e\u003e\u003e converter.compress(\"http://purl.obolibrary.org/obo/CHEBI_1\")\n'CHEBI:1'\n\n\u003e\u003e\u003e converter.expand(\"CHEBI:1\")\n'http://purl.obolibrary.org/obo/CHEBI_1'\n```\n\nFull documentation is available at\n[curies.readthedocs.io](https://curies.readthedocs.io).\n\n### CLI Usage\n\nThis package comes with a built-in CLI for running a resolver web application or\na IRI mapper web application:\n\n```shell\n# Run a resolver\npython -m curies resolver --host 0.0.0.0 --port 8764 bioregistry\n\n# Run a mapper\npython -m curies mapper --host 0.0.0.0 --port 8764 bioregistry\n```\n\nThe positional argument can be one of the following:\n\n1. A pre-defined prefix map to get from the web (bioregistry, go, obo, monarch,\n   prefixcommons)\n2. A local file path or URL to a prefix map, extended prefix map, or one of\n   several formats. Requires specifying a `--format`.\n\nThe framework can be swapped to use Flask (default) or FastAPI with\n`--framework`. The server can be swapped to use Werkzeug (default) or Uvicorn\nwith `--server`. These functionalities are also available programmatically, see\nthe docs for more information.\n\n## 🧑‍🤝‍🧑 Related\n\nOther packages that convert between CURIEs and URIs:\n\n- https://github.com/prefixcommons/prefixcommons-py (Python)\n- https://github.com/prefixcommons/curie-util (Java)\n- https://github.com/geneontology/curie-util-py (Python)\n- https://github.com/geneontology/curie-util-es5 (Node.js)\n- https://github.com/endoli/curie.rs (Rust)\n- https://github.com/cthoyt/curies4j (Java)\n- https://github.com/biopragmatics/curies.rs (Rust, Node.js, Python)\n\n## 🚀 Installation\n\nThe most recent release can be installed from\n[PyPI](https://pypi.org/project/curies/) with:\n\n```console\npython3 -m pip install curies\n```\n\nAs of v0.8, this package only supports Pydantic v2. v0.6.x and v0.7.x had\ncross-version support for Pydantic v1 and v2. v0.5.x and before only supported\nPydantic v1. See the\n[Pydantic migration guide](https://docs.pydantic.dev/2.0/migration/) for\nupdating your code.\n\n## 👐 Contributing\n\nContributions, whether filing an issue, making a pull request, or forking, are\nappreciated. See\n[CONTRIBUTING.md](https://github.com/biopragmatics/curies/blob/master/.github/CONTRIBUTING.md)\nfor more information on getting involved.\n\n## 👋 Attribution\n\n### 🙏 Acknowledgements\n\nThis package heavily builds on the [trie](https://en.wikipedia.org/wiki/Trie)\ndata structure implemented in [`pytrie`](https://github.com/gsakkis/pytrie).\n\n### ⚖️ License\n\nThe code in this package is licensed under the MIT License.\n\n### 🍪 Cookiecutter\n\nThis package was created with\n[@audreyfeldroy](https://github.com/audreyfeldroy)'s\n[cookiecutter](https://github.com/cookiecutter/cookiecutter) package using\n[@cthoyt](https://github.com/cthoyt)'s\n[cookiecutter-snekpack](https://github.com/cthoyt/cookiecutter-snekpack)\ntemplate.\n\n## 🛠️ For Developers\n\n\u003cdetails\u003e\n  \u003csummary\u003eSee developer instructions\u003c/summary\u003e\n\nThe final section of the README is for if you want to get involved by making a\ncode contribution.\n\n### Development Installation\n\nTo install in development mode, use the following:\n\n```console\n$ git clone git+https://github.com/biopragmatics/curies.git\n$ cd curies\n$ uv --preview pip install -e .\n```\n\nAlternatively, install using legacy pip with `UV_PREVIEW` mode enabled until the\nuv build backend becomes a stable feature:\n\n```console\n$ UV_PREVIEW=1 python3 -m pip install -e .\n```\n\n### Updating Package Boilerplate\n\nThis project uses `cruft` to keep boilerplate (i.e., configuration, contribution\nguidelines, documentation configuration) up-to-date with the upstream\ncookiecutter package. Update with the following:\n\n```console\npython3 -m pip install cruft\ncruft update\n```\n\nMore info on Cruft's update command is available\n[here](https://github.com/cruft/cruft?tab=readme-ov-file#updating-a-project).\n\n### 🥼 Testing\n\nAfter cloning the repository and installing `tox` with\n`python3 -m pip install tox tox-uv`, the unit tests in the `tests/` folder can\nbe run reproducibly with:\n\n```console\ntox -e py\n```\n\nAdditionally, these tests are automatically re-run with each commit in a\n[GitHub Action](https://github.com/biopragmatics/curies/actions?query=workflow%3ATests).\n\n### 📖 Building the Documentation\n\nThe documentation can be built locally using the following:\n\n```console\ngit clone git+https://github.com/biopragmatics/curies.git\ncd curies\ntox -e docs\nopen docs/build/html/index.html\n```\n\nThe documentation automatically installs the package as well as the `docs` extra\nspecified in the [`pyproject.toml`](pyproject.toml). `sphinx` plugins like\n`texext` can be added there. Additionally, they need to be added to the\n`extensions` list in [`docs/source/conf.py`](docs/source/conf.py).\n\nThe documentation can be deployed to [ReadTheDocs](https://readthedocs.io) using\n[this guide](https://docs.readthedocs.io/en/stable/intro/import-guide.html). The\n[`.readthedocs.yml`](.readthedocs.yml) YAML file contains all the configuration\nyou'll need. You can also set up continuous integration on GitHub to check not\nonly that Sphinx can build the documentation in an isolated environment (i.e.,\nwith `tox -e docs-test`) but also that\n[ReadTheDocs can build it too](https://docs.readthedocs.io/en/stable/pull-requests.html).\n\n#### Configuring ReadTheDocs\n\n1. Log in to ReadTheDocs with your GitHub account to install the integration at\n   https://readthedocs.org/accounts/login/?next=/dashboard/\n2. Import your project by navigating to https://readthedocs.org/dashboard/import\n   then clicking the plus icon next to your repository\n3. You can rename the repository on the next screen using a more stylized name\n   (i.e., with spaces and capital letters)\n4. Click next, and you're good to go!\n\n### 📦 Making a Release\n\n#### Configuring Zenodo\n\n[Zenodo](https://zenodo.org) is a long-term archival system that assigns a DOI\nto each release of your package.\n\n1. Log in to Zenodo via GitHub with this link:\n   https://zenodo.org/oauth/login/github/?next=%2F. This brings you to a page\n   that lists all of your organizations and asks you to approve installing the\n   Zenodo app on GitHub. Click \"grant\" next to any organizations you want to\n   enable the integration for, then click the big green \"approve\" button. This\n   step only needs to be done once.\n2. Navigate to https://zenodo.org/account/settings/github/, which lists all of\n   your GitHub repositories (both in your username and any organizations you\n   enabled). Click the on/off toggle for any relevant repositories. When you\n   make a new repository, you'll have to come back to this\n\nAfter these steps, you're ready to go! After you make \"release\" on GitHub (steps\nfor this are below), you can navigate to\nhttps://zenodo.org/account/settings/github/repository/biopragmatics/curies to\nsee the DOI for the release and link to the Zenodo record for it.\n\n#### Registering with the Python Package Index (PyPI)\n\nYou only have to do the following steps once.\n\n1. Register for an account on the\n   [Python Package Index (PyPI)](https://pypi.org/account/register)\n2. Navigate to https://pypi.org/manage/account and make sure you have verified\n   your email address. A verification email might not have been sent by default,\n   so you might have to click the \"options\" dropdown next to your address to get\n   to the \"re-send verification email\" button\n3. 2-Factor authentication is required for PyPI since the end of 2023 (see this\n   [blog post from PyPI](https://blog.pypi.org/posts/2023-05-25-securing-pypi-with-2fa/)).\n   This means you have to first issue account recovery codes, then set up\n   2-factor authentication\n4. Issue an API token from https://pypi.org/manage/account/token\n\n#### Configuring your machine's connection to PyPI\n\nYou have to do the following steps once per machine.\n\n```console\n$ uv tool install keyring\n$ keyring set https://upload.pypi.org/legacy/ __token__\n$ keyring set https://test.pypi.org/legacy/ __token__\n```\n\nNote that this deprecates previous workflows using `.pypirc`.\n\n#### Uploading to PyPI\n\nAfter installing the package in development mode and installing `tox` with\n`python3 -m pip install tox tox-uv`, run the following from the console:\n\n```console\ntox -e finish\n```\n\nThis script does the following:\n\n1. Uses [bump-my-version](https://github.com/callowayproject/bump-my-version) to\n   switch the version number in the `pyproject.toml`, `CITATION.cff`,\n   `src/curies/version.py`, and [`docs/source/conf.py`](docs/source/conf.py) to\n   not have the `-dev` suffix\n2. Packages the code in both a tar archive and a wheel using\n   [`uv build`](https://docs.astral.sh/uv/guides/publish/#building-your-package)\n3. Uploads to PyPI using\n   [`uv publish`](https://docs.astral.sh/uv/guides/publish/#publishing-your-package).\n4. Push to GitHub. You'll need to make a release going with the commit where the\n   version was bumped.\n5. Bump the version to the next patch. If you made big changes and want to bump\n   the version by minor, you can use `tox -e bumpversion -- minor` after.\n\n#### Releasing on GitHub\n\n1. Navigate to https://github.com/biopragmatics/curies/releases/new to draft a\n   new release\n2. Click the \"Choose a Tag\" dropdown and select the tag corresponding to the\n   release you just made\n3. Click the \"Generate Release Notes\" button to get a quick outline of recent\n   changes. Modify the title and description as you see fit\n4. Click the big green \"Publish Release\" button\n\nThis will trigger Zenodo to assign a DOI to your release as well.\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiopragmatics%2Fcuries","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiopragmatics%2Fcuries","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiopragmatics%2Fcuries/lists"}