Skip to content

Commit 77c60b6

Browse files
tschmrenovate[bot]
andauthored
Renovate updates and config templates (#301)
* chore(deps): update tschm/.config-templates action to v0.1.19 * chore(deps): lock file maintenance * chore: sync config files from .config-templates --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: tschm <[email protected]>
1 parent 5841e21 commit 77c60b6

File tree

10 files changed

+250
-158
lines changed

10 files changed

+250
-158
lines changed

.github/CONTRIBUTING.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file is part of the tschm/.config-templates repository.
44

55
This document is a guide to contributing to the project.
66

7-
We welcome all contributions. You don't need to be an expert (in optimization)
7+
We welcome all contributions. You don't need to be an expert
88
to help out.
99

1010
## Checklist
@@ -13,10 +13,10 @@ Contributions are made through
1313
[pull requests](https://help.github.com/articles/using-pull-requests/).
1414
Before sending a pull request, make sure you do the following:
1515

16-
- Run 'make fmt' to make sure your code adheres to our [coding style](#code-style).
17-
This step also includes our license on top of your new files.
18-
- [Write unit tests](#writing-unit-tests)
19-
- Run the [unit tests](#running-unit-tests) and check that they're passing
16+
- Run 'make check' to make sure your code adheres to our [coding style](#code-style)
17+
and all tests pass.
18+
- [Write unit tests](#writing-unit-tests) for new functionality added.
19+
2020

2121
## Building from source
2222

@@ -58,10 +58,6 @@ following:
5858
- Browse the open issues,
5959
and look for the issues tagged "help wanted".
6060

61-
## License
62-
63-
A license is added to new files automatically as a pre-commit hook.
64-
6561
## Code style
6662

6763
We use black and ruff to enforce our Python coding style.

.github/workflows/book.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ name: "BOOK"
2020
on:
2121
push:
2222
branches:
23+
# please use either main or master as your default branch
2324
- main
24-
25+
- master
2526

2627
jobs:
2728
parse-env:
@@ -68,9 +69,11 @@ jobs:
6869
contents: read
6970
steps:
7071
- name: "Build the virtual environment for ${{ github.repository }}"
72+
if: hashFiles('pyproject.toml') != ''
7173
uses: tschm/cradle/actions/[email protected]
7274

7375
- uses: tschm/cradle/actions/[email protected]
76+
if: hashFiles('pyproject.toml') != ''
7477
with:
7578
source-folder: ${{ needs.parse-env.outputs.source-folder }}
7679

@@ -82,9 +85,11 @@ jobs:
8285
contents: read
8386
steps:
8487
- name: "Build the virtual environment for ${{ github.repository }}"
88+
if: hashFiles('pyproject.toml') != ''
8589
uses: tschm/cradle/actions/[email protected]
8690

8791
- uses: tschm/cradle/actions/[email protected]
92+
if: hashFiles('pyproject.toml') != ''
8893
with:
8994
tests-folder: ${{ needs.parse-env.outputs.tests-folder }}
9095
source-folder: ${{ needs.parse-env.outputs.source-folder }}
@@ -103,6 +108,7 @@ jobs:
103108

104109
steps:
105110
- uses: tschm/cradle/actions/[email protected]
111+
if: hashFiles('pyproject.toml') != ''
106112
with:
107113
title: ${{ needs.parse-env.outputs.title }}
108114
links: |
@@ -112,3 +118,12 @@ jobs:
112118
"Test Report": "./tests/html-report/report.html",
113119
"Notebooks": "./marimushka/index.html"
114120
}
121+
122+
- uses: tschm/cradle/actions/[email protected]
123+
if: hashFiles('pyproject.toml') == ''
124+
with:
125+
title: ${{ needs.parse-env.outputs.title }}
126+
links: |
127+
{
128+
"Notebooks": "./marimushka/index.html"
129+
}

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ jobs:
3434
# Steps represent a sequence of tasks that will be executed as part of the job
3535
steps:
3636
- name: "Build the virtual environment for ${{ github.repository }}"
37+
if: hashFiles('pyproject.toml') != ''
3738
uses: tschm/cradle/actions/[email protected]
3839
with:
3940
python-version: ${{ matrix.python-version }}
4041

4142
- uses: tschm/cradle/actions/[email protected]
43+
if: hashFiles('pyproject.toml') != ''
4244
with:
4345
tests-folder: src/tests

.github/workflows/deptry.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545

4646
steps:
4747
- name: Run deptry
48+
if: hashFiles('pyproject.toml') != ''
4849
uses: tschm/cradle/actions/[email protected]
4950
with:
5051
source-folder: ${{ needs.parse-env.outputs.source-folder }}

.github/workflows/release.yml

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -51,63 +51,44 @@ jobs:
5151
git push origin ${{ github.event.inputs.tag }}
5252
5353
build:
54-
name: Build with Hatch
54+
name: Build
5555
runs-on: ubuntu-latest
5656
needs: tag
57-
outputs:
58-
built: ${{ steps.set_output.outputs.built }}
5957
steps:
6058
- name: Checkout Code
6159
uses: actions/checkout@v4
6260
with:
6361
fetch-depth: 0
6462

65-
- name: Check if pyproject.toml exists
66-
id: check_file
67-
run: |
68-
if [ -f "pyproject.toml" ]; then
69-
echo "exists=true" >> $GITHUB_OUTPUT
70-
else
71-
echo "exists=false" >> $GITHUB_OUTPUT
72-
fi
73-
7463
- name: Set up Python
75-
if: steps.check_file.outputs.exists == 'true'
7664
uses: actions/setup-python@v5
7765
with:
7866
python-version: '3.13'
7967

80-
- name: Install Hatch
81-
if: steps.check_file.outputs.exists == 'true'
68+
- name: Build
69+
if: hashFiles('pyproject.toml') != ''
8270
run: |
8371
pip install --upgrade pip
8472
pip install hatch
8573
86-
- name: Set version from tag in pyproject.toml
87-
if: steps.check_file.outputs.exists == 'true'
88-
run: |
8974
version=${{ github.event.inputs.tag }}
9075
version=${version#v}
9176
echo "Setting version to $version"
9277
sed -i.bak "s/^version = .*/version = \"$version\"/" pyproject.toml
9378
rm pyproject.toml.bak
9479
95-
- name: Build Package
96-
if: steps.check_file.outputs.exists == 'true'
97-
run: hatch build
80+
hatch build
81+
82+
echo "Uploading dist/"
83+
tar -cf dist.tar dist
9884
99-
- name: Upload dist/
100-
if: steps.check_file.outputs.exists == 'true'
85+
- name: Upload dist artifact
86+
# not tested at runtime!
87+
if: hashFiles('pyproject.toml') != ''
10188
uses: actions/upload-artifact@v4
10289
with:
10390
name: dist
104-
path: dist/
105-
106-
- name: Set build output
107-
id: set_output
108-
run: |
109-
echo "built=${{ steps.check_file.outputs.exists }}" >> $GITHUB_OUTPUT
110-
91+
path: dist.tar
11192

11293
release:
11394
name: Create GitHub Release
@@ -120,45 +101,65 @@ jobs:
120101
with:
121102
fetch-depth: 0
122103

123-
- name: Download dist artifact (if any)
124-
if: needs.build.outputs.built == 'true'
104+
- name: Download dist artifact
105+
if: hashFiles('pyproject.toml') != ''
125106
uses: actions/download-artifact@v4
126107
with:
127108
name: dist
128109
path: dist
129110

130-
- name: Create GitHub Release with artifacts
131-
if: needs.build.outputs.built == 'true'
132-
uses: softprops/[email protected]
133-
with:
134-
tag_name: ${{ github.event.inputs.tag }}
135-
name: ${{ github.event.inputs.tag }}
136-
generate_release_notes: true
137-
files: dist/*
111+
- name: Extract dist.tar
112+
if: hashFiles('pyproject.toml') != ''
113+
run: |
114+
if [[ -f dist/dist.tar ]]; then
115+
echo "Extracting dist.tar"
116+
tar -xf dist/dist.tar -C dist
117+
rm dist/dist.tar
118+
else
119+
echo "No dist.tar found; skipping extract"
120+
fi
138121
139-
- name: Create GitHub Release without artifacts
140-
if: needs.build.outputs.built == 'false'
122+
#- name: Warn if no artifacts found
123+
# run: |
124+
# if [[ ! -d dist || -z "$(ls -A dist)" ]]; then
125+
# echo "::warning::No files found in dist/. Release will be created without artifacts."
126+
# fi
127+
128+
- name: Create GitHub Release with artifacts
141129
uses: softprops/[email protected]
142130
with:
143131
tag_name: ${{ github.event.inputs.tag }}
144132
name: ${{ github.event.inputs.tag }}
145133
generate_release_notes: true
134+
files: "dist/**"
146135

147136
pypi:
148137
name: Publish to PyPI
149138
runs-on: ubuntu-latest
150139
environment: release
151140
needs: [build, tag]
152-
if: needs.build.outputs.built == 'true'
153141

154142
steps:
155143
- name: Download dist artifact
156144
uses: actions/download-artifact@v4
157145
with:
158146
name: dist
159147
path: dist
148+
continue-on-error: true
149+
150+
- name: Check if dist contains artifacts
151+
id: check_dist
152+
if: hashFiles('pyproject.toml') != ''
153+
run: |
154+
if [[ ! -d dist || -z "$(ls -A dist)" ]]; then
155+
echo "::warning::No artifacts found in dist/. Skipping PyPI publish."
156+
echo "should_publish=false" >> $GITHUB_OUTPUT
157+
else
158+
echo "should_publish=true" >> $GITHUB_OUTPUT
159+
fi
160160
161161
- name: Publish to PyPI
162+
if: steps.check_dist.outputs.should_publish == 'true'
162163
uses: pypa/gh-action-pypi-publish@release/v1
163164
with:
164165
packages-dir: dist/

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ repos:
4343
hooks:
4444
- id: validate-pyproject
4545

46-
- repo: https://github.com/crate-ci/typos
47-
rev: v1.35.1
48-
hooks:
49-
- id: typos
46+
#- repo: https://github.com/crate-ci/typos
47+
# rev: v1.35.1
48+
# hooks:
49+
# - id: typos

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ endif
1616
SOURCE_FOLDER ?= src
1717
TESTS_FOLDER ?= src/tests
1818
MARIMO_FOLDER ?= book/marimo
19+
OPTIONS ?=
1920

2021
.DEFAULT_GOAL := help
2122

22-
.PHONY: help verify install fmt lint test build check marimo clean docs
23+
.PHONY: help verify install fmt lint deptry test build check marimo clean docs pyproject
2324

2425
##@ Development Setup
2526

@@ -36,7 +37,7 @@ install: uv ## Install all dependencies using uv
3637

3738
fmt: uv ## Run code formatters only
3839
@printf "$(BLUE)Running formatters...$(RESET)\n"
39-
@uvx ruff format src
40+
@uvx ruff format .
4041

4142
lint: uv ## Run linters only
4243
@printf "$(BLUE)Running linters...$(RESET)\n"
@@ -45,6 +46,10 @@ lint: uv ## Run linters only
4546
check: lint test ## Run all checks (lint and test)
4647
@printf "$(GREEN)All checks passed!$(RESET)\n"
4748

49+
deptry: uv ## Run deptry (use OPTIONS="--your-options" to pass options)
50+
@printf "$(BLUE)Running deptry...$(RESET)\n"
51+
@uvx deptry $(SOURCE_FOLDER) $(OPTIONS)
52+
4853
##@ Testing
4954

5055
test: install ## Run all tests

0 commit comments

Comments
 (0)