Calculate Pi via the Monte Carlo method
Project description
Calculating Pi with Modern Tooling
We need a few things:
- a CLI tool to specify the number of iterations and the number of cores it runs on:
picarlo --cores 4 --iterations 10000 - a library that can be imported in a notebook
[!CAUTION] The CLI requires a few more dependencies like
typer
Tooling setup (runs on each commit)
-
uv self update&uv sync --group dev - linting/format checking:
uv run ruff check - auto-formatting:
uv run ruff format - type checking:
uv run pyrefly check - testing:
uv run pytest - integrate into pre-commit
pre-commit run --all-files - use maturin framework to run MC via Rust
- build a GitHub actions pipeline to run prior to merge into
main(and post to publish to PyPi) - run tests in parallel
- split between dev and prod dependencies:
uv add --group dev - add a build system, hatchling in pyproject.toml
- run a build
uv build
Checks
- Check that the package can be installed:
uv run --with picarlo --no-project -- python -c "import picarlo"
Goal
- run from command-line (uvx)
- import lib into notebook (either via PyPi or from local dist)
- published module
Useful stuff
- Create docstrings via LLM
- Create docs from docstrings
- Calculate test coverage
- Tracing
- server-sent event via starlette
More interesting stuff
- parallelism, e.g. concurrent.futures (see prime number example)
- bulk python version testing through tox
Release preparation
- Generate Changelog:
make changelog(requires Conventional Commits) - Bump Version: Update
pyproject.tomlandCargo.toml - Build:
make build - Publish:
make publish
Commit Convention
This project uses Conventional Commits to automate changelog generation.
feat: ...for new featuresfix: ...for bug fixesdocs: ...for documentationperf: ...for performance improvements
Example: git commit -m "feat: add parallel processing support"
vscode extensions
- Ruff
- TOML syntax highlighting
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file picarlo-0.4.5.tar.gz.
File metadata
- Download URL: picarlo-0.4.5.tar.gz
- Upload date:
- Size: 124.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d10c3c700fb0772160581b1ab450c184851fedcca00de86b91e198d991b1aea
|
|
| MD5 |
5a0d9ef93170f41320eaaa1848809c02
|
|
| BLAKE2b-256 |
4e55d63220e59174b8199d0c8e1be9ac21601ea6d2110417334d1437e91d5ed6
|
Provenance
The following attestation bundles were made for picarlo-0.4.5.tar.gz:
Publisher:
ci.yml on hendrikfrentrup/picarlo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
picarlo-0.4.5.tar.gz -
Subject digest:
4d10c3c700fb0772160581b1ab450c184851fedcca00de86b91e198d991b1aea - Sigstore transparency entry: 742590220
- Sigstore integration time:
-
Permalink:
hendrikfrentrup/picarlo@91b4c6542572c300ab5a3c73c96f2b980789f2f6 -
Branch / Tag:
refs/tags/0.4.5 - Owner: https://github.com/hendrikfrentrup
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@91b4c6542572c300ab5a3c73c96f2b980789f2f6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file picarlo-0.4.5-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: picarlo-0.4.5-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 246.4 kB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
daa0dc763199cf6e71c1de8854c1fae160fab0b58e87f4dc456f6e4018557c5b
|
|
| MD5 |
d1d71ade9eaff370a8c7f6c06767a4fd
|
|
| BLAKE2b-256 |
807830aa9ab3e193924cbbccae916aef09d8cc68c958b446c4100e51f2be11ef
|
Provenance
The following attestation bundles were made for picarlo-0.4.5-cp312-cp312-manylinux_2_34_x86_64.whl:
Publisher:
ci.yml on hendrikfrentrup/picarlo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
picarlo-0.4.5-cp312-cp312-manylinux_2_34_x86_64.whl -
Subject digest:
daa0dc763199cf6e71c1de8854c1fae160fab0b58e87f4dc456f6e4018557c5b - Sigstore transparency entry: 742590225
- Sigstore integration time:
-
Permalink:
hendrikfrentrup/picarlo@91b4c6542572c300ab5a3c73c96f2b980789f2f6 -
Branch / Tag:
refs/tags/0.4.5 - Owner: https://github.com/hendrikfrentrup
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@91b4c6542572c300ab5a3c73c96f2b980789f2f6 -
Trigger Event:
release
-
Statement type: