Update README.md

This commit is contained in:
2026-06-03 15:23:54 +02:00
parent 878b8bc5b0
commit f262c4386c
+16 -16
View File
@@ -54,7 +54,7 @@ You always stay at the **repo root** for Git operations and use `--project` to p
INSTRUMENT-CONTROL/
├── .gitignore
├── README.md
├── automated-iv-curves/
├── your-project-folder/
│ ├── pyproject.toml ← declares your dependencies (commit this)
│ ├── uv.lock ← locks exact versions (commit this)
│ ├── .python-version ← pins the Python version (commit this)
@@ -83,10 +83,10 @@ Pick one version and stick to it across all projects unless you have a specific
From the **repo root**, run:
```bash
uv init --python 3.12 automated-iv-curves
uv init --python 3.12 your-project-folder
```
This creates the following inside `automated-iv-curves/`:
This creates the following inside `your-project-folder/`:
- `pyproject.toml` — the project's metadata and dependency list
- `uv.lock` — a locked snapshot of the full dependency tree (including sub-dependencies)
- `.python-version` — a one-line file that just says `3.12`
@@ -98,7 +98,7 @@ The `.venv/` folder doesn't exist yet — it gets created the first time you add
## Adding packages
```bash
uv --project automated-iv-curves add numpy matplotlib scipy
uv --project your-project-folder add numpy matplotlib scipy
```
This does three things at once: updates `pyproject.toml` with the new dependencies, resolves the full dependency tree into `uv.lock`, and installs everything into `.venv/`. You never need to manually `pip install` anything.
@@ -108,7 +108,7 @@ This does three things at once: updates `pyproject.toml` with the new dependenci
## Running a script
```bash
uv --project automated-iv-curves run python automated-iv-curves/measure.py
uv --project your-project-folder run python your-project-folder/measure.py
```
`uv run` automatically uses the project's environment — no need to activate anything first for one-off script runs.
@@ -119,18 +119,18 @@ uv --project automated-iv-curves run python automated-iv-curves/measure.py
First add Jupyter to the project:
```bash
uv --project automated-iv-curves add jupyter
uv --project your-project-folder add jupyter
```
Then activate the environment and launch:
```bash
source automated-iv-curves/.venv/bin/activate
source your-project-folder/.venv/bin/activate
jupyter lab
```
You need to activate here (rather than use `uv run`) because Jupyter is an interactive session, not a one-off command. After activating, your terminal prompt will change to show `(.venv)` — this means all `python`, `jupyter`, and other commands will use the project's environment until you run `deactivate`.
Create or open any `.ipynb` file inside `automated-iv-curves/` and it will have access to all the project's packages. Before committing notebooks, clear the outputs (`Kernel → Restart & Clear Output`) to keep your Git diffs clean.
Create or open any `.ipynb` file inside `your-project-folder/` and it will have access to all the project's packages. Before committing notebooks, clear the outputs (`Kernel → Restart & Clear Output`) to keep your Git diffs clean.
---
@@ -138,15 +138,15 @@ Create or open any `.ipynb` file inside `automated-iv-curves/` and it will have
To confirm which Python a project is using:
```bash
uv --project automated-iv-curves run python --version
uv --project your-project-folder run python --version
# or just read the pin file directly:
cat automated-iv-curves/.python-version
cat your-project-folder/.python-version
```
To change it:
```bash
uv --project automated-iv-curves python pin 3.12
uv --project your-project-folder python pin 3.12
```
---
@@ -158,13 +158,13 @@ uv --project automated-iv-curves python pin 3.12
git pull
# Add a new package
uv --project automated-iv-curves add pyvisa
uv --project your-project-folder add pyvisa
# Run your script
uv --project automated-iv-curves run python automated-iv-curves/measure.py
uv --project your-project-folder run python your-project-folder/measure.py
# Commit the updated dependency files
git add automated-iv-curves/pyproject.toml automated-iv-curves/uv.lock
git add your-project-folder/pyproject.toml your-project-folder/uv.lock
git commit -m "add pyvisa dependency"
git push
```
@@ -176,7 +176,7 @@ git push
The `.venv/` folder is gitignored, so it doesn't exist on a fresh clone. `uv sync` recreates it from `uv.lock`:
```bash
uv --project automated-iv-curves sync
uv --project your-project-folder sync
```
You need this in two situations:
@@ -284,7 +284,7 @@ It's not sensitive or machine-specific — committing it means any collaborator
If you set up the `.gitignore` after Git already started tracking `.venv/`, the file won't be automatically un-tracked — `.gitignore` only prevents *new* files from being added. To fix this:
```bash
git rm -r --cached automated-iv-curves/.venv/
git rm -r --cached your-project-folder/.venv/
git commit -m "untrack .venv"
```