Skip to content

Commit ef1ed9a

Browse files
committed
build: migrate from just to mise for task management
- Removes Justfile and python.just in favor of mise tasks - Adds new mise task scripts for common operations - Updates package manager configurations and gitignore - Improves help text for template variables
1 parent c2017a6 commit ef1ed9a

16 files changed

Lines changed: 158 additions & 54 deletions

copier.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ _external_data:
88
shared: "{{ answers_file_shared }}"
99

1010
_migrations:
11+
- rm --force --verbose ".config/copier/python.just"
1112
- rm --force --verbose ".github/copier/.copier-answers.python.yaml"
13+
- rm --force --verbose ".github/copier/mkdocs.yaml"
1214
- rm --force --verbose ".github/linters/.ruff.toml"
1315
- rm --force --verbose ".github/linters/pyrightconfig.json"
1416
- rm --force --verbose ".github/workflows/docs.yaml"
1517
- rm --force --verbose ".github/workflows/shared-docs.yaml"
1618
- rm --force --verbose ".github/workflows/shared-release.yaml"
1719

1820
_skip_if_exists:
21+
- .config/mise/config.toml
1922
- .envrc
2023
- .gitignore
2124
- .ruff.toml
@@ -35,7 +38,9 @@ _skip_if_exists:
3538
_subdirectory: template
3639

3740
_tasks:
41+
- rm --force --verbose ".config/copier/python.just"
3842
- rm --force --verbose ".github/copier/.copier-answers.python.yaml"
43+
- rm --force --verbose ".github/copier/mkdocs.yaml"
3944
- rm --force --verbose ".github/linters/.ruff.toml"
4045
- rm --force --verbose ".github/linters/pyrightconfig.json"
4146
- rm --force --verbose ".github/workflows/docs.yaml"
@@ -83,10 +88,12 @@ github_repo:
8388

8489
namespace:
8590
type: str
91+
help: e.g. "namespace", ""
8692
default: "{{ github_user }}"
8793

8894
package_dir:
8995
type: str
96+
help: e.g. "namespace/project_name_slug/", "project_name_slug/"
9097
default: |-
9198
{%- if namespace -%}
9299
{{ namespace | replace('.', '/') | replace('-', '_') }}/{{ project_name_slug | replace('-', '_') }}
@@ -96,6 +103,7 @@ package_dir:
96103
97104
package_name:
98105
type: str
106+
help: e.g. "namespace-project-name-slug", "project-name-slug"
99107
default: |-
100108
{%- if namespace -%}
101109
{{ namespace | replace('.', '-') | replace('/', '-') }}-{{ project_name_slug | replace('_', '-') }}
@@ -105,6 +113,7 @@ package_name:
105113
106114
wheel_package_dir:
107115
type: str
116+
help: e.g. "namespace/", "project_name_slug/"
108117
default: |-
109118
{{ package_dir.split('/') | first }}
110119
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
# This file is @generated by <https://github.com/liblaf/copier-python>.
3+
# DO NOT EDIT!
4+
set -o errexit
5+
set -o nounset
6+
set -o pipefail
7+
8+
function is-true() {
9+
case "${1,,}" in
10+
1 | on | true | y | yes) return 0 ;;
11+
0 | off | false | n | no | "") return 1 ;;
12+
*)
13+
echo "Invalid boolean: $1." >&2
14+
exit 1
15+
;;
16+
esac
17+
}
18+
19+
if is-true "${CI-}"; then
20+
pytest --codspeed "$@"
21+
else
22+
pytest --benchmark-only --benchmark-autosave --numprocesses="0" "$@"
23+
fi
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# This file is @generated by <https://github.com/liblaf/copier-python>.
3+
# DO NOT EDIT!
4+
set -o errexit
5+
set -o nounset
6+
set -o pipefail
7+
8+
CODE="import lazy_loader as lazy
9+
10+
__getattr__, __dir__, __all__ = lazy.attach_stub(__name__, __file__)"
11+
N_LINES=$(echo "$CODE" | wc --lines)
12+
13+
git_root=$(git rev-parse --show-toplevel)
14+
readarray -t files < <(fd --fixed-strings --type file '__init__.pyi' "$git_root")
15+
for file in "${files[@]}"; do
16+
file="${file/%".pyi"/".py"}"
17+
if [[ ! -f $file ]]; then
18+
echo "$CODE" > "$file"
19+
continue
20+
fi
21+
last_lines=$(tail --lines="$N_LINES" "$file")
22+
if ! diff <(echo "$last_lines") <(echo "$CODE") &> /dev/null; then
23+
echo "$CODE" >> "$file"
24+
fi
25+
done
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# This file is @generated by <https://github.com/liblaf/copier-python>.
3+
# DO NOT EDIT!
4+
set -o errexit
5+
set -o nounset
6+
set -o pipefail
7+
8+
if [[ -f "pixi.lock" ]]; then
9+
pixi install
10+
fi
11+
12+
if [[ -f "uv.lock" ]]; then
13+
uv sync
14+
fi
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# This file is @generated by <https://github.com/liblaf/copier-python>.
3+
# DO NOT EDIT!
4+
set -o errexit
5+
set -o nounset
6+
set -o pipefail
7+
8+
ruff format
9+
ruff check --fix
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# This file is @generated by <https://github.com/liblaf/copier-python>.
3+
# DO NOT EDIT!
4+
set -o errexit
5+
set -o nounset
6+
set -o pipefail
7+
8+
sort-toml .ruff.toml pyproject.toml
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
# This file is @generated by <https://github.com/liblaf/copier-python>.
3+
# DO NOT EDIT!
4+
set -o errexit
5+
set -o nounset
6+
set -o pipefail
7+
8+
function is-true() {
9+
case "${1,,}" in
10+
1 | on | true | y | yes) return 0 ;;
11+
0 | off | false | n | no | "") return 1 ;;
12+
*)
13+
echo "Invalid boolean: $1." >&2
14+
exit 1
15+
;;
16+
esac
17+
}
18+
19+
if is-true "${CI-}"; then
20+
pytest --junit-xml="junit.xml" --cov --cov-branch --benchmark-disable --numprocesses="auto" "$@"
21+
else
22+
pytest --benchmark-disable --numprocesses="auto" "$@"
23+
fi
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
#MISE depends_post=["lint"]
3+
# This file is @generated by <https://github.com/liblaf/copier-python>.
4+
# DO NOT EDIT!
5+
set -o errexit
6+
set -o nounset
7+
set -o pipefail
8+
9+
if [[ -f "pixi.lock" ]]; then
10+
pixi upgrade
11+
fi
12+
13+
if [[ -f "uv.lock" ]]; then
14+
uv sync --upgrade
15+
fi

template/.config/copier/mkdocs.yaml.jinja

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- mode: yaml; -*-
2-
# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json
32
# This file is @generated by <https://github.com/liblaf/copier-python>.
43
# DO NOT EDIT!
54

template/.config/copier/python.just

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

0 commit comments

Comments
 (0)