You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: hatch/README.md
+51-10Lines changed: 51 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,15 +76,50 @@ Within the Hatch project, you can create virtual environments which are defined
76
76
$ hatch env create <envname>
77
77
```
78
78
79
-
Actually, you never need to manually create the environment, as spawning a shell or running commands within a project will automatically
80
-
trigger the environment creation.
79
+
Actually, you never need to manually create the environment, as spawning a shell (see 2 activate the virtual environment) or running commands within a project will automatically trigger the environment creation.
81
80
82
-
Where the virtual environments would be created? Well, it depends on the operation systems you are using. For my case, I am using Ubuntu,
83
-
the directory that contains the virtual environments are:
81
+
Where the virtual environments would be created? It's determined by the following heuristic order:
82
+
- The `patch` option
83
+
- configured `virtual` environment directory
84
+
85
+
In my case, the directory that contains the virtual environments are:
Using the `env show` command to list all available virtual environments:
@@ -99,14 +134,12 @@ $ hatch shell
99
134
100
135
#### 3. Manage Python packages
101
136
102
-
At the time of writing, Hatch does not support dependency lock files, this feature is on roadmap, but until then you will need to
137
+
When you run `hatch shell`, Hatch will automatically spawn the environment and install the Python packages listed in `dependencies`.
138
+
139
+
In active state of the environment, at the time of writing, Hatch does not support dependency lock files, this feature is on roadmap, but until then you will need to
103
140
use `pip`, `pip-tools`, or other package management tools alongside Hatch.
104
141
105
-
Here, we use `pip` to manage Python packages,
106
-
107
-
```bash
108
-
$ pip install <package-name>
109
-
```
142
+
And, for now you will need to hand-curate the dependencies in `pyproject.toml`.
110
143
111
144
112
145
#### 4. Deactivate the virtual environment
@@ -130,3 +163,11 @@ $ hatch env prune
130
163
131
164
## Different Python versions?
132
165
166
+
Virtual environments necessarily require a parent installtion of Python. The Python choice used to create the environment is determined by the version of Python found on your system, or you can set `HATCH_PYTHON` environment variable.
167
+
168
+
```bash
169
+
export HATCH_PYTHON=/usr/bin/python3.11
170
+
```
171
+
172
+
If no version has been chosen, the resolver will try to find a version that matches
173
+
the version of Python that Hatch is currently running on.
0 commit comments