Skip to content

Commit

Permalink
Serve API under prefixed URLs for API version (major.minor) and full …
Browse files Browse the repository at this point in the history
…repo version (major.minor.patch)
  • Loading branch information
ml-evs committed Nov 1, 2024
1 parent b612462 commit e97602e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion yard/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from importlib.metadata import version

__version__ = version("datatractor-yard")
__api_version__ = __version__
__api_version__ = ".".join(__version__.split(".")[0:2])
4 changes: 3 additions & 1 deletion yard/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from fastapi.templating import Jinja2Templates
from pydantic import BaseModel

from yard import __api_version__
from yard import __api_version__, __version__

from .models import Extractor, FileType
from .utils import load_registry_collection
Expand Down Expand Up @@ -200,7 +200,9 @@ async def load_data():
_get_info()


# Serve API under API version (vX.Y) and full API+data version (vX.Y.Z)
app.mount(f"/api/v{__api_version__}", api)
app.mount(f"/api/v{__version__}", api)
app.mount("/api/", api)


Expand Down

0 comments on commit e97602e

Please sign in to comment.