@@ -47,11 +47,11 @@ Idiomatic conversion between URIs and compact URIs (CURIEs).
4747from curies import Converter
4848
4949converter = Converter.from_prefix_map({
50- " CHEBI" : " http://purl.obolibrary.org/obo/CHEBI_" ,
51- " MONDO" : " http://purl.obolibrary.org/obo/MONDO_" ,
52- " GO" : " http://purl.obolibrary.org/obo/GO_" ,
53- # ... and so on
54- " OBO" : " http://purl.obolibrary.org/obo/" ,
50+ " CHEBI" : " http://purl.obolibrary.org/obo/CHEBI_" ,
51+ " MONDO" : " http://purl.obolibrary.org/obo/MONDO_" ,
52+ " GO" : " http://purl.obolibrary.org/obo/GO_" ,
53+ # ... and so on
54+ " OBO" : " http://purl.obolibrary.org/obo/" ,
5555})
5656
5757>> > converter.compress(" http://purl.obolibrary.org/obo/CHEBI_1" )
@@ -72,13 +72,15 @@ URI prefix will always be matched. For example, compressing
7272` http://purl.obolibrary.org/obo/GO_0032571 `
7373will return ` GO:0032571 ` instead of ` OBO:GO_0032571 ` .
7474
75- A converter can be instantiated from a web-based resource in JSON-LD format:
75+ All loader function work on local file paths, remote URLs, and pre-loaded
76+ data structures. For example, a converter can be instantiated from a web-based
77+ resource in JSON-LD format:
7678
7779``` python
7880from curies import Converter
7981
8082url = " https://raw.githubusercontent.com/biopragmatics/bioregistry/main/exports/contexts/semweb.context.jsonld"
81- converter = Converter.from_jsonld_url (url)
83+ converter = Converter.from_jsonld (url)
8284```
8385
8486Several converters can be instantiated from pre-defined web-based resources:
@@ -109,7 +111,7 @@ obo_converter.pd_compress(df, column=0)
109111obo_converter.pd_expand(df, column = 0 )
110112```
111113
112- Apply in bulk to a CSV file with ` Converter.file_expand ` and
114+ Apply in bulk to a CSV file with ` Converter.file_expand ` and
113115` Converter.file_compress ` (defaults to using tab separator):
114116
115117``` python
@@ -125,6 +127,24 @@ obo_converter.file_expand(path, column=0)
125127
126128Full documentation is available [ here] ( https://curies.readthedocs.io ) .
127129
130+ ## CLI Usage
131+
132+ This package comes with a built-in CLI for running a resolver web application:
133+
134+ ``` shell
135+ $ python -m curies --host 0.0.0.0 --port 8000 bioregistry
136+ ```
137+
138+ The positional argument can be one of the following:
139+
140+ 1 . A pre-defined prefix map to get from the web (bioregistry, go, obo, monarch, prefixcommons)
141+ 2 . A local file path or URL to a prefix map, extended prefix map, or one of several formats. Requires specifying
142+ a ` --format ` .
143+
144+ The framework can be swapped to use Flask (default) or FastAPI with ` --framework ` . The
145+ server can be swapped to use Werkzeug (default) or Uvicorn with ` --server ` . These functionalities
146+ are also available programmatically, see the docs for more information.
147+
128148## 🧑🤝🧑 Related
129149
130150Other packages that convert between CURIEs and URIs:
@@ -147,7 +167,8 @@ $ pip install curies
147167## 👐 Contributing
148168
149169Contributions, whether filing an issue, making a pull request, or forking, are appreciated. See
150- [ CONTRIBUTING.md] ( https://github.com/cthoyt/curies/blob/master/.github/CONTRIBUTING.md ) for more information on getting involved.
170+ [ CONTRIBUTING.md] ( https://github.com/cthoyt/curies/blob/master/.github/CONTRIBUTING.md ) for more information on getting
171+ involved.
151172
152173## 👋 Attribution
153174
@@ -231,4 +252,5 @@ This script does the following:
2312524 . Push to GitHub. You'll need to make a release going with the commit where the version was bumped.
2322535 . Bump the version to the next patch. If you made big changes and want to bump the version by minor, you can
233254 use ` tox -e bumpversion minor ` after.
255+
234256</details >
0 commit comments