Skip to content

Commit 185a98d

Browse files
committed
remove troubleshooting
1 parent 83248d9 commit 185a98d

1 file changed

Lines changed: 2 additions & 59 deletions

File tree

best_practice/python_environments.md

Lines changed: 2 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Working with Python Environments
66

77
## Managing Python Versions and Virtual Environments with uv
88

9-
Most projects we work on require Python 3.8 or greater. A few projects may require an even later version. In either case it is necessary to be able to have multiple versions of Python installed and easily switch between them, as well as manage project-specific dependencies. We use [uv](https://github.com/astral-sh/uv) to handle both Python version management and virtual environments.
9+
Most projects we work on require Python 3.9 or greater. Many require a later version. In either case it is necessary to be able to have multiple versions of Python installed and easily switch between them, as well as manage project-specific dependencies. We use [uv](https://github.com/astral-sh/uv) to handle both Python version management and virtual environments.
1010

1111
### Installing uv
1212

@@ -259,21 +259,6 @@ Install from a requirements file:
259259
uv pip sync requirements.txt
260260
```
261261

262-
### Environment Variables
263-
264-
Useful environment variables for uv:
265-
266-
- `UV_PYTHON`: Set default Python version
267-
- `UV_INDEX_URL`: Set custom package index
268-
- `UV_CACHE_DIR`: Set cache directory location
269-
- `UV_SYSTEM_PYTHON`: Use system Python instead of managed versions
270-
271-
Example:
272-
273-
```shell
274-
UV_PYTHON=3.11 uv sync
275-
```
276-
277262
## Migrating from Other Tools
278263

279264
### From pip/venv
@@ -299,51 +284,9 @@ To fully migrate, you may want to:
299284
2. Delete `poetry.lock`
300285
3. Run `uv sync` to generate `uv.lock`
301286

302-
### From pipenv
303-
304-
Convert `Pipfile` to `pyproject.toml` then:
305-
306-
```shell
307-
uv sync
308-
```
309-
310-
## Best Practices
311-
312-
1. **Always commit `uv.lock`**: This ensures reproducible builds across all environments
313-
2. **Use `.python-version` files**: Pin Python versions per project with `uv python pin`
314-
3. **Specify version bounds carefully**: Use `>=` for minimum versions, `<` for maximum
315-
4. **Separate dev dependencies**: Use `--dev` flag for development-only packages
316-
5. **Use dependency groups**: Organize optional dependencies (docs, testing, etc.)
317-
318-
## Troubleshooting
319-
320-
### Python version not found
321-
322-
If uv can't find a Python version, install it:
323-
324-
```shell
325-
uv python install 3.11
326-
```
327-
328-
### Cache issues
329-
330-
Clear the cache if you encounter issues:
331-
332-
```shell
333-
uv cache clean
334-
```
335-
336-
### Slow package resolution
337-
338-
Use `--resolution lowest` for faster resolves:
339-
340-
```shell
341-
uv sync --resolution lowest
342-
```
343-
344287
## Further Reading
345288

346289
* [uv Documentation](https://docs.astral.sh/uv/)
347290
* [uv Python Discovery](https://docs.astral.sh/uv/guides/python/)
348291
* [uv Configuration](https://docs.astral.sh/uv/configuration/)
349-
* [Migrating to uv](https://docs.astral.sh/uv/guides/migration/)
292+
* [Migrating to uv](https://docs.astral.sh/uv/guides/migration/)

0 commit comments

Comments
 (0)