Skip to content

Commit 99565d5

Browse files
authored
Modernize project structure (#1074)
* Improve the project structure. * Handle application version with the project.toml file * Update build pipeline * Update development documentation. * Update packaging code to get version from pyproject.toml file.
1 parent 0a720a5 commit 99565d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+199
-167
lines changed

.github/workflows/general.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ jobs:
153153
- name: Compile installer
154154
shell: bash # Force bash shell for VERSION command
155155
run: |
156-
VERSION=$(uv run python -c "import ode; print(ode.__version__)")
156+
VERSION=$(uv run python -c "from importlib.metadata import version; print(version('opendataeditor'))")
157157
makensis -DAPP_VERSION="$VERSION" ./packaging/windows/installer.nsi
158158
- name: Upload artifact
159159
uses: actions/upload-artifact@v4
@@ -188,7 +188,7 @@ jobs:
188188
uv sync
189189
- name: Build the deb package
190190
run: |
191-
VERSION=$(uv run python -c "import ode; print(ode.__version__)")
191+
VERSION=$(uv run python -c "from importlib.metadata import version; print(version('opendataeditor'))")
192192
uv run build.py build --onefile --name "opendataeditor-$VERSION.AppImage"
193193
- name: Archive build artifacts
194194
uses: actions/upload-artifact@v4

build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def build_application():
5252
print("Creating executable file for Open Data Editor")
5353

5454
params = [
55-
"ode/main.py",
55+
"src/ode/main.py",
5656
"--windowed", # Required for Windows install to not open a console.
5757
"--collect-all",
5858
"frictionless", # Frictionless depends on data files

create-deb.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ find tmp/usr/share -type f -exec chmod 644 -- {} +
3939
chmod +x tmp/opt/opendataeditor/opendataeditor
4040

4141
# Create the deb package
42-
VERSION=$(uv run python -c "import ode; print(ode.__version__)")
42+
VERSION=$(uv run python -c "from importlib.metadata import version; print(version('opendataeditor'))")
4343
FILENAME=opendataeditor-linux-$VERSION.deb
4444
[ -e dist/$FILENAME ] && rm dist/$FILENAME
4545
fpm -C tmp -s dir -t deb -n "opendataeditor" -v $VERSION -p dist/$FILENAME

create-dmg.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ sleep 5
7272
rm -f *.dmg
7373

7474
# Create the dmg file
75-
VERSION=$(uv run python -c "import ode; print(ode.__version__)")
75+
VERSION=$(uv run python -c "from importlib.metadata import version; print(version('opendataeditor'))")
7676
FILENAME=opendataeditor-macos-$VERSION.dmg
7777
[ -e $FILENAME ] && rm $FILENAME
7878

docs/source/contributing/development.md

Lines changed: 27 additions & 5 deletions

ode/__init__.py

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

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ dependencies = [
1414
"xlwt>=1.3.0",
1515
]
1616

17+
[project.scripts]
18+
ode = "ode.main:main"
19+
20+
[build-system]
21+
requires = ["uv_build>=0.9.10,<0.10.0"]
22+
build-backend = "uv_build"
23+
24+
[tool.uv.build-backend]
25+
module-name = "ode"
26+
1727
[tool.ruff]
1828
line-length = 140
1929

0 commit comments

Comments
 (0)