Skip to content

Commit f8ba2a5

Browse files
committed
Move to boolean types
1 parent 13044e8 commit f8ba2a5

29 files changed

+72
-74
lines changed

copier-helper.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ uvx copier copy --defaults --force --trust \
1515
--data project_name="example-project" \
1616
--data project_description="Example" \
1717
--data project_features="[python_data_science, python_package]" \
18-
--data use_github="y" \
18+
--data use_github=true \
1919
--data open_source_license="MIT license" \
20-
--data aws="n" \
20+
--data aws=false \
2121
"$TEMPLATE_DIR" "$OUT_DIR"
2222

2323
echo "Generated at: $OUT_DIR"

copier.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ _templates_suffix: .jinja
77

88
author:
99
type: str
10-
default: "Florian Maas"
10+
default: "Switchbox"
1111
help: Your full name
1212

1313
email:
1414
type: str
15-
default: "fpgmaas@gmail.com"
15+
default: "hello@switch.box"
1616
help: Your email address
1717

1818
author_github_handle:
1919
type: str
20-
default: "fpgmaas"
20+
default: "switchbox-data"
2121
help: Your GitHub handle (without @)
2222

2323
project_name:
@@ -32,13 +32,13 @@ project_slug:
3232

3333
project_description:
3434
type: str
35-
default: "This is a template repository for Python projects that use uv for their dependency management."
35+
default: "This is a repository for modern data science projects."
3636

3737
type_checker:
3838
type: str
3939
choices: ["mypy", "ty"]
4040
default: "ty"
41-
when: "{{ python == 'y' }}"
41+
when: "{{ python }}"
4242

4343
project_features:
4444
type: str
@@ -51,9 +51,8 @@ project_features:
5151
help: "Select project features (use space to select/deselect, enter to confirm)"
5252

5353
use_github:
54-
type: str
55-
choices: ["y", "n"]
56-
default: "y"
54+
type: bool
55+
default: true
5756
help: Include GitHub Actions and issue templates
5857

5958
open_source_license:
@@ -68,30 +67,29 @@ open_source_license:
6867
default: "MIT license"
6968

7069
aws:
71-
type: str
72-
choices: ["y", "n"]
73-
default: "y"
70+
type: bool
71+
default: true
7472

7573
# Computed variables
7674
python:
77-
type: str
78-
default: "{{ 'y' if ('python_data_science' in project_features or 'python_package' in project_features) else 'n' }}"
75+
type: bool
76+
default: "{{ 'python_data_science' in project_features or 'python_package' in project_features }}"
7977
when: false
8078

8179
# Backward compatibility computed variables
8280
python_data_science:
83-
type: str
84-
default: "{{ 'y' if 'python_data_science' in project_features else 'n' }}"
81+
type: bool
82+
default: "{{ 'python_data_science' in project_features }}"
8583
when: false
8684

8785
python_package:
88-
type: str
89-
default: "{{ 'y' if 'python_package' in project_features else 'n' }}"
86+
type: bool
87+
default: "{{ 'python_package' in project_features }}"
9088
when: false
9189

9290
r_data_science:
93-
type: str
94-
default: "{{ 'y' if 'r_data_science' in project_features else 'n' }}"
91+
type: bool
92+
default: "{{ 'r_data_science' in project_features }}"
9593
when: false
9694

9795
# Post-generation tasks

template/.devcontainer/devcontainer.json.jinja

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@
22
"name": "{{ project_name }}",
33
"image": "mcr.microsoft.com/devcontainers/ubuntu:jammy",
44
"features": {
5-
"ghcr.io/guiyomh/features/just:0.1.0": { "version": "1.42.4" }{% if python == 'y' %},
6-
"ghcr.io/devcontainers/features/python:1": { "version": "3.13" }{% endif %}{% if r_data_science == 'y' %},
5+
"ghcr.io/guiyomh/features/just:0.1.0": { "version": "1.42.4" }{% if python %},
6+
"ghcr.io/devcontainers/features/python:1": { "version": "3.13" }{% endif %}{% if r_data_science %},
77
"ghcr.io/rocker-org/devcontainer-features/r-rig:1": {
88
"version": "4.4.3",
99
"installREnv": true,
1010
"installRMarkdown": true,
1111
"vscodeRSupport": true,
1212
"installVscDebugger": true,
1313
"installRadian": true
14-
}{% endif %}{% if python_data_science == 'y' or r_data_science == 'y' %},
14+
}{% endif %}{% if python_data_science or r_data_science %},
1515
"ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": {
1616
"version": "1.7.33",
1717
"installChromium": true
1818
},
1919
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
2020
"packages": "chromium python3-tk"
21-
}{% endif %}{% if aws == 'y' %},
21+
}{% endif %}{% if aws %},
2222
"ghcr.io/devcontainers/features/aws-cli:1": {
2323
"version": "2.27.4"
2424
}{% endif %}
25-
},{% if python_data_science == 'y' %}
25+
},{% if python_data_science %}
2626
"containerEnv": {
2727
"QUARTO_PYTHON": "/workspaces/{{ project_name }}/.venv/bin/python"
28-
},{% endif %}{% if aws == 'y' %}
28+
},{% endif %}{% if aws %}
2929
"initializeCommand": "mkdir -p ${localEnv:HOME}/.aws",
3030
"mounts": [
3131
"source=${localEnv:HOME}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached"
@@ -38,18 +38,18 @@
3838
"vscode": {
3939
"extensions": [
4040
"tamasfe.even-better-toml",
41-
"nefrob.vscode-just-syntax"{% if python == 'y' %},
41+
"nefrob.vscode-just-syntax"{% if python %},
4242
"ms-python.python",
4343
"charliermarsh.ruff"{% if type_checker == 'ty' %},
44-
"astral-sh.ty"{% endif %}{% endif %}{% if r_data_science == 'y' %},
44+
"astral-sh.ty"{% endif %}{% endif %}{% if r_data_science %},
4545
"REditorSupport.r",
4646
"RDebugger.r-debugger",
4747
"Posit.air-vscode",
48-
"tombi.tombi"{% endif %}{% if python_data_science == 'y' or r_data_science == 'y' %},
48+
"tombi.tombi"{% endif %}{% if python_data_science or r_data_science %},
4949
"quarto.quarto"{% endif %}
50-
]{% if python == 'y' or r_data_science == 'y' %},
50+
]{% if python or r_data_science %},
5151
"settings": {
52-
{% if python == 'y' %} "python.defaultInterpreterPath": "/workspaces/{{ project_name }}/.venv/bin/python",
52+
{% if python %} "python.defaultInterpreterPath": "/workspaces/{{ project_name }}/.venv/bin/python",
5353
"python.testing.pytestArgs": ["tests"],
5454
"python.testing.pytestPath": "/workspaces/{{ project_name }}/.venv/bin/pytest",
5555
"python.testing.unittestEnabled": false,
@@ -62,8 +62,8 @@
6262
"source.fixAll": "explicit",
6363
"source.organizeImports": "explicit"
6464
}
65-
}{% if r_data_science == 'y' %},{% endif %}
66-
{% endif %}{% if r_data_science == 'y' %} "r.bracketedPaste": true,
65+
}{% if r_data_science %},{% endif %}
66+
{% endif %}{% if r_data_science %} "r.bracketedPaste": true,
6767
"r.plot.useHttpgd": true,
6868
"r.rterm.linux": "/usr/local/bin/radian",
6969
"r.rterm.option": ["--no-save", "--no-restore"],

template/.gitignore.jinja

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% if python == 'y' %}# Python
1+
{% if python %}# Python
22
__pycache__/
33
*.py[cod]
44
*$py.class
@@ -48,7 +48,7 @@ env.bak/
4848
venv.bak/
4949

5050
{% endif %}
51-
{% if r_data_science == 'y' %}
51+
{% if r_data_science %}
5252
# R
5353
.Rhistory
5454
.Rapp.history
@@ -96,6 +96,6 @@ ehthumbs.db
9696
Thumbs.db
9797

9898
# Project specific
99-
{% if python_package == 'y' %}site/
100-
{% endif %}{% if python_data_science == 'y' %}.quarto/
99+
{% if python_package %}site/
100+
{% endif %}{% if python_data_science %}.quarto/
101101
{% endif %}tmp/

template/CONTRIBUTING.md.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Thank you for your interest in contributing to {{ project_name }}!
3232
just format
3333
```
3434

35-
{% if python_package == 'y' %}4. Build documentation:
35+
{% if python_package %}4. Build documentation:
3636
```bash
3737
just docs
3838
```

template/Justfile.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ default:
77
@just --list
88

99

10-
{% if python == 'y' %}# =============================================================================
10+
{% if python %}# =============================================================================
1111
# 🔍 CODE QUALITY & TESTING
1212
# =============================================================================
1313
# These commands check your code quality and run tests
@@ -74,11 +74,11 @@ build-and-publish: build publish
7474
# =============================================================================
7575
# These commands help you set up your development environment
7676

77-
{% if python == 'y' %}# Install the virtual environment and install the pre-commit hooks
77+
{% if python %}# Install the virtual environment and install the pre-commit hooks
7878
install:
7979
echo "🚀 Creating virtual environment using uv"
8080
.devcontainer/postCreateCommand.sh
8181

8282
{% endif %}# Clean generated files and caches
8383
clean:
84-
rm -rf{% if python == 'y' %} .pytest_cache .ruff_cache{% endif %}{% if python_package == 'y' %} site dist build{% endif %} tmp{% if python_data_science == 'y' %} notebooks/.quarto{% endif %}
84+
rm -rf{% if python %} .pytest_cache .ruff_cache{% endif %}{% if python_package %} site dist build{% endif %} tmp{% if python_data_science %} notebooks/.quarto{% endif %}

template/{% if python == 'y' %}.pre-commit-config.yaml{% endif %}.jinja renamed to template/{% if python %}.pre-commit-config.yaml{% endif %}.jinja

File renamed without changes.

template/{% if python == 'y' %}pyproject.toml{% endif %}.jinja renamed to template/{% if python %}pyproject.toml{% endif %}.jinja

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ readme = "README.md"
77
keywords = ['python']
88
requires-python = ">=3.9,<4.0"
99
dependencies = [
10-
{% if python_data_science == 'y' %} "polars>=1.32.3",
10+
{% if python_data_science %} "polars>=1.32.3",
1111
"pyarrow>=21.0.0",
1212
"seaborn>=0.13.2",
1313
"numpy>=2.0.2",
1414
"ipykernel>=6.30.1",
1515
"nbformat>=5.10.4",
1616
"nbclient>=0.10.2",
17-
{% endif %}{% if aws == 'y' %} "boto3>=1.7.84",
17+
{% endif %}{% if aws %} "boto3>=1.7.84",
1818
{% endif %}]
1919
classifiers = [
2020
"Intended Audience :: Developers",
@@ -29,7 +29,7 @@ classifiers = [
2929

3030
[project.urls]
3131
Repository = "https://github.com/{{ author_github_handle }}/{{ project_name }}"
32-
{% if python_package == 'y' %}Documentation = "https://{{ author_github_handle }}.github.io/{{ project_name }}/"
32+
{% if python_package %}Documentation = "https://{{ author_github_handle }}.github.io/{{ project_name }}/"
3333
{% endif %}
3434

3535
[dependency-groups]
@@ -41,7 +41,7 @@ dev = [
4141
{% if type_checker == 'mypy' %} "mypy>=1.8.0",
4242
{% endif %}{% if type_checker == 'ty' %} "ty>=0.0.1a16",
4343
{% endif %} "deptry>=0.20.0",
44-
{% if python_package == 'y' %} "mkdocs>=1.6.0",
44+
{% if python_package %} "mkdocs>=1.6.0",
4545
"mkdocs-material>=9.5.0",
4646
"mkdocstrings[python]>=0.26.1",
4747
"build>=1.0.0",

template/{% if python == 'y' %}tests{% endif %}/test_foo.py.jinja renamed to template/{% if python %}tests{% endif %}/test_foo.py.jinja

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)