Skip to content

Update from copier (2025-07-29T22:54:16) #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .copier-answers.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Changes here will be overwritten by Copier
_commit: c53b04c
_commit: e29838a
_src_path: https://github.com/python-project-templates/base.git
add_docs: true
add_wiki: true
add_extension: rust
add_wiki: true
email: 3105306+timkpaine@users.noreply.github.com
github: python-project-templates
project_description: A Rust-Python project template
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:

- name: Make dist
run: |
make dist-rust
make dist-rs
make dist-py-sdist
make dist-py-wheel
make dist-check
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/wiki.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Docs

on:
push:
branches:
- main
paths:
- "docs/**"
- "README.md"
workflow_dispatch:

concurrency:
group: docs
cancel-in-progress: true

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cp README.md docs/wiki/Home.md
- uses: Andrew-Chen-Wang/github-wiki-action@v4
with:
path: docs/wiki
50 changes: 29 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#########
# BUILD #
#########
.PHONY: develop-py develop-rust develop
.PHONY: develop-py develop-rs develop
develop-py:
uv pip install -e .[develop]

develop-rust:
develop-rs:
make -C rust develop

develop: develop-rust develop-py ## setup project for development
develop: develop-rs develop-py ## setup project for development

.PHONY: build-py build-rust build dev
.PHONY: build-py build-rs build dev
build-py:
maturin build

build-rust:
build-rs:
make -C rust build

dev: build ## lightweight in-place build for iterative dev
$(_CP_COMMAND)

build: build-rust build-py ## build the project
build: build-rs build-py ## build the project

.PHONY: install
install: ## install python library
Expand All @@ -36,28 +36,36 @@ endif
#########
# LINTS #
#########
.PHONY: lint-py lint-rust lint lints
.PHONY: lint-py lint-rs lint-docs lint lints
lint-py: ## run python linter with ruff
python -m ruff check python_template_rust
python -m ruff format --check python_template_rust

lint-rust: ## run rust linter
lint-rs: ## run rust linter
make -C rust lint

lint: lint-rust lint-py ## run project linters
lint-docs: ## lint docs with mdformat and codespell
python -m mdformat --check README.md docs/wiki/
python -m codespell_lib README.md docs/wiki/

lint: lint-rs lint-py lint-docs ## run project linters

# alias
lints: lint

.PHONY: fix-py fix-rust fix format
.PHONY: fix-py fix-rs fix-docs fix format
fix-py: ## fix python formatting with ruff
python -m ruff check --fix python_template_rust
python -m ruff format python_template_rust

fix-rust: ## fix rust formatting
fix-rs: ## fix rust formatting
make -C rust fix

fix: fix-rust fix-py ## run project autoformatters
fix-docs: ## autoformat docs with mdformat and codespell
python -m mdformat README.md docs/wiki/
python -m codespell_lib --write README.md docs/wiki/

fix: fix-rs fix-py fix-docs ## run project autoformatters

# alias
format: fix
Expand Down Expand Up @@ -88,19 +96,19 @@ tests-py: test-py
coverage-py: ## run python tests and collect test coverage
python -m pytest -v python_template_rust/tests --cov=python_template_rust --cov-report term-missing --cov-report xml

.PHONY: test-rust tests-rust coverage-rust
test-rust: ## run rust tests
.PHONY: test-rs tests-rs coverage-rs
test-rs: ## run rust tests
make -C rust test

# alias
tests-rust: test-rust
tests-rs: test-rs

coverage-rust: ## run rust tests and collect test coverage
coverage-rs: ## run rust tests and collect test coverage
make -C rust coverage

.PHONY: test coverage tests
test: test-py test-rust ## run all tests
coverage: coverage-py coverage-rust ## run all tests and collect test coverage
test: test-py test-rs ## run all tests
coverage: coverage-py coverage-rs ## run all tests and collect test coverage

# alias
tests: test
Expand All @@ -125,21 +133,21 @@ major: ## bump a major version
########
# DIST #
########
.PHONY: dist-py-wheel dist-py-sdist dist-rust dist-check dist publish
.PHONY: dist-py-wheel dist-py-sdist dist-rs dist-check dist publish

dist-py-wheel: # build python wheel
python -m cibuildwheel --output-dir dist

dist-py-sdist: # build python sdist
python -m build --sdist -o dist

dist-rust: # build rust dists
dist-rs: # build rust dists
make -C rust dist

dist-check: ## run python dist checker with twine
python -m twine check dist/*

dist: clean build dist-rust dist-py-wheel dist-py-sdist dist-check ## build all dists
dist: clean build dist-rs dist-py-wheel dist-py-sdist dist-check ## build all dists

publish: dist # publish python assets

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ A Rust-Python project template

## Overview


> [!NOTE]
> This library was generated using [copier](https://copier.readthedocs.io/en/stable/) from the [Base Python Project Template repository](https://github.com/python-project-templates/base).
1 change: 1 addition & 0 deletions docs/wiki/_Footer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_This wiki is autogenerated. To made updates, open a PR against the original source file in [`docs/wiki`](https://github.com/python-project-templates/python-template-rust/tree/main/docs/wiki)._
16 changes: 16 additions & 0 deletions docs/wiki/_Sidebar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!--
This sidebar is displayed on the GitHub Wiki section instead of the default sidebar.
Notes for editors:
- Ensure links don't have the file extensions (i.e., `.md`)
- Do not use colons (':') in page titles, they don't render properly as links in the sidebar
- Use only the filenames in this page (without the filepath and file extension)
-->

**[Home](Home)**

**Get Started**

- [Installation](Installation)
- [Contributing](Contribute)
- [Development Setup](Local-Development-Setup)
- [Build from Source](Build-from-Source)
127 changes: 127 additions & 0 deletions docs/wiki/contribute/Build-from-Source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
`python-template-rust` is written in Python and Rust. While prebuilt wheels are provided for end users, it is also straightforward to build `python-template-rust` from either the Python [source distribution](https://packaging.python.org/en/latest/specifications/source-distribution-format/) or the GitHub repository.

- [Make commands](#make-commands)
- [Prerequisites](#prerequisites)
- [Clone](#clone)
- [Install Python dependencies](#install-python-dependencies)
- [Build](#build)
- [Lint and Autoformat](#lint-and-autoformat)
- [Testing](#testing)

## Make commands

As a convenience, `python-template-rust` uses a `Makefile` for commonly used commands. You can print the main available commands by running `make` with no arguments

```bash
> make

build build the library
clean clean the repository
fix run autofixers
install install library
lint run lints
test run the tests
```

## Prerequisites

`python-template-rust` 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.

## Clone

Clone the repo with:

```bash
git clone https://github.com/python-project-templates/python-template-rust.git
cd python-template-rust
```

## Install Rust

Follow the instructions for [installing Rust](https://rustup.rs) for your system.

## Install Python dependencies

Python build and develop dependencies are specified in the `pyproject.toml`, but you can manually install them:

```bash
make requirements
```

Note that these dependencies would otherwise be installed normally as part of [PEP517](https://peps.python.org/pep-0517/) / [PEP518](https://peps.python.org/pep-0518/).

## Build

Build the python project in the usual manner:

```bash
make build
```

## Lint and Autoformat

`python-template-rust` has linting and auto formatting.

| Language | Linter | Autoformatter | Description |
| :------- | :---------- | :------------ | :---------- |
| Python | `ruff` | `ruff` | Style |
| Python | `ruff` | `ruff` | Imports |
| Rust | `clippy` | `clippy` | Style |
| Markdown | `mdformat` | `mdformat` | Style |
| Markdown | `codespell` | | Spelling |

**Python Linting**

```bash
make lint-py
```

**Python Autoformatting**

```bash
make fix-py
```

**Rust Linting**

```bash
make lint-rs
```

**Rust Autoformatting**

```bash
make fix-rs
```

**Documentation Linting**

```bash
make lint-docs
```

**Documentation Autoformatting**

```bash
make fix-docs
```

## Testing

`python-template-rust` has both Python and JavaScript tests. The bulk of the functionality is tested in Python, which can be run via `pytest`. First, install the Python development dependencies with

```bash
make develop
```

**Python**

```bash
make test-py
```

**Rust**

```bash
make test-rs
```
15 changes: 15 additions & 0 deletions docs/wiki/contribute/Contribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Contributions are welcome on this project. We distribute under the terms of the [Apache 2.0 license](https://github.com/python-project-templates/python-template-rust/blob/main/LICENSE).

> [!NOTE]
>
> `python-template-rust` requires [Developer Certificate of Origin](https://en.wikipedia.org/wiki/Developer_Certificate_of_Origin) for all contributions.
> This is enforced by a [Probot GitHub App](https://probot.github.io/apps/dco/), which checks that commits are "signed".
> Read [instructions to configure commit signing](Local-Development-Setup#configure-commit-signing).

For **bug reports** or **small feature requests**, please open an issue on our [issues page](https://github.com/python-project-templates/python-template-rust/issues).

For **questions** or to discuss **larger changes or features**, please use our [discussions page](https://github.com/python-project-templates/python-template-rust/discussions).

For **contributions**, please see our [developer documentation](Local-Development-Setup). We have `help wanted` and `good first issue` tags on our issues page, so these are a great place to start.

For **documentation updates**, make PRs that update the pages in `/docs/wiki`. The documentation is pushed to the GitHub wiki automatically through a GitHub workflow. Note that direct updates to this wiki will be overwritten.
Loading
Loading