Skip to content

Commit 3a92161

Browse files
authored
Merge pull request #29 from PowerGridModel/feat/add-uv-support
Switch to uv package manager for easy setup
2 parents a515f4d + 610af90 commit 3a92161

File tree

5 files changed

+2351
-52
lines changed

5 files changed

+2351
-52
lines changed

requirements.txt renamed to .pre-commit-config.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#
33
# SPDX-License-Identifier: MPL-2.0
44

5-
power-grid-model[doc] >= 1.9
6-
jupyter
7-
matplotlib
5+
repos:
6+
- repo: https://github.com/fsfe/reuse-tool
7+
rev: v5.0.2
8+
hooks:
9+
- id: reuse

README.md

Lines changed: 28 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -23,70 +23,49 @@ It is recommended to read the numpy structured array
2323

2424
Please create the relevant environment before the workshop. If you encounter problems, please raise a question in the [discussion board](https://github.com/orgs/PowerGridModel/discussions)
2525

26-
### Preparation for Windows (beginners guide)
27-
28-
1. [Download](https://github.com/PowerGridModel/power-grid-model-workshop/archive/refs/heads/main.zip) (or
29-
checkout) this workshop/repository and remember the destination location. For example:
30-
`C:\Users\YourUserName\Downloads\power-grid-model-workshop`.
31-
32-
1. Install the latest [Python](https://www.python.org/ftp/python/3.13.3/python-3.13.3-amd64.exe) version.
33-
You probably want the **Windows installer (64-bit)** under **Stable Release**.
34-
35-
1. Now open a terminal (Windows-Key + R, type `cmd`, press **OK**) and use the `cd` (change dir) command to navigate
36-
to the folder where you downloaded the workshop. For example:
37-
```shell
38-
C:\Users\YourUserName> cd Downloads\power-grid-model-workshop
39-
C:\Users\YourUserName\Downloads\power-grid-model-workshop>_
40-
```
41-
1. Optional: Create and activate a virtual environment. You can skip this step, but it helps you to keep your system
42-
clean, as we will be installing about 70 Python packages in the next step.
43-
```shell
44-
> python -m venv venv
45-
> venv\Scripts\activate
46-
```
47-
1. install Power Grid Model and some other packages we'll use for this workshop:
26+
### Preparation with uv (Windows/Mac/Linux)
27+
28+
1. Open a terminal
29+
- Windows: Press `Windows-Key + R`, type `cmd`, press **OK**
30+
- Mac/Linux: Open a terminal
31+
1. Download or clone this workshop/repository
32+
- if you download the repository, remember the destination location. For example:
33+
- Windows:`C:\Users\YourUserName\Downloads\power-grid-model-workshop`
34+
- Mac/Linux: `~/Downloads/power-grid-model-workshop`
35+
1. Install the `uv` package manager [link](https://docs.astral.sh/uv/getting-started/installation)
36+
for your operating system (Windows/Mac/Linux)
37+
1. Navigate to the repository folder
38+
- Windows: `cd Downloads\power-grid-model-workshop`
39+
- Mac/Linux: `cd ~/Downloads/power-grid-model-workshop`
40+
1. Setup python environment and install dependencies using `uv`:
4841
```shell
49-
> pip install power-grid-model jupyter pandas matplotlib
42+
uv sync
5043
```
51-
1. Now run jupyter notebook. It will probably (depending on your system) automatically open a browser at
44+
1. Start jupyter notebook. It will probably (depending on your system) automatically open a browser at
5245
http://localhost:8888. If not, the console output will tell you where to find the jupyter notebook server.
5346
```shell
54-
> jupyter notebook
47+
uv run jupyter notebook
5548
```
5649
1. Try any of the `.ipynb` files, for example
5750
[`Power Flow Example.ipynb`](http://localhost:8888/notebooks/examples/Power%20Flow%20Example.ipynb) and press the `>>`
5851
button to run the entire file. Note that the last section in the Power Flow Example is about error handling, so
5952
don't get scared if you see some error messages there.
6053
61-
6254
### Next time, pick up where you left off
6355
64-
1. Open a terminal (Windows-Key + R, type `cmd`, press **OK**) and use the `cd` (change dir) command to navigate
65-
to the folder where you downloaded the workshop. For example:
66-
```shell
67-
C:\Users\YourUserName> cd Downloads\power-grid-model-workshop
68-
C:\Users\YourUserName\Downloads\power-grid-model-workshop>_
69-
```
70-
2. Optional: Activate the virtual environment (if you created one initially).
71-
```shell
72-
> venv\Scripts\activate
73-
```
74-
3. Run jupyter notebook. It will probably (depending on your system) automatically open a browser at
56+
1. Again, open a terminal
57+
- Windows: Press `Windows-Key + R`, type `cmd`, press **OK**
58+
- Mac/Linux: Open a terminal
59+
1. Navigate to the repository folder
60+
- Example:
61+
- Windows: `cd Downloads\power-grid-model-workshop`
62+
- Mac/Linux: `cd ~/Downloads/power-grid-model-workshop`
63+
64+
1. Start jupyter notebook. It will probably (depending on your system) automatically open a browser at
7565
http://localhost:8888. If not, the console output will tell you where to find the jupyter notebook server.
7666
```shell
77-
> jupyter notebook
67+
uv run jupyter notebook
7868
```
79-
80-
### Preparation for WSL2 or Linux (for advanced users)
81-
82-
If you know WSL2/Linux you should be able to configure environment yourself.
83-
84-
```shell
85-
> pip install power-grid-model jupyter pandas
86-
> jupyter notebook
87-
```
88-
89-
Open the jupyter notebook [`Power Flow Example.ipynb`](http://localhost:8888/Power%20Flow%20Example.ipynb), try to run it.
9069
9170
## License
9271

pyproject.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
2+
#
3+
# SPDX-License-Identifier: MPL-2.0
4+
5+
[project]
6+
name = "power-grid-model-workshop"
7+
version = "0.1.0"
8+
description = "A collection of Jupyter notebooks for Power Grid Model workshops"
9+
readme = "README.md"
10+
requires-python = ">=3.12"
11+
dependencies = [
12+
"jupyter>=1.1.1",
13+
"matplotlib>=3.10.1",
14+
"pandas>=2.2.3",
15+
"power-grid-model[doc]>=1.10.88",
16+
"power-grid-model-ds[visualizer]>=1.2.4",
17+
]
18+
19+
[tool.setuptools]
20+
packages = []

0 commit comments

Comments
 (0)