Skip to content

Commit 6370a54

Browse files
committed
update installation instructions to uv
1 parent f1a21b0 commit 6370a54

File tree

2 files changed

+49
-18
lines changed

2 files changed

+49
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ simulations and produce high-quality figures.
1010
This command line tool is built around a generic interface that allows you to
1111
access StagYY output data directly in a Python script.
1212

13-
You can install StagPy with `pip` from the [Python Package
13+
You can install StagPy from the [Python Package
1414
Index](https://pypi.org/project/stagpy/).
1515

1616
If StagPy has been useful to your research, please consider citing the project

docs/user-guide/install.md

Lines changed: 48 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,70 @@
11
Installation
22
============
33

4-
You will need Python 3.8 or higher to use StagPy. StagPy is available on
5-
the Python Package Index, via `pip`.
4+
StagPy is available on the [Python Package
5+
Index](https://pypi.org/project/stagpy/).
66

7-
If you don't have sufficient permissions to install or update Python, you can
8-
use [pyenv to manage Python](https://github.com/pyenv/pyenv).
7+
You can use [uv to manage Python environments](https://docs.astral.sh/uv/).
98

10-
Installation using `pip`
9+
Installation as a CLI tool
1110
--------------------------
1211

13-
In most cases, installing StagPy with `pip` should be as simple as:
12+
If you are interested in using the `stagpy` command line interface,
13+
you can install it as a tool with uv:
1414

1515
```sh title="shell"
16-
python3 -m pip install stagpy
16+
uv tool install stagpy
1717
```
1818

19-
It might be preferable or even necessary to install StagPy in a virtual
20-
environment to isolate it from other packages that could conflict with it:
19+
This installs `stagpy` in its own environment, isolated from other packages to
20+
avoid conflicts.
21+
22+
You can then update StagPy with the following command:
2123

2224
```sh title="shell"
23-
python3 -m venv stagpyenv
24-
source stagpyenv/bin/activate
25-
python3 -m pip install stagpy
25+
uv tool upgrade stagpy
2626
```
2727

28-
You can then update StagPy with the following command:
28+
[More information about uv tools](https://docs.astral.sh/uv/concepts/tools/).
29+
30+
Installation in a uv managed environment
31+
----------------------------------------
32+
33+
A convenient way to use StagPy in script is by leveraging uv environments.
34+
35+
With the following (setting versions as desired for your project):
36+
37+
```toml title="pyproject.toml"
38+
[project]
39+
name = "my-project"
40+
version = "0.1.0"
41+
requires-python = ">=3.10"
42+
dependencies = [
43+
"stagpy~=0.19.0",
44+
]
45+
```
46+
47+
You can then run a script using `stagpy`, for example:
48+
49+
```py title="my_script.py"
50+
import stagpy
51+
52+
print(stagpy.__version__)
53+
```
54+
55+
with the following command
56+
57+
```sh title="shell"
58+
uv run my_script.py
59+
```
60+
61+
You can run any arbitrary command via uv, including `stagpy`
62+
itself:
2963

3064
```sh title="shell"
31-
python3 -m pip install -U stagpy
65+
uv run -- stagpy version
3266
```
3367

34-
See the [official
35-
documentation](https://packaging.python.org/en/latest/tutorials/installing-packages/)
36-
for more information about installing Python packages.
3768

3869
Some setup
3970
----------

0 commit comments

Comments
 (0)