Skip to content

Commit 6dd3094

Browse files
authored
Use Hatch for Homebrew (#3)
1 parent 91272d7 commit 6dd3094

File tree

5 files changed

+1272
-104
lines changed

5 files changed

+1272
-104
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,14 @@ jobs:
6565
version: ${{ inputs.version }}
6666
initpy-files: ${{ inputs.version-file }}
6767

68-
- name: "Update UV Version"
69-
if: ${{ inputs.version }}
68+
- name: "Debug Version"
69+
continue-on-error: true
7070
run: |
71-
uv version ${{ inputs.version }}
72-
echo "::group::${{ inputs.version-file }}"
7371
cat ${{ inputs.version-file }}
74-
echo "::endgroup::"
7572
7673
- name: "Build"
7774
run: |
78-
uv build
75+
uvx toml-run build
7976
8077
- name: "List Artifacts"
8178
continue-on-error: true

.github/workflows/pyinstaller.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,11 @@ jobs:
7777
version: ${{ inputs.version }}
7878
initpy-files: ${{ inputs.version-file }}
7979

80-
- name: "Update UV Version"
81-
if: ${{ inputs.version }}
80+
- name: "Debug Version"
81+
continue-on-error: true
82+
shell: bash
8283
run: |
83-
uv version ${{ inputs.version }}
84-
echo "::group::${{ inputs.version-file }}"
8584
cat ${{ inputs.version-file }}
86-
echo "::endgroup::"
8785
8886
- name: "Parse Version"
8987
# Note: packaging is not available on macos-latest by default

pyproject.toml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[project]
22
name = "brew-python-resources"
3-
version = "0.0.1"
43
description = "Generate and Update Homebrew Formula (Brew) Python Resources."
54
readme = "README.md"
65
requires-python = ">=3.8"
@@ -19,11 +18,13 @@ dependencies = [
1918
"requests>=2.32.4",
2019
"requests-cache>=1.2.1",
2120
]
21+
dynamic = ["version"]
2222

2323
[project.urls]
2424
Changelog = "https://github.com/cssnr/brew-python-resources/releases"
2525
Discord = "https://discord.gg/wXy6m2X8wY"
2626
Documentation = "https://cssnr.github.io/brew-python-resources/"
27+
Download = "https://github.com/cssnr/brew-python-resources/releases/latest"
2728
Funding = "https://ko-fi.com/cssnr"
2829
GitHub = "https://github.com/cssnr/brew-python-resources"
2930
Homepage = "https://cssnr.com/"
@@ -38,6 +39,7 @@ dev = [
3839
"bandit>=1.7.10",
3940
"black>=24.8.0",
4041
"coverage>=7.6.1",
42+
"hatch>=1.14.2",
4143
"isort>=5.13.2",
4244
"mypy>=1.14.1",
4345
"pyinstaller>=6.17.0",
@@ -51,10 +53,10 @@ dev = [
5153
"yamllint>=1.35.1",
5254
]
5355

54-
# https://docs.astral.sh/uv/reference/settings/#build-backend
56+
# https://hatch.pypa.io/latest/config/build/#build-system
5557
[build-system]
56-
requires = ["uv_build>=0.9.9,<0.10.0"]
57-
build-backend = "uv_build"
58+
requires = ["hatchling"]
59+
build-backend = "hatchling.build"
5860

5961
# Bandit
6062
# https://bandit.readthedocs.io/en/latest/config.html
@@ -72,9 +74,20 @@ extend-exclude = '(\.github)'
7274
# Coverage
7375
# https://coverage.readthedocs.io/en/latest/
7476
[tool.coverage.run]
75-
omit = ["_version.py", "utils.py"]
77+
omit = ["_version.py", "app.py", "utils.py"]
7678
source = ["src"]
7779

80+
# Hatchling
81+
# https://hatch.pypa.io/latest/config/build/#build-system
82+
[tool.hatch.version]
83+
path = "src/brewresources/_version.py"
84+
85+
[tool.hatch.build.targets.sdist]
86+
include = ["src"]
87+
88+
[tool.hatch.build.targets.wheel]
89+
packages = ["src/brewresources"]
90+
7891
# Isort
7992
# https://pycqa.github.io/isort/docs/configuration/options.html
8093
[tool.isort]
@@ -105,7 +118,8 @@ select = ["E4", "E7", "E9", "F", "B", "Q"]
105118
win-version = "uv run pyivf-make_version --source-format yaml --metadata-source .github/files/win-version.yaml --outfile win-version.txt"
106119
pyinstaller = "uv run pyinstaller -F -n bpr -i docs/favicon.ico src/app.py"
107120
test = ["uv run coverage run -m pytest", "uv run coverage report -m"]
108-
build = "uv build"
121+
clean = "rm -rf dist"
122+
build = "uv run hatch build"
109123
predocs = "rm -rf .cache site"
110124
docs = "zensical serve --open --dev-addr 0.0.0.0:8000"
111125
docs-build = "zensical build --clean"
@@ -114,15 +128,15 @@ uv run black .
114128
uv run isort -c .
115129
uv run ruff format
116130
uv run tombi format .
117-
which prettier && prettier --write .
131+
which prettier && prettier --write . || echo missing prettier
118132
"""
119133
lint = """
120134
run bandit
121135
run mypy
122136
run ruff
123137
run validate
124138
run yamllint
125-
which prettier && prettier --check .
139+
which prettier && prettier --check . || echo missing prettier
126140
uv run black --check .
127141
uv run isort -c .
128142
uv run tombi lint .
@@ -134,7 +148,3 @@ mypy = "uv run mypy ."
134148
ruff = "uv run ruff check ."
135149
validate = "uv run validate-pyproject pyproject.toml"
136150
yamllint = "uv run yamllint -c .github/yamllint.yaml ."
137-
138-
[tool.uv.build-backend]
139-
module-name = "brewresources"
140-
source-include = ["LICENSE"]

src/brewresources/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
# The string "0.0.1" is used in .github/workflows/build.yaml
12
__version__ = "0.0.1"

0 commit comments

Comments
 (0)