Skip to content

hbeukers/simulation-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to get started

Clone repository

Go in your terminal to the folder where you want to clone the repo and run

git clone https://github.com/hbeukers/simulation-tutorial.git

Install and sync uv

To use this repo you need uv installed.

Go to the repo folder and run

uv sync

Depending on the availability of the packages on your platform it might need some time to build, just let it run.

This should be enough to set everything up, including all packages and python version.

Run Jupyter notebooks

Use one of the following methods to run the notebooks in the notebooks folder:

VS Code

Install the Jupyter extension. Open the notebook in VS Code and select as kernel .venv. Now you can run the notebooks in VS Code.

Jupyter server

You can also start a Jupyter server in the more traditional way by working in the browser. Run the following command in the folder of the repository.

uv run jupyter lab

How this repository was set up

The repo was set up using the following commands:

Go to the folder were you have your repositories

uv init simulation-tutorial --lib

To install the wanted packages

uv add xarray[io, parallel, viz]
uv add multiprocess
uv add tqdm
uv add jupyter
uv add qutip
uv add lmfit
uv add ruff --dev

Change python version

uv python pin 3.13
uv sync

Add the following lines to pyproject.toml such that the project becomes an editable install and we can import modules from our own repository.

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/simulation_tutorial"]

Add the following lines to pyproject.toml to make sure ruff also formats jupyter notebooks, directly fixes linting issues and also sorts the imports

[tool.ruff]
extend-include = ["*.ipynb"]
fix = true

[tool.ruff.lint]
extend-select = ["I"]

You can format the code with

uv run ruff format

and lint using

uv run ruff check

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published