Skip to content

Commit b51bc13

Browse files
zzzappyGuen Prawiroatmodjo
authored andcommitted
Initial commit
--------- Co-authored-by: Guen Prawiroatmodjo <4041805+guenp@users.noreply.github.com>
0 parents  commit b51bc13

86 files changed

Lines changed: 17853 additions & 0 deletions

Some content is hidden

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

.copier-answers.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2+
_commit: 2025.05.02-33-g6daa488
3+
_src_path: gh:scientific-python/cookie
4+
backend: poetry
5+
email: deltakit@riverlane.com
6+
full_name: Riverlane
7+
license: Apache
8+
org: Deltakit
9+
project_name: crumpy
10+
project_short_description: A python library for visualizing Crumble circuits in Jupyter
11+
url: https://github.com/Deltakit/crumpy
12+
vcs: true

.git_archival.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node: $Format:%H$
2+
node-date: $Format:%cI$
3+
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git_archival.txt export-subst

.github/CONTRIBUTING.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
See the [Scientific Python Developer Guide][spc-dev-intro] for a detailed
2+
description of best practices for developing scientific packages.
3+
4+
[spc-dev-intro]: https://learn.scientific-python.org/development/
5+
6+
# Quick development
7+
8+
The fastest way to start with development is to use nox. If you don't have nox,
9+
you can use `uvx nox` to run it without installing, or `uv tool install nox`. If
10+
you don't have uv, you can
11+
[install it a variety of ways](https://docs.astral.sh/uv/getting-started/installation/),
12+
including with pip, pipx, brew, and just downloading the binary (single file).
13+
14+
To use, run `nox`. This will lint and test using every installed version of
15+
Python on your system, skipping ones that are not installed. You can also run
16+
specific jobs:
17+
18+
```console
19+
$ nox -s lint # Lint only
20+
$ nox -s tests # Python tests
21+
$ nox -s docs # Build and serve the docs
22+
$ nox -s build # Make an SDist and wheel
23+
```
24+
25+
Nox handles everything for you, including setting up an temporary virtual
26+
environment for each run.
27+
28+
# Setting up a development environment manually
29+
30+
You can set up a development environment by running:
31+
32+
```bash
33+
uv sync
34+
```
35+
36+
# Pre-commit
37+
38+
You should prepare pre-commit, which will help you by checking that commits pass
39+
required checks:
40+
41+
```bash
42+
uv tool install pre-commit # or brew install pre-commit on macOS
43+
pre-commit install # Will install a pre-commit hook into the git repo
44+
```
45+
46+
You can also/alternatively run `pre-commit run` (changes only) or
47+
`pre-commit run --all-files` to check even without installing the hook.
48+
49+
# Testing
50+
51+
Use pytest to run the unit checks:
52+
53+
```bash
54+
uv run pytest
55+
```
56+
57+
# Coverage
58+
59+
Use pytest-cov to generate coverage reports:
60+
61+
```bash
62+
uv run pytest --cov=crumpy
63+
```
64+
65+
# Building docs
66+
67+
You can build and serve the docs using:
68+
69+
```bash
70+
nox -s docs
71+
```
72+
73+
You can build the docs only with:
74+
75+
```bash
76+
nox -s docs --non-interactive
77+
```

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
groups:
9+
actions:
10+
patterns:
11+
- "*"

.github/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
changelog:
2+
exclude:
3+
authors:
4+
- dependabot
5+
- pre-commit-ci

.github/workflows/cd.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: CD
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
release:
10+
types:
11+
- published
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
env:
18+
# Many color libraries just need this to be set to any value, but at least
19+
# one distinguishes color depth, where "3" -> "256-bit color".
20+
FORCE_COLOR: 3
21+
22+
jobs:
23+
dist:
24+
name: Distribution build
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- uses: actions/checkout@v5
29+
with:
30+
fetch-depth: 0
31+
- name: Set up Node.js
32+
uses: actions/setup-node@v5
33+
with:
34+
node-version: "22.x"
35+
- name: Install Node.js dependencies and build JS
36+
run: |
37+
cd ./src/js
38+
npm ci
39+
npm run build
40+
# Upload the built JavaScript files as an artifact
41+
- name: Upload JavaScript build artifacts
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: bundle.js
45+
path: ./src/crumpy/bundle.js
46+
47+
- uses: hynek/build-and-inspect-python-package@v2
48+
49+
build-docs:
50+
needs: [dist]
51+
runs-on: ubuntu-latest
52+
permissions:
53+
contents: read
54+
pages: write
55+
id-token: write
56+
environment:
57+
name: github-pages
58+
url: ${{ steps.deploy-pages.outputs.page_url }}
59+
if:
60+
(github.event_name == 'release' && github.event.action == 'published') ||
61+
github.ref == 'refs/heads/main'
62+
steps:
63+
- name: Checkout repo
64+
uses: actions/checkout@v5
65+
66+
- name: Fetch tags
67+
run: git fetch --tags
68+
69+
- name: Set up Python
70+
uses: actions/setup-python@v6
71+
with:
72+
python-version: "3.x"
73+
74+
- name: Set up UV
75+
uses: astral-sh/setup-uv@v6
76+
77+
- name: Install Pandoc
78+
run: |
79+
sudo apt-get update
80+
sudo apt-get install -y pandoc
81+
82+
- name: Download JavaScript build artifacts
83+
uses: actions/download-artifact@v5
84+
with:
85+
name: bundle.js
86+
path: src/crumpy
87+
88+
- name: Build documentation
89+
run: |
90+
uvx nox -s docs
91+
92+
- name: Configure GitHub Pages
93+
uses: actions/configure-pages@v5
94+
95+
- name: Upload Pages artifact
96+
uses: actions/upload-pages-artifact@v4
97+
with:
98+
path: docs/_build/html
99+
100+
- name: Deploy to GitHub Pages
101+
id: deploy-pages
102+
uses: actions/deploy-pages@v4
103+
104+
publish:
105+
needs: [dist]
106+
name: Publish to PyPI
107+
environment: pypi
108+
permissions:
109+
id-token: write
110+
attestations: write
111+
contents: read
112+
runs-on: ubuntu-latest
113+
if: github.event_name == 'release' && github.event.action == 'published'
114+
115+
steps:
116+
- uses: actions/download-artifact@v5
117+
with:
118+
name: Packages
119+
path: dist
120+
121+
- name: Generate artifact attestation for sdist and wheel
122+
uses: actions/attest-build-provenance@v3
123+
with:
124+
subject-path: "dist/*"
125+
126+
- uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/ci.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
# Many color libraries just need this variable to be set to any value.
16+
# Set it to 3 to support 8-bit color graphics (256 colors per channel)
17+
# for libraries that care about the value set.
18+
FORCE_COLOR: 3
19+
20+
jobs:
21+
pre-commit:
22+
name: Format
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v5
26+
with:
27+
fetch-depth: 0
28+
- uses: actions/setup-python@v6
29+
with:
30+
python-version: "3.x"
31+
32+
- uses: astral-sh/setup-uv@v6
33+
34+
- uses: pre-commit/action@v3.0.1
35+
with:
36+
extra_args: --hook-stage manual --all-files
37+
- name: Run Pylint
38+
run: uvx nox -s pylint -- --output-format=github
39+
40+
checks:
41+
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
42+
runs-on: ${{ matrix.runs-on }}
43+
needs: [pre-commit]
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
python-version: ["3.11", "3.12", "3.13"]
48+
runs-on: [ubuntu-latest, windows-latest, macos-14]
49+
50+
steps:
51+
- uses: actions/checkout@v5
52+
with:
53+
fetch-depth: 0
54+
55+
- uses: actions/setup-python@v6
56+
with:
57+
python-version: ${{ matrix.python-version }}
58+
allow-prereleases: true
59+
60+
- name: Set up Node.js
61+
uses: actions/setup-node@v5
62+
with:
63+
node-version: "22.x"
64+
65+
- name: Install Node.js dependencies and build JS
66+
run: |
67+
cd ./src/js
68+
npm ci
69+
npm run build
70+
71+
- uses: astral-sh/setup-uv@v6
72+
73+
- name: Install package
74+
run: uv sync
75+
76+
- name: Test package
77+
run: >-
78+
uv run pytest -ra --cov --cov-report=xml --cov-report=term
79+
--durations=20
80+
81+
- name: Upload coverage report
82+
uses: codecov/codecov-action@v5
83+
with:
84+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)