Skip to content

Commit 572079d

Browse files
authored
simpler and more integrated build with extended Makefile without weir… (#321)
* simpler and more integrated build with extended Makefile without weird cli run.py * simplify the toml file * fixed renamed script * install uv * also install python
1 parent fb5dd78 commit 572079d

File tree

11 files changed

+973
-715
lines changed

11 files changed

+973
-715
lines changed

.github/workflows/documentation.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ jobs:
3434

3535
- name: Prepare landing page
3636
if: github.event_name == 'push'
37-
run: |
38-
mkdir -p site
39-
touch site/.nojekyll
40-
cp -rv landing/* site/
37+
run: make build-site
4138

4239
- name: Deploy to GitHub Pages
4340
if: github.event_name == 'push'

Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
all: prepare-build build-docs build-site
2+
3+
prepare-build:
4+
@echo "--- 🛠️ Preparing build ---"
5+
@echo "This will install the dependencies"
6+
@if [ "$(shell which uv)" = "" ]; then \
7+
curl -LsSf https://astral.sh/uv/install.sh | sh; \
8+
echo "Installed uv."; \
9+
else \
10+
echo "Updating uv..."; \
11+
uv self update; \
12+
fi
13+
uv python install 3.12
14+
uv sync --all-extras --python 3.12
15+
16+
build-docs:
17+
@echo "--- 📚 Building docs ---"
18+
@echo "Builds the docs and puts them in the 'site' folder"
19+
@echo "You might need to also update the table with the desc. stats you can do this by running 'make update-table-in-docs'"
20+
uv run mkdocs build
21+
22+
view-docs:
23+
@echo "--- 👀 Viewing docs ---"
24+
uv run mkdocs serve
25+
26+
build-css:
27+
@echo "--- 🎨 Building CSS ---"
28+
@echo "Builds the CSS and puts it in the 'landing' folder"
29+
scripts/landing.sh
30+
31+
build-site: build-css
32+
@echo "--- 🏗️ Building site ---"
33+
@echo "Builds the site and puts it in the 'site' folder"
34+
mkdir -p site
35+
touch site/.nojekyll
36+
cp -rv landing/* site/
37+
38+
start-backend:
39+
@echo "--- 🚀 Starting backend ---"
40+
scripts/dfm-backend

dfm_backend/app.conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
STATIC_FOLDER = os.getenv('STATIC_FOLDER', os.path.join(os.getcwd(), 'landing'))
2+
STATIC_FOLDER = os.getenv('STATIC_FOLDER', os.path.join(os.getcwd(), 'site'))
33
DATA_FOLDER = os.getenv('DATA_FOLDER', os.path.join(os.getcwd(), 'data'))
44
NEWS_FILE = os.getenv('NEWS_FILE', os.path.join(DATA_FOLDER, 'news.jsonl'))
55
ADMIN_PASSWORD = os.getenv('ADMIN_PASSWORD', 'changeme')

dfm_backend/cli.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

landing/css/index.css

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,10 @@
3434
--container-3xl: 48rem;
3535
--container-4xl: 56rem;
3636
--container-6xl: 72rem;
37-
--container-7xl: 80rem;
3837
--text-xs: 0.75rem;
3938
--text-xs--line-height: calc(1 / 0.75);
4039
--text-sm: 0.875rem;
4140
--text-sm--line-height: calc(1.25 / 0.875);
42-
--text-base: 1rem;
43-
--text-base--line-height: calc(1.5 / 1);
4441
--text-lg: 1.125rem;
4542
--text-lg--line-height: calc(1.75 / 1.125);
4643
--text-xl: 1.25rem;
@@ -51,22 +48,14 @@
5148
--text-3xl--line-height: calc(2.25 / 1.875);
5249
--text-4xl: 2.25rem;
5350
--text-4xl--line-height: calc(2.5 / 2.25);
54-
--text-5xl: 3rem;
55-
--text-5xl--line-height: 1;
5651
--text-6xl: 3.75rem;
5752
--text-6xl--line-height: 1;
5853
--font-weight-medium: 500;
5954
--font-weight-semibold: 600;
6055
--font-weight-bold: 700;
61-
--tracking-tight: -0.025em;
62-
--leading-tight: 1.25;
63-
--radius-sm: 0.25rem;
6456
--radius-md: 0.375rem;
6557
--radius-lg: 0.5rem;
6658
--radius-xl: 0.75rem;
67-
--ease-in: cubic-bezier(0.4, 0, 1, 1);
68-
--ease-out: cubic-bezier(0, 0, 0.2, 1);
69-
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
7059
--blur-sm: 8px;
7160
--default-transition-duration: 150ms;
7261
--default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
@@ -389,12 +378,12 @@
389378
.list-disc {
390379
list-style-type: disc;
391380
}
381+
.grid-cols-1 {
382+
grid-template-columns: repeat(1, minmax(0, 1fr));
383+
}
392384
.grid-cols-2 {
393385
grid-template-columns: repeat(2, minmax(0, 1fr));
394386
}
395-
.grid-cols-3 {
396-
grid-template-columns: repeat(3, minmax(0, 1fr));
397-
}
398387
.flex-col {
399388
flex-direction: column;
400389
}
@@ -924,6 +913,11 @@
924913
outline-style: none;
925914
}
926915
}
916+
.sm\:grid-cols-2 {
917+
@media (width >= 40rem) {
918+
grid-template-columns: repeat(2, minmax(0, 1fr));
919+
}
920+
}
927921
.md\:mt-0 {
928922
@media (width >= 48rem) {
929923
margin-top: calc(var(--spacing) * 0);
@@ -969,6 +963,11 @@
969963
grid-template-columns: repeat(3, minmax(0, 1fr));
970964
}
971965
}
966+
.md\:grid-cols-4 {
967+
@media (width >= 48rem) {
968+
grid-template-columns: repeat(4, minmax(0, 1fr));
969+
}
970+
}
972971
.md\:flex-row {
973972
@media (width >= 48rem) {
974973
flex-direction: row;

landing/landing.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ <h4 class="text-xl font-semibold mb-4 text-dfmTeal">Collaborating Institutions</
128128
</div>
129129
<!-- Bottom Content: Why Danish Models + Feature Grid -->
130130
<div>
131-
<div class="grid grid-cols-3 gap-4 mt-8">
132-
<!--div class="bg-gray-100 p-4 rounded-lg">
131+
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-4 mt-8">
132+
<div class="bg-gray-100 p-4 rounded-lg">
133133
<i class="fas fa-language text-3xl mb-2 text-dfmBlue"></i>
134134
<h4 class="font-bold">Language Specific</h4>
135-
<p>Optimized for Danish language nuances</p>
136-
</div-->
135+
<p>Optimized for Danish language, cultural, and knowlege</p>
136+
</div>
137137
<div class="bg-gray-100 p-4 rounded-lg">
138138
<i class="fas fa-lock-open text-3xl mb-2 text-dfmBlue"></i>
139139
<h4 class="font-bold">Open Source</h4>

makefile

Lines changed: 0 additions & 13 deletions
This file was deleted.

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ dependencies = [
1313
"flask-limiter==3.12",
1414
"flask-mail==0.10.0",
1515
"gunicorn==23.0.0",
16+
"uv==0.7.6",
1617
]
1718
license = "MIT"
1819
license-files = ["LICENSE"]
1920

20-
[project.scripts]
21-
dfm-backend = "dfm_backend.cli:run"
22-
2321
[tool.setuptools]
2422
packages = ["dfm_backend"]
23+
24+
[tool.setuptools.data-files]
25+
bin = ["scripts/dfm-backend"]

scripts/backend.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

scripts/dfm-backend

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
export GUNICORN_CONF=$(python -c $'import pathlib as p\nimport dfm_backend as d\nprint(p.Path(d.__file__).resolve().parent / "gunicorn.conf.py")')
3+
gunicorn "dfm_backend:create_app()" -c $GUNICORN_CONF $@

0 commit comments

Comments
 (0)