Production-ready Python client for the NLM UMLS REST APIs.
Project description
UMLS Python Client
Production-ready Python client for the NLM UMLS REST APIs.
The package keeps the original UMLSClient behavior for existing users and adds
typed sync and async clients for new applications.
Installation
pip install umls-python-client
Development install:
pip install ".[dev]"
Authentication
UMLS requests require an API key from NLM: https://documentation.uts.nlm.nih.gov/rest/authentication.html
import os
api_key = os.environ["UMLS_API_KEY"]
Legacy Compatible Usage
UMLSClient preserves the existing JSON formatting defaults and camelCase
namespaces.
from umls_python_client import UMLSClient
client = UMLSClient(api_key="YOUR_API_KEY")
results = client.searchAPI.search(
search_string="diabetes",
semantic_types="T047",
semantic_groups="Disorders",
)
print(results)
raw_results = client.search_api.search(
search_string="diabetes",
return_indented=False,
)
Typed Sync Usage
from umls_python_client import TypedUMLSClient
with TypedUMLSClient(api_key="YOUR_API_KEY") as client:
response = client.cui_api.get_cui_info("C0011849")
concept = response.result
print(concept.name)
Typed responses return UMLSResponse[T]. The original UMLS JSON is available
through response.raw or response.to_dict(), and RDF/Turtle is available with
response.to_rdf().
Async Usage
from umls_python_client import AsyncUMLSClient
async def main() -> None:
async with AsyncUMLSClient(api_key="YOUR_API_KEY") as client:
response = await client.search_api.search("diabetes", page_size=5)
print(response.result)
API Namespaces
| Namespace | Legacy alias | Coverage |
|---|---|---|
search_api |
searchAPI |
/search/{version}, including semanticTypes and semanticGroups |
cui_api |
cuiAPI |
CUI detail, atoms, preferred atom, definitions, relations |
source_api |
sourceAPI |
Source concepts, atoms, preferred atom, hierarchy, attributes, relations |
atom_api |
none | AUI detail and hierarchy endpoints |
crosswalk_api |
crosswalkAPI |
Source identifier crosswalk |
semantic_network_api |
semanticNetworkAPI |
Semantic type lookup |
metadata_api |
none | /metadata/{version}/sources |
Output Behavior
Legacy methods support:
format="json"orformat="rdf"return_indented=Truefor pretty JSON stringsreturn_indented=Falsefor raw Python payloadssave_to_file=Trueandfile_path="output-directory"
Typed methods raise structured exceptions on failures:
UMLSRequestErrorUMLSHTTPErrorUMLSDecodeError
Current NLM API Notes
The Search API changed on May 4, 2026. This client supports the current
semanticTypes and semanticGroups filters and does not send obsolete
pageNumber pagination parameters for endpoints where the current NLM docs no
longer document pagination.
Official UMLS REST documentation: https://documentation.uts.nlm.nih.gov/rest/home.html
Testing
ruff check .
ruff format --check .
mypy src
pytest
python -m build
Live integration tests are optional and must be explicitly enabled by setting
UMLS_API_KEY; default CI uses mocked transports only.
Releases
This repository uses Release Please to automate versioning and publishing.
Commits merged to main should use Conventional Commit prefixes:
fix:for patch releasesfeat:for minor releasesfeat!:orfix!:for major releases
After releasable commits land on main, Release Please opens or updates a
release PR. Merging that release PR creates the GitHub Release, builds the
package, attaches dist/ artifacts to the release, and publishes to PyPI.
To publish the already-merged 1.1.0 modernization release, first merge the
release workflow, configure PyPI trusted publishing, and then run the Release
workflow manually with tag_name set to v1.1.0. The manual run creates the
tag and GitHub Release if needed, verifies the package, uploads release
artifacts, and publishes 1.1.0 to PyPI.
PyPI publishing uses trusted publishing, so no PyPI API token is required in GitHub secrets. Configure the PyPI project with:
- Owner:
palasht75 - Repository:
umls-python-client - Workflow:
release-please.yml - Environment:
pypi
License
Apache-2.0. See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file umls_python_client-1.1.0.tar.gz.
File metadata
- Download URL: umls_python_client-1.1.0.tar.gz
- Upload date:
- Size: 26.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
778f2b7e0c7aaab8c476658c1b8d7766ce63c83e5282e55e740c626f76e98e9b
|
|
| MD5 |
da3d9959134211a56def4ae2b80e7a90
|
|
| BLAKE2b-256 |
d8d57c0b1322ec756b13edc9e4e17c3df8b3a89e2638847919cd247e13e5a50d
|
Provenance
The following attestation bundles were made for umls_python_client-1.1.0.tar.gz:
Publisher:
release-please.yml on palasht75/umls-python-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
umls_python_client-1.1.0.tar.gz -
Subject digest:
778f2b7e0c7aaab8c476658c1b8d7766ce63c83e5282e55e740c626f76e98e9b - Sigstore transparency entry: 1643761845
- Sigstore integration time:
-
Permalink:
palasht75/umls-python-client@442fb7fb01db04825ef680689d02a58bab895d71 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/palasht75
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-please.yml@442fb7fb01db04825ef680689d02a58bab895d71 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file umls_python_client-1.1.0-py3-none-any.whl.
File metadata
- Download URL: umls_python_client-1.1.0-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ade6884fdcf10fda8a5bde8e29b3fdb0a1f8ea76c2ae40854a0bd49de1220f0
|
|
| MD5 |
f4cc9a92e507333836ed85b9637e18e1
|
|
| BLAKE2b-256 |
1115207fd330f9031e907b453722abe2703d1865b891b7cb6190372754354473
|
Provenance
The following attestation bundles were made for umls_python_client-1.1.0-py3-none-any.whl:
Publisher:
release-please.yml on palasht75/umls-python-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
umls_python_client-1.1.0-py3-none-any.whl -
Subject digest:
0ade6884fdcf10fda8a5bde8e29b3fdb0a1f8ea76c2ae40854a0bd49de1220f0 - Sigstore transparency entry: 1643761885
- Sigstore integration time:
-
Permalink:
palasht75/umls-python-client@442fb7fb01db04825ef680689d02a58bab895d71 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/palasht75
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-please.yml@442fb7fb01db04825ef680689d02a58bab895d71 -
Trigger Event:
workflow_dispatch
-
Statement type: