Skip to content

Commit 329de3b

Browse files
committed
Add versioning
1 parent d65bfa1 commit 329de3b

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,9 @@ pyrightconfig.json
185185
pyvenv.cfg
186186
pip-selfcheck.json
187187

188+
# Ignore dynamically generated version files
189+
**/_version.py
190+
**/_version.pyi
191+
**/.version
192+
188193
# End of https://www.toptal.com/developers/gitignore/api/python,venv

pyproject.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
[build-system]
2-
requires = ["setuptools>=61.0"]
2+
requires = ["setuptools>=61.0", "setuptools_scm>=8"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "robopipe-api"
7-
version = "0.1.0"
87
description = "API for the Robopipe application"
98
authors = [
109
{ name = "Adam Berkes", email = "adam.berkes@koala42.com" },
@@ -24,7 +23,7 @@ keywords = [
2423
"industrial-machine-vision",
2524
]
2625
requires-python = ">=3.11"
27-
dynamic = ["dependencies"]
26+
dynamic = ["dependencies", "version"]
2827

2928
[project.urls]
3029
Homepage = "https://robopipe.io"
@@ -33,6 +32,12 @@ Repository = "https://github.com/Robopipe/API"
3332

3433
[tool.setuptools.dynamic]
3534
dependencies = { file = ["requirements.txt"] }
35+
version = { attr = "robopipe_api._version.__version__" }
36+
37+
[tool.setuptools_scm]
38+
version_file = "robopipe_api/_version.py"
39+
local_scheme = "no-local-version"
40+
3641

3742
[project.scripts]
3843
robopipe-api = "robopipe_api.robopipe:main"

robopipe_api/robopipe.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import uvicorn
77

88
from contextlib import asynccontextmanager
9+
from importlib.metadata import version
910
import os
1011

1112
from .camera.camera_manager import camera_manager_factory
@@ -66,6 +67,7 @@ async def lifespan(app: FastAPI):
6667
app = FastAPI(
6768
lifespan=lifespan,
6869
title="Robopipe API",
70+
version=version("robopipe_api"),
6971
description="API for the Robopipe application",
7072
servers=[
7173
{

0 commit comments

Comments
 (0)