Skip to content

Commit e43fbc9

Browse files
authored
Merge pull request #10 from SFTtech/milo/multi-package-repo
2 parents fec6785 + 6a0fa0a commit e43fbc9

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

+756
-445
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ jobs:
4141
enable-cache: true
4242
- name: Install the project
4343
run: uv sync --locked --all-extras --dev
44-
- name: Run Mypy
45-
run: uv run mypy .
44+
- name: Run Ty for typechecking
45+
run: uv run ty check
4646

4747
format:
4848
runs-on: ubuntu-latest
@@ -99,7 +99,7 @@ jobs:
9999
- name: Install the project
100100
run: uv sync --locked --all-extras --dev
101101
- name: Run Unittests
102-
run: uv run pytest tests/unit --cov=debmagic
102+
run: uv run pytest --ignore tests/integration .
103103

104104
# TODO: integration tests currently don't work in the CI since they require running apt source on debian trixie -> CI runs on ubuntu
105105
# integration-tests:

.github/workflows/release.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,7 @@ jobs:
2727
enable-cache: true
2828
- name: Build
2929
run: uv build
30-
- name: Publish
31-
run: uv publish
30+
- name: Publish debmagic-common
31+
run: uv publish --package debmagic-common
32+
- name: Publish debmagic (cli)
33+
run: uv publish --package debmagic

.pre-commit-config.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,11 @@ repos:
44
hooks:
55
- id: ruff-check
66
args: [ --fix ]
7-
- id: ruff-format
7+
- id: ruff-format
8+
- repo: local
9+
hooks:
10+
- id: ty
11+
name: ty check
12+
entry: uv run ty check .
13+
pass_filenames: false
14+
language: python

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"[python]": {
33
"editor.defaultFormatter": "charliermarsh.ruff"
44
},
5-
"python.testing.pytestArgs": ["tests"],
5+
"python.testing.pytestArgs": ["."],
66
"python.testing.unittestEnabled": false,
77
"python.testing.pytestEnabled": true
88
}

debian/control

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,35 @@ Homepage: https://github.com/SFTtech/debmagic
1919
Vcs-Git: https://github.com/SFTtech/debmagic.git
2020
Vcs-Browser: https://github.com/SFTtech/debmagic
2121

22-
Package: debmagic
22+
Package: python3-debmagic-common
2323
Architecture: all
2424
Depends:
2525
python3-debian,
26+
${misc:Depends},
27+
${python3:Depends}
28+
Multi-Arch: foreign
29+
Description: Shared components for the debmagic debian buildtool suite
30+
Collection of utilities and type definitions used in both the debmagic cli
31+
buildtool as well as the debmagic python debian rules file library.
32+
33+
Package: debmagic-pkg
34+
Architecture: all
35+
Depends:
36+
python3-debmagic-common,
2637
python3-pydantic,
2738
${misc:Depends},
2839
${python3:Depends}
2940
Multi-Arch: foreign
3041
Description: Debian build instructions written in Python.
3142
Explicit is better than implicit.
43+
44+
Package: debmagic
45+
Architecture: all
46+
Depends:
47+
python3-debmagic-common,
48+
python3-pydantic,
49+
${misc:Depends},
50+
${python3:Depends}
51+
Multi-Arch: foreign
52+
Description: Debian package building made easy.
53+
Holistic cli for the whole debian package building workflow.

debian/rules

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,56 @@
33
import sys
44
from pathlib import Path
55

6-
repo_root = Path(__file__).parent.parent / "src"
7-
sys.path.append(str(repo_root))
6+
packages_root = Path(__file__).parent.parent / "packages"
7+
sys.path.extend(
8+
[
9+
str(packages_root / "debmagic-common" / "src"),
10+
str(packages_root / "debmagic-pkg" / "src"),
11+
]
12+
)
813

9-
from debmagic.v0 import package
10-
from debmagic.v0 import dh as dh_mod
14+
from debmagic.v0 import package, dh, Build
1115

12-
dh = dh_mod.Preset(dh_args=["--with", "python3", "--buildsystem=pybuild"])
16+
dhp = dh.Preset(dh_args=["--with", "python3", "--buildsystem=pybuild"])
1317

1418
pkg = package(
15-
preset=[dh],
19+
preset=[dhp],
1620
)
1721

18-
pkg.pack()
22+
packages = {
23+
"python3-debmagic-common": ("packages/debmagic-common", "debmagic-common"),
24+
"debmagic": ("packages/debmagic", "debmagic"),
25+
"debmagic-pkg": ("packages/debmagic-pkg", "debmagic-pkg"),
26+
}
27+
28+
def dh_auto(build: Build, stage: str, use_destdir: bool = False):
29+
for pkg_name, (path, python_pkg_name) in packages.items():
30+
destdir = f" --destdir debian/{pkg_name} " if use_destdir else ""
31+
build.cmd(f"{stage} -p {pkg_name} --sourcedirectory {path} --buildsystem=pybuild {destdir} -- --name {python_pkg_name}")
32+
33+
@dhp.override
34+
def dh_auto_configure(build: Build):
35+
dh_auto(build, "dh_auto_configure")
36+
37+
38+
@dhp.override
39+
def dh_auto_build(build: Build):
40+
dh_auto(build, "dh_auto_build")
41+
42+
43+
@dhp.override
44+
def dh_auto_install(build: Build):
45+
dh_auto(build, "dh_auto_install", use_destdir=True)
46+
47+
48+
@dhp.override
49+
def dh_auto_test(build: Build):
50+
dh_auto(build, "dh_auto_test")
51+
52+
53+
@dhp.override
54+
def dh_auto_clean(build: Build):
55+
dh_auto(build, "dh_auto_clean")
56+
57+
58+
pkg.pack()

docs/develop/releasing.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Making releases
2+
3+
First step is bumping the versions
4+
5+
```shell
6+
uv version --package <package-name> --bump <major | minor | patch | beta | alpha> [--dry-run]
7+
```
8+
9+
Currently we version all packages in tandem without separate release for our sub-packages
10+
11+
```shell
12+
export BUMP=<bump-type>
13+
uv version --package debmagic-common --bump $BUMP
14+
uv version --package debmagic-pkg --bump $BUMP
15+
uv version --package debmagic --bump $BUMP
16+
```

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ usage/modules/index.md
1515
:caption: Development
1616
1717
develop/index.md
18+
develop/releasing.md
1819
```
1920

2021
```{toctree}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[project]
2+
name = "debmagic-common"
3+
version = "0.0.1-alpha.1"
4+
description = "utility library for common debmagic code"
5+
license = "GPL-2.0-or-later"
6+
# license-files = ["../../LICENSE"]
7+
# readme = "../../README.md"
8+
requires-python = ">=3.12"
9+
classifiers = ["Programming Language :: Python :: 3"]
10+
dependencies = ["python-debian>=1.0"]
11+
12+
[project.urls]
13+
homepage = "https://github.com/SFTtech/debmagic"
14+
source = "https://github.com/SFTtech/debmagic.git"
15+
issues = "https://github.com/SFTtech/debmagic/issues"
16+
releasenotes = "https://github.com/SFTtech/debmagic/-/blob/main/debian/changelog"
17+
18+
[build-system]
19+
requires = ["setuptools>=77.0.0", "setuptools-scm"]
20+
build-backend = "setuptools.build_meta"

src/debmagic/__init__.py renamed to packages/debmagic-common/src/debmagic/common/__init__.py

File renamed without changes.

0 commit comments

Comments
 (0)