txl 0.3.2__tar.gz → 0.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +1,22 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: txl
3
- Version: 0.3.2
4
- Project-URL: Source, https://github.com/davidbrochart/jpterm/txl
3
+ Version: 0.3.4
4
+ Project-URL: Source, https://github.com/davidbrochart/jpterm/tree/main/txl
5
5
  Author-email: David Brochart <david.brochart@gmail.com>
6
6
  License-Expression: MIT
7
7
  License-File: LICENSE.txt
8
8
  Classifier: Development Status :: 4 - Beta
9
9
  Classifier: Programming Language :: Python
10
- Classifier: Programming Language :: Python :: 3.10
11
10
  Classifier: Programming Language :: Python :: 3.11
12
11
  Classifier: Programming Language :: Python :: 3.12
13
12
  Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Programming Language :: Python :: 3.15
14
15
  Classifier: Programming Language :: Python :: Implementation :: CPython
15
16
  Classifier: Programming Language :: Python :: Implementation :: PyPy
16
- Requires-Python: >=3.10
17
- Requires-Dist: fps<0.6.0,>=0.5.1
18
- Requires-Dist: textual[syntax]<6.0.0,>=5.0.1
17
+ Requires-Python: >=3.11
18
+ Requires-Dist: fps<0.7.0,>=0.6.5
19
+ Requires-Dist: textual[syntax]>=6.8.0
19
20
  Description-Content-Type: text/markdown
20
21
 
21
22
  # txl
@@ -0,0 +1,20 @@
1
+ [build-system]
2
+ requires = [ "hatchling",]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "txl"
7
+ version = "0.3.4"
8
+ description = ""
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "MIT"
12
+ keywords = []
13
+ classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", "Programming Language :: Python :: 3.15", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy",]
14
+ dependencies = [ "fps >=0.6.5,<0.7.0", "textual[syntax] >=6.8.0",]
15
+ [[project.authors]]
16
+ name = "David Brochart"
17
+ email = "david.brochart@gmail.com"
18
+
19
+ [project.urls]
20
+ Source = "https://github.com/davidbrochart/jpterm/tree/main/txl"
@@ -1,5 +1,6 @@
1
1
  import logging
2
2
  from importlib.metadata import entry_points
3
+ from shutil import get_terminal_size
3
4
 
4
5
  import anyio
5
6
  from fps import Module
@@ -7,8 +8,8 @@ from fps.cli._cli import main
7
8
  from textual._context import active_app
8
9
  from textual.app import App
9
10
 
10
- logging.getLogger("httpx").setLevel(logging.CRITICAL)
11
- logging.getLogger("httpcore").setLevel(logging.CRITICAL)
11
+ logging.getLogger("httpx2").setLevel(logging.CRITICAL)
12
+ logging.getLogger("httpcore2").setLevel(logging.CRITICAL)
12
13
 
13
14
  modules = {
14
15
  ep.name: ep.load() for ep in entry_points(group="txl.modules")
@@ -18,8 +19,11 @@ disabled = []
18
19
 
19
20
 
20
21
  class AppModule(Module):
21
- def __init__(self, name: str):
22
+ def __init__(self, name: str, cli: bool = False, inline: bool = False):
22
23
  super().__init__(name)
24
+ self.cli = cli
25
+ self.inline = inline
26
+ self.app_ready = anyio.Event()
23
27
  self.app_exited = anyio.Event()
24
28
  for name, module_class in modules.items():
25
29
  if name not in disabled:
@@ -28,9 +32,22 @@ class AppModule(Module):
28
32
  async def start(self) -> None:
29
33
  self.done()
30
34
  app = await self.get(App)
35
+ self.app = app
36
+ app.cli = self.cli
31
37
  active_app.set(app)
32
- await app.run_async()
38
+ async def ready(pilot):
39
+ self.app_ready.set()
40
+
41
+ await app.run_async(
42
+ headless=self.cli,
43
+ inline=self.inline,
44
+ inline_no_clear=self.inline,
45
+ size=tuple(get_terminal_size()) if self.cli else None,
46
+ auto_pilot=ready,
47
+ )
33
48
  self.app_exited.set()
49
+ if not self.cli:
50
+ self.exit_app()
34
51
 
35
52
 
36
53
  def run(kwargs) -> None:
@@ -24,6 +24,10 @@ class Editor(ABC):
24
24
 
25
25
 
26
26
  class Editors(ABC):
27
+ @abstractmethod
28
+ def create_editor(self, path: str) -> Editor:
29
+ ...
30
+
27
31
  @abstractmethod
28
32
  def register_editor_factory(self, editor_factory: Callable, extensions: List[str] = [None]):
29
33
  ...
@@ -0,0 +1,11 @@
1
+ from typing import TypeVar
2
+
3
+ from anyio.streams.stapled import StapledObjectStream as _StapledObjectStream
4
+
5
+ T_Item = TypeVar("T_Item")
6
+
7
+
8
+ # FIXME: remove when https://github.com/agronholm/anyio/pull/1241 is released
9
+ class StapledObjectStream(_StapledObjectStream[T_Item]):
10
+ def send_nowait(self, item: T_Item) -> None:
11
+ self.send_stream.send_nowait(item) # type: ignore[attr-defined]
@@ -17,7 +17,9 @@ class TextInput(TextArea):
17
17
  language = None
18
18
  elif language == "ipython":
19
19
  language = "python"
20
- super().__init__(text, language=language, theme="monokai")
20
+ super().__init__(text, theme="monokai")
21
+ if language in self.available_languages:
22
+ self.language = language
21
23
 
22
24
  async def start(self):
23
25
  self.send_change_events, self.receive_change_events = create_memory_object_stream()
txl-0.3.2/pyproject.toml DELETED
@@ -1,20 +0,0 @@
1
- [build-system]
2
- requires = [ "hatchling",]
3
- build-backend = "hatchling.build"
4
-
5
- [project]
6
- name = "txl"
7
- version = "0.3.2"
8
- description = ""
9
- readme = "README.md"
10
- requires-python = ">=3.10"
11
- license = "MIT"
12
- keywords = []
13
- classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy",]
14
- dependencies = [ "fps >=0.5.1,<0.6.0", "textual[syntax] >=5.0.1,<6.0.0",]
15
- [[project.authors]]
16
- name = "David Brochart"
17
- email = "david.brochart@gmail.com"
18
-
19
- [project.urls]
20
- Source = "https://github.com/davidbrochart/jpterm/txl"
File without changes
File without changes
File without changes
File without changes
File without changes