Skip to content

Commit 8282ecd

Browse files
authored
refactor!: config_reader to tmuxp._internal (#897)
Fixes #894
2 parents 5daa1ae + a631e6f commit 8282ecd

17 files changed

+22
-19
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ $ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force
2424
- libtmux: 0.24.1 -> 0.25.0, maintenance release (#896)
2525

2626
Improve styling via pydocstyle.
27+
- `config_reader`: Move to `tmuxp._internal` (#897)
2728

2829
## tmuxp 1.33.0 (2023-12-21)
2930

docs/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ If you need an internal API stabilized please [file an issue](https://github.com
110110
## Configuration reader
111111

112112
```{eval-rst}
113-
.. automodule:: tmuxp.config_reader
113+
.. automodule:: tmuxp._internal.config_reader
114114
```
115115

116116
## Workspace Builder

src/tmuxp/_internal/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Internal APIs for tmuxp."""

src/tmuxp/config_reader.py renamed to src/tmuxp/_internal/config_reader.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ def load(cls, format: "FormatLiteral", content: str) -> "ConfigReader":
5555
5656
>>> cfg = ConfigReader.load("json", '{ "session_name": "my session" }')
5757
>>> cfg
58-
<tmuxp.config_reader.ConfigReader object at ...>
58+
<tmuxp._internal.config_reader.ConfigReader object at ...>
5959
>>> cfg.content
6060
{'session_name': 'my session'}
6161
6262
>>> cfg = ConfigReader.load("yaml", 'session_name: my session')
6363
>>> cfg
64-
<tmuxp.config_reader.ConfigReader object at ...>
64+
<tmuxp._internal.config_reader.ConfigReader object at ...>
6565
>>> cfg.content
6666
{'session_name': 'my session'}
6767
"""
@@ -133,7 +133,7 @@ def from_file(cls, path: pathlib.Path) -> "ConfigReader":
133133
134134
>>> cfg = ConfigReader.from_file(yaml_file)
135135
>>> cfg
136-
<tmuxp.config_reader.ConfigReader object at ...>
136+
<tmuxp._internal.config_reader.ConfigReader object at ...>
137137
138138
>>> cfg.content
139139
{'session_name': 'my session'}
@@ -150,7 +150,7 @@ def from_file(cls, path: pathlib.Path) -> "ConfigReader":
150150
151151
>>> cfg = ConfigReader.from_file(json_file)
152152
>>> cfg
153-
<tmuxp.config_reader.ConfigReader object at ...>
153+
<tmuxp._internal.config_reader.ConfigReader object at ...>
154154
155155
>>> cfg.content
156156
{'session_name': 'my session'}

src/tmuxp/cli/convert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pathlib
55
import typing as t
66

7-
from tmuxp.config_reader import ConfigReader
7+
from tmuxp._internal.config_reader import ConfigReader
88
from tmuxp.workspace.finders import find_workspace_file, get_workspace_dir
99

1010
from .. import exc

src/tmuxp/cli/freeze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from libtmux.server import Server
99

10-
from tmuxp.config_reader import ConfigReader
10+
from tmuxp._internal.config_reader import ConfigReader
1111
from tmuxp.exc import TmuxpException
1212
from tmuxp.workspace.finders import get_workspace_dir
1313

src/tmuxp/cli/import_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import sys
66
import typing as t
77

8-
from tmuxp.config_reader import ConfigReader
8+
from tmuxp._internal.config_reader import ConfigReader
99
from tmuxp.workspace.finders import find_workspace_file
1010

1111
from ..workspace import importers

src/tmuxp/cli/load.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
from tmuxp.types import StrPath
1616

17-
from .. import config_reader, exc, log, util
17+
from .. import exc, log, util
18+
from .._internal import config_reader
1819
from ..workspace import loader
1920
from ..workspace.builder import WorkspaceBuilder
2021
from ..workspace.finders import find_workspace_file, get_workspace_dir

src/tmuxp/workspace/builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ class WorkspaceBuilder:
9797
9898
1. Load JSON / YAML file via via :class:`pathlib.Path`::
9999
100-
from tmuxp import config_reader
100+
from tmuxp._internal import config_reader
101101
session_config = config_reader.ConfigReader._load(raw_yaml)
102102
103103
The reader automatically detects the file type from :attr:`pathlib.suffix`.
104104
105105
We can also parse raw file::
106106
107107
import pathlib
108-
from tmuxp import config_reader
108+
from tmuxp._internal import config_reader
109109
110110
session_config = config_reader.ConfigReader._from_file(
111111
pathlib.Path('path/to/config.yaml')

tests/cli/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
from libtmux.server import Server
1010

1111
from tmuxp import cli
12+
from tmuxp._internal.config_reader import ConfigReader
1213
from tmuxp.cli.import_config import get_teamocil_dir, get_tmuxinator_dir
1314
from tmuxp.cli.load import _reattach, load_plugins
1415
from tmuxp.cli.utils import tmuxp_echo
15-
from tmuxp.config_reader import ConfigReader
1616
from tmuxp.workspace import loader
1717
from tmuxp.workspace.builder import WorkspaceBuilder
1818
from tmuxp.workspace.finders import find_workspace_file

tests/cli/test_freeze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from libtmux.server import Server
99

1010
from tmuxp import cli
11-
from tmuxp.config_reader import ConfigReader
11+
from tmuxp._internal.config_reader import ConfigReader
1212

1313

1414
@pytest.mark.parametrize(

tests/cli/test_load.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
from pytest_mock import MockerFixture
1313

1414
from tmuxp import cli
15+
from tmuxp._internal.config_reader import ConfigReader
1516
from tmuxp.cli.load import (
1617
_load_append_windows_to_current_session,
1718
_load_attached,
1819
load_plugins,
1920
load_workspace,
2021
)
21-
from tmuxp.config_reader import ConfigReader
2222
from tmuxp.workspace import loader
2323
from tmuxp.workspace.builder import WorkspaceBuilder
2424

tests/workspace/test_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
from libtmux.window import Window
1919

2020
from tmuxp import exc
21+
from tmuxp._internal.config_reader import ConfigReader
2122
from tmuxp.cli.load import load_plugins
22-
from tmuxp.config_reader import ConfigReader
2323
from tmuxp.workspace import loader
2424
from tmuxp.workspace.builder import WorkspaceBuilder
2525

tests/workspace/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pytest
66

77
from tmuxp import exc
8-
from tmuxp.config_reader import ConfigReader
8+
from tmuxp._internal.config_reader import ConfigReader
99
from tmuxp.workspace import loader, validation
1010

1111
from ..constants import EXAMPLE_PATH

tests/workspace/test_freezer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from libtmux.session import Session
77

8-
from tmuxp.config_reader import ConfigReader
8+
from tmuxp._internal.config_reader import ConfigReader
99
from tmuxp.workspace import freezer, validation
1010
from tmuxp.workspace.builder import WorkspaceBuilder
1111

tests/workspace/test_import_teamocil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55

6-
from tmuxp import config_reader
6+
from tmuxp._internal import config_reader
77
from tmuxp.workspace import importers, validation
88

99
from ..fixtures import import_teamocil as fixtures

tests/workspace/test_import_tmuxinator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55

6-
from tmuxp.config_reader import ConfigReader
6+
from tmuxp._internal.config_reader import ConfigReader
77
from tmuxp.workspace import importers, validation
88

99
from ..fixtures import import_tmuxinator as fixtures

0 commit comments

Comments
 (0)