Skip to content

Commit 3203f68

Browse files
committed
chore: use dynamic versiong
1 parent 6f102d2 commit 3203f68

File tree

6 files changed

+20
-6
lines changed

6 files changed

+20
-6
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ logs/
6666
htmlcov/
6767

6868
# Docker
69-
.dockerignore
7069
compose/compose.prod.yaml
7170
compose/.env
7271

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ ENV PATH="/root/.local/bin:$PATH"
1919

2020
COPY pyproject.toml uv.lock MANIFEST.in ./
2121
COPY src/ src/
22+
COPY .git/ .git/
2223

2324
# Sync dependencies with uv
2425
RUN uv sync --frozen --extra full --no-dev

frontend/app/src/lib/components/AppSidebar.svelte

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
// Version info
1717
let versionData = $state(null);
1818
19+
// Format version for display (remove .post1. and git hash)
20+
function formatVersion(version) {
21+
if (!version) return version;
22+
return version.replace(/\.post\d+\./, '.').split('+')[0];
23+
}
24+
1925
onMount(async () => {
2026
// Try to load from localStorage first for instant display
2127
try {
@@ -59,7 +65,7 @@
5965
<Tooltip.Root>
6066
<Tooltip.Trigger>
6167
<Badge variant="default">
62-
v{versionData.backend}
68+
v{formatVersion(versionData.backend)}
6369
</Badge>
6470
</Tooltip.Trigger>
6571
<Tooltip.Content side="bottom" class="bg-popover text-popover-foreground">

frontend/app/src/lib/components/Navbar.svelte

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
let pypsaVersion = cachedVersion.pypsa;
1616
let appVersion = cachedVersion.app;
1717
18+
// Format version for display (remove .post1. and git hash)
19+
function formatVersion(version) {
20+
if (!version) return version;
21+
return version.replace(/\.post\d+\./, '.').split('+')[0];
22+
}
23+
1824
// Get the current page path to highlight active nav item
1925
const currentPath = $derived($page.url.pathname);
2026
@@ -121,7 +127,7 @@
121127
class="text-xs bg-primary text-primary-foreground px-2 py-0.5 rounded font-normal cursor-help"
122128
title="PyPSA Framework v{pypsaVersion}"
123129
>
124-
v{appVersion}
130+
v{formatVersion(appVersion)}
125131
</span>
126132
{/if}
127133
</a>

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "pypsa-app"
3-
version = "0.1.0-alpha.1"
43
description = "tbd"
4+
dynamic = ["version"]
55
authors = [
66
{ name = "Lukas Trippe", email = "[email protected]" }
77
]
@@ -52,7 +52,7 @@ Repository = "https://github.com/PyPSA/pypsa-app"
5252
Issues = "https://github.com/PyPSA/pypsa-app/issues"
5353

5454
[build-system]
55-
requires = ["setuptools>=61", "wheel"]
55+
requires = ["setuptools>=64", "setuptools_scm>=8"]
5656
build-backend = "setuptools.build_meta"
5757

5858
[tool.setuptools]
@@ -63,3 +63,6 @@ where = ["src"]
6363

6464
[tool.setuptools.package-data]
6565
"pypsa_app.backend" = ["static/**/*"]
66+
67+
[tool.setuptools_scm]
68+
version_scheme = "no-guess-dev"

uv.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)