Skip to content

Commit 03a20f0

Browse files
committed
Update JS tooling, normalize jinja vars
1 parent dab14f1 commit 03a20f0

File tree

134 files changed

+917
-677
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+917
-677
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ SED = sed -i '' -e
1818
endif
1919

2020

21+
.PHONY: lint fix format test
22+
lint: ## lint this repo
23+
fix: ## fix formatting in this repo
24+
format: fix
25+
test: ## run tests for this repo
26+
2127
.PHONY: gen-python gen-cpp gen-js gen-jupyter gen-rust gen-rustjswasm
2228
gen-python: ## regenerate the python template from scratch
2329
mkdir -p ../python-template && cd ../python-template && rm -rf ./* && rm -rf .copier-answers.yaml .gitignore .github .gitattributes

cpp/.gitignore.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ js/*.tgz
133133
.ipynb_checkpoints
134134
.autoversion
135135
Untitled*.ipynb
136-
{{module}}/extension
137-
{{module}}/nbextension
138-
{{module}}/labextension
136+
{{ module }}/extension
137+
{{ module }}/nbextension
138+
{{ module }}/labextension
139139

140140
# Mac
141141
.DS_Store

cpp/LICENSE.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2025 {{team}}
189+
Copyright 2025 {{ team }}
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

cpp/Makefile.jinja

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ install: ## install python library
2323
#########
2424
.PHONY: lint-py lint-cpp lint-docs lint lints
2525
lint-py: ## run python linter with ruff
26-
python -m ruff check {{module}}
27-
python -m ruff format --check {{module}}
26+
python -m ruff check {{ module }}
27+
python -m ruff format --check {{ module }}
2828

2929
lint-cpp: ## run cpp linter
3030
clang-format --dry-run -Werror -i -style=file `find ./cpp -name "*.*pp"`
@@ -40,8 +40,8 @@ lints: lint
4040

4141
.PHONY: fix-py fix-cpp fix format
4242
fix-py: ## fix python formatting with ruff
43-
python -m ruff check --fix {{module}}
44-
python -m ruff format {{module}}
43+
python -m ruff check --fix {{ module }}
44+
python -m ruff format {{ module }}
4545

4646
fix-cpp: ## fix cpp formatting
4747
clang-format -i -style=file `find ./cpp -name "*.*pp"`
@@ -76,13 +76,13 @@ check: checks
7676
#########
7777
.PHONY: test-py tests-py coverage-py
7878
test-py: ## run python tests
79-
python -m pytest -v {{module}}/tests
79+
python -m pytest -v {{ module }}/tests
8080

8181
# alias
8282
tests-py: test-py
8383

8484
coverage-py: ## run python tests and collect test coverage
85-
python -m pytest -v {{module}}/tests --cov={{module}} --cov-report term-missing --cov-report xml
85+
python -m pytest -v {{ module }}/tests --cov={{ module }} --cov-report term-missing --cov-report xml
8686

8787
.PHONY: test coverage tests
8888
test: test-py ## run all tests

cpp/README.md.jinja

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# {{project_name}}
1+
# {{ project_name }}
22

3-
{{project_description}}
3+
{{ project_description }}
44

5-
[![Build Status](https://github.com/{{github}}/{{project_name_formatted}}/actions/workflows/build.yaml/badge.svg?branch=main&event=push)](https://github.com/{{github}}/{{project_name_formatted}}/actions/workflows/build.yaml)
6-
[![codecov](https://codecov.io/gh/{{github}}/{{project_name_formatted}}/branch/main/graph/badge.svg)](https://codecov.io/gh/{{github}}/{{project_name_formatted}})
7-
[![License](https://img.shields.io/github/license/{{github}}/{{project_name_formatted}})](https://github.com/{{github}}/{{project_name_formatted}})
8-
[![PyPI](https://img.shields.io/pypi/v/{{project_name_formatted}}.svg)](https://pypi.python.org/pypi/{{project_name_formatted}})
5+
[![Build Status](https://github.com/{{ github }}/{{ project_name_formatted }}/actions/workflows/build.yaml/badge.svg?branch=main&event=push)](https://github.com/{{ github }}/{{ project_name_formatted }}/actions/workflows/build.yaml)
6+
[![codecov](https://codecov.io/gh/{{ github }}/{{ project_name_formatted }}/branch/main/graph/badge.svg)](https://codecov.io/gh/{{ github }}/{{ project_name_formatted }})
7+
[![License](https://img.shields.io/github/license/{{ github }}/{{ project_name_formatted }})](https://github.com/{{ github }}/{{ project_name_formatted }})
8+
[![PyPI](https://img.shields.io/pypi/v/{{ project_name_formatted }}.svg)](https://pypi.python.org/pypi/{{ project_name_formatted }})
99

1010
## Overview
1111

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#include "{{project_name_formatted}}/extension.hpp"
1+
#include "{{ project_name_formatted }}/extension.hpp"
22

33
int add(int i, int j) { return i + j; }

cpp/pyproject.toml.jinja

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ requires = [
77
build-backend = "hatchling.build"
88

99
[project]
10-
name = "{{project_name_formatted}}"
10+
name = "{{ project_name_formatted }}"
1111
authors = [
12-
{name = "{{team}}", email = "{{email}}"},
12+
{name = "{{ team }}", email = "{{ email }}"},
1313
]
14-
description = "{{project_description}}"
14+
description = "{{ project_description }}"
1515
readme = "README.md"
1616
license = { text = "Apache-2.0" }
1717
version = "0.1.0"
@@ -57,8 +57,8 @@ develop = [
5757
[project.scripts]
5858

5959
[project.urls]
60-
Repository = "https://github.com/{{github}}/{{project_name_formatted}}"
61-
Homepage = "https://github.com/{{github}}/{{project_name_formatted}}"
60+
Repository = "https://github.com/{{ github }}/{{ project_name_formatted }}"
61+
Homepage = "https://github.com/{{ github }}/{{ project_name_formatted }}"
6262

6363
[tool.bumpversion]
6464
current_version = "0.1.0"
@@ -67,7 +67,7 @@ tag = true
6767
commit_args = "-s"
6868

6969
[[tool.bumpversion.files]]
70-
filename = "{{module}}/__init__.py"
70+
filename = "{{ module }}/__init__.py"
7171
search = '__version__ = "{current_version}"'
7272
replace = '__version__ = "{new_version}"'
7373

@@ -96,7 +96,7 @@ skip = "*win32 *arm_64"
9696
[tool.coverage.run]
9797
branch = true
9898
omit = [
99-
"{{module}}/tests/integration/",
99+
"{{ module }}/tests/integration/",
100100
]
101101

102102
[tool.coverage.report]
@@ -110,9 +110,9 @@ fail_under = 50
110110

111111
[tool.hatch.build]
112112
artifacts = [
113-
"{{module}}/*.dll",
114-
"{{module}}/*.dylib",
115-
"{{module}}/*.so",
113+
"{{ module }}/*.dll",
114+
"{{ module }}/*.dylib",
115+
"{{ module }}/*.so",
116116
]
117117

118118
[tool.hatch.build.sources]
@@ -121,26 +121,26 @@ src = "/"
121121
[tool.hatch.build.hooks.hatch-cpp]
122122
verbose = true
123123
libraries = [
124-
{name = "{{module}}/extension", sources = ["cpp/{{project_name_formatted}}/extension.cpp"], include-dirs = ["cpp"], binding="pybind11"}
124+
{name = "{{ module }}/extension", sources = ["cpp/{{ project_name_formatted }}/extension.cpp"], include-dirs = ["cpp"], binding="pybind11"}
125125
]
126126

127127
[tool.hatch.build.targets.sdist]
128128
packages = [
129-
"{{module}}",
129+
"{{ module }}",
130130
"cpp",
131131
]
132132

133133
[tool.hatch.build.targets.wheel]
134134
packages = [
135-
"{{module}}",
135+
"{{ module }}",
136136
]
137137

138138
[tool.pytest.ini_options]
139139
addopts = [
140140
"-vvv",
141141
"--junitxml=junit.xml",
142142
]
143-
testpaths = "{{module}}/tests"
143+
testpaths = "{{ module }}/tests"
144144

145145
[tool.ruff]
146146
line-length = 150
@@ -154,7 +154,7 @@ extend-select = [
154154
combine-as-imports = true
155155
default-section = "third-party"
156156
known-first-party = [
157-
"{{module}}",
157+
"{{ module }}",
158158
]
159159
section-order = [
160160
"future",
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
## Pre-requisites
22

3-
You need Python >=3.10 on your machine to install `{{project_name_formatted}}`.
3+
You need Python >=3.10 on your machine to install `{{ project_name_formatted }}`.
44

55
## Install with `pip`
66

77
```bash
8-
pip install {{project_name_formatted}}
8+
pip install {{ project_name_formatted }}
99
```
1010

1111
## Install with `conda`
1212

1313
```bash
14-
conda install {{project_name_formatted}} --channel conda-forge
14+
conda install {{ project_name_formatted }} --channel conda-forge
1515
```
1616

1717
## Source installation
1818

19-
For other platforms and for development installations, [build `{{project_name_formatted}}` from source](Build-from-Source).
19+
For other platforms and for development installations, [build `{{ project_name_formatted }}` from source](Build-from-Source).
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
_This wiki is autogenerated. To made updates, open a PR against the original source file in [`docs/wiki`](https://github.com/{{github}}/{{project_name_formatted}}/tree/main/docs/wiki)._
1+
_This wiki is autogenerated. To made updates, open a PR against the original source file in [`docs/wiki`](https://github.com/{{ github }}/{{ project_name_formatted }}/tree/main/docs/wiki)._

cpp/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
`{{project_name_formatted}}` is written in Python. While prebuilt wheels are provided for end users, it is also straightforward to build `{{project_name_formatted}}` from either the Python [source distribution](https://packaging.python.org/en/latest/specifications/source-distribution-format/) or the GitHub repository.
1+
`{{ project_name_formatted }}` is written in Python. While prebuilt wheels are provided for end users, it is also straightforward to build `{{ project_name_formatted }}` from either the Python [source distribution](https://packaging.python.org/en/latest/specifications/source-distribution-format/) or the GitHub repository.
22

33
- [Make commands](#make-commands)
44
- [Prerequisites](#prerequisites)
@@ -10,7 +10,7 @@
1010

1111
## Make commands
1212

13-
As a convenience, `{{project_name_formatted}}` uses a `Makefile` for commonly used commands. You can print the main available commands by running `make` with no arguments
13+
As a convenience, `{{ project_name_formatted }}` uses a `Makefile` for commonly used commands. You can print the main available commands by running `make` with no arguments
1414

1515
```bash
1616
> make
@@ -25,15 +25,15 @@ test run the tests
2525

2626
## Prerequisites
2727

28-
`{{project_name_formatted}}` has a few system-level dependencies which you can install from your machine package manager. Other package managers like `conda`, `nix`, etc, should also work fine.
28+
`{{ project_name_formatted }}` has a few system-level dependencies which you can install from your machine package manager. Other package managers like `conda`, `nix`, etc, should also work fine.
2929

3030
## Clone
3131

3232
Clone the repo with:
3333

3434
```bash
35-
git clone https://github.com/{{github}}/{{project_name_formatted}}.git
36-
cd {{project_name_formatted}}
35+
git clone https://github.com/{{ github }}/{{ project_name_formatted }}.git
36+
cd {{ project_name_formatted }}
3737
```
3838

3939
## Install Python dependencies
@@ -56,7 +56,7 @@ make build
5656

5757
## Lint and Autoformat
5858

59-
`{{project_name_formatted}}` has linting and auto formatting.
59+
`{{ project_name_formatted }}` has linting and auto formatting.
6060

6161
| Language | Linter | Autoformatter | Description |
6262
| :------- | :---------- | :------------ | :---------- |
@@ -90,7 +90,7 @@ make fix-docs
9090

9191
## Testing
9292

93-
`{{project_name_formatted}}` has extensive Python tests. The tests can be run via `pytest`. First, install the Python development dependencies with
93+
`{{ project_name_formatted }}` has extensive Python tests. The tests can be run via `pytest`. First, install the Python development dependencies with
9494

9595
```bash
9696
make develop

0 commit comments

Comments
 (0)