Skip to content

Commit

Permalink
Change default location of Python installations (#1142)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek authored Dec 14, 2023
1 parent 0029e35 commit ba53753
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
3 changes: 1 addition & 2 deletions docs/config/hatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ The following values have special meanings:

| Value | Path |
| --- | --- |
| `shared` (default) | `~/.pythons` |
| `isolated` | `<DATA_DIR>/pythons` |
| `isolated` (default) | `<DATA_DIR>/pythons` |

## Terminal

Expand Down
1 change: 1 addition & 0 deletions docs/history/hatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- Fix regression in calling subprocesses with updated PATH
- Fix automatic installation of environment plugins when running as a standalone binary
- Change default location of Python installations

## [1.8.0](https://github.com/pypa/hatch/releases/tag/hatch-v1.8.0) - 2023-12-11 ## {: #hatch-v1.8.0 }

Expand Down
3 changes: 0 additions & 3 deletions src/hatch/cli/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,6 @@ def get_python_manager(self, directory: str | None = None):
from hatch.python.core import PythonManager

configured_dir = directory or self.config.dirs.python
if configured_dir == 'shared':
return PythonManager(Path.home() / '.pythons')

if configured_dir == 'isolated':
return PythonManager(self.data_dir / 'pythons')

Expand Down
2 changes: 1 addition & 1 deletion src/hatch/config/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def python(self):

self._field_python = python
else:
self._field_python = self.raw_data['python'] = 'shared'
self._field_python = self.raw_data['python'] = 'isolated'

return self._field_python

Expand Down
4 changes: 2 additions & 2 deletions tests/cli/config/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_default_scrubbed(hatch, config_file, helpers, default_cache_dir, defaul
[dirs]
project = []
python = "shared"
python = "isolated"
data = "{default_data_directory}"
cache = "{default_cache_directory}"
Expand Down Expand Up @@ -71,7 +71,7 @@ def test_reveal(hatch, config_file, helpers, default_cache_dir, default_data_dir
[dirs]
project = []
python = "shared"
python = "isolated"
data = "{default_data_directory}"
cache = "{default_cache_directory}"
Expand Down
6 changes: 3 additions & 3 deletions tests/config/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_default(default_cache_dir, default_data_dir):
'dirs': {
'project': [],
'env': {},
'python': 'shared',
'python': 'isolated',
'data': str(default_data_dir),
'cache': str(default_cache_dir),
},
Expand Down Expand Up @@ -348,14 +348,14 @@ def test_default(self, default_cache_dir, default_data_dir):
default_data_directory = str(default_data_dir)
assert config.dirs.project == config.dirs.project == []
assert config.dirs.env == config.dirs.env == {}
assert config.dirs.python == config.dirs.python == 'shared'
assert config.dirs.python == config.dirs.python == 'isolated'
assert config.dirs.cache == config.dirs.cache == default_cache_directory
assert config.dirs.data == config.dirs.data == default_data_directory
assert config.raw_data == {
'dirs': {
'project': [],
'env': {},
'python': 'shared',
'python': 'isolated',
'data': default_data_directory,
'cache': default_cache_directory,
},
Expand Down

0 comments on commit ba53753

Please sign in to comment.