Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ build:
- asdf install uv latest
- asdf global uv latest
- uv venv $READTHEDOCS_VIRTUALENV_PATH
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH UV_PREVIEW=1 uv pip install .[docs,pandas,flask,fastapi,rdflib]
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH UV_PREVIEW=1 uv pip install .[docs,pandas,flask,fastapi,rdflib,sqlmodels,sqlalchemy]
- python -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs/source $READTHEDOCS_OUTPUT/html
15 changes: 9 additions & 6 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,18 @@
# Note: don't add trailing slashes, since sphinx adds "/objects.inv" to the end
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"bioregistry": ("https://bioregistry.readthedocs.io/en/stable/", None),
"pandas": ("https://pandas.pydata.org/docs/", None),
"flask": ("https://flask.palletsprojects.com/", None),
"pydantic": ("https://docs.pydantic.dev/latest/", None),
"bioregistry": ("https://bioregistry.readthedocs.io/en/stable", None),
"pandas": ("https://pandas.pydata.org/docs", None),
"flask": ("https://flask.palletsprojects.com/en/stable", None),
"pydantic": ("https://docs.pydantic.dev/latest", None),
# "fastapi": ("https://fastapi.tiangolo.com/", None),
# "gunicorn": ("https://docs.gunicorn.org/", None),
# "uvicorn": ("https://www.uvicorn.org/", None),
"prefixmaps": ("https://linkml.io/prefixmaps/", None),
"rdflib": ("https://rdflib.readthedocs.io/en/stable/", None),
"prefixmaps": ("https://linkml.io/prefixmaps", None),
"rdflib": ("https://rdflib.readthedocs.io/en/stable", None),
"sssom": ("https://mapping-commons.github.io/sssom-py", None),
# "sqlalchemy": ("https://docs.sqlalchemy.org/en/20", None),
# "sqlmodel": ("https://sqlmodel.tiangolo.com", None),
}

autoclass_content = "both"
Expand Down
6 changes: 6 additions & 0 deletions docs/source/database.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Database
========

.. automodapi:: curies.database
:no-inheritance-diagram:
:no-heading:
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ The most recent code and data can be installed directly from GitHub with:
typing
w3c
preprocessing
database
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ tests = [
pandas = [
"pandas",
]
sqlalchemy = [
"sqlalchemy",
]
sqlmodel = [
"sqlmodel",
]
flask = [
"flask",
"defusedxml",
Expand Down
14 changes: 9 additions & 5 deletions src/curies/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,10 @@ def __eq__(self, other: Any) -> bool:
and self.identifier == other.identifier
)

def __composite_values__(self) -> tuple[str, str]:
"""Return values appropriate for :func:`sqlalchemy.orm.composite`."""
return self.prefix, self.identifier

@property
def curie(self) -> str:
"""Get the reference as a CURIE string.
Expand Down Expand Up @@ -485,7 +489,7 @@ class NamableReference(Reference):
model_config = ConfigDict(frozen=True)

@classmethod
def from_curie( # type:ignore
def from_curie(
cls,
curie: str,
name: str | None = None,
Expand Down Expand Up @@ -2244,7 +2248,7 @@ def pd_compress(
:param ambiguous: If true, consider the column as containing either CURIEs or URIs.
"""
pre_func = self.compress_or_standardize if ambiguous else self.compress
func = partial(pre_func, strict=strict, passthrough=passthrough) # type:ignore
func = partial(pre_func, strict=strict, passthrough=passthrough)
df[column if target_column is None else target_column] = df[column].map(func)

def pd_expand(
Expand All @@ -2267,7 +2271,7 @@ def pd_expand(
:param ambiguous: If true, consider the column as containing either CURIEs or URIs.
"""
pre_func = self.expand_or_standardize if ambiguous else self.expand
func = partial(pre_func, strict=strict, passthrough=passthrough) # type:ignore
func = partial(pre_func, strict=strict, passthrough=passthrough)
df[column if target_column is None else target_column] = df[column].map(func)

def pd_standardize_prefix(
Expand Down Expand Up @@ -2370,7 +2374,7 @@ def file_compress(
:param ambiguous: If true, consider the column as containing either CURIEs or URIs.
"""
pre_func = self.compress_or_standardize if ambiguous else self.compress
func = partial(pre_func, strict=strict, passthrough=passthrough) # type:ignore
func = partial(pre_func, strict=strict, passthrough=passthrough)
self._file_helper(func, path=path, column=column, sep=sep, header=header)

def file_expand(
Expand All @@ -2396,7 +2400,7 @@ def file_expand(
:param ambiguous: If true, consider the column as containing either CURIEs or URIs.
"""
pre_func = self.expand_or_standardize if ambiguous else self.expand
func = partial(pre_func, strict=strict, passthrough=passthrough) # type:ignore
func = partial(pre_func, strict=strict, passthrough=passthrough)
self._file_helper(func, path=path, column=column, sep=sep, header=header)

@staticmethod
Expand Down
Loading
Loading