Skip to content

Commit 65e81c5

Browse files
willmcgugandavep
andauthored
Textual dev (#2884)
* WiP: Move the devtools and related code to `textual-dev` (#2834) * Remove the textual script from the project file This is moving into the textual-dev package. * Remove the textual CLI code from Textual This has all gone to live in textual-dev. * Remove the devtools testing from Textual's unit tests They've moved over to textual-dev instead. * Remove the devtools server from Textual itself The start of the process to remove as much of the core devtools as possible from Textual. * Switch the console docs example screenshot over to textual_dev * Remove rednerables.py from Textual * Remove the last parts of devtools from Textual This is the last step. It remains to be seen if this is sustainable, but for testing purposes this is the extreme case we're aiming for. I *think* this will work though. Hereon we'll be needing to do an editable install of textual-dev into textual, and more generally and once this is "live" we'll be needing to make sure that textual[dev] is installed when doing development work on textual apps. The thing that remains to be seen however is how this all works with *developing* Textual itself. Will I always need to do an editable install? Still got to figure that one out. * Start to whittle down the pyproject file The next step is to try and work out what can come out of the pyproject file. * Remove aiohttp from Textual * Remove some more development dependencies we don't need any more * Relock * Remove the pointer to the previews directory * Reintroduce the border preview snapshot test * Reintroduce the color preview snapshot test * Reinstate the key press for the border preview snapshot test * Reintroduce the easing preview snapshot test * Reintroduce the keys tool snapshot test * Add pytest-asyncio as a development dependency * Relock * Pin the textual-dev version to 0.1.0 or later Mostly to try and get the tests kicked off properly. * Relock dependencies * Further `textual-dev` changes (#2850) * Remove the textual script from the project file This is moving into the textual-dev package. * Remove the textual CLI code from Textual This has all gone to live in textual-dev. * Remove the devtools testing from Textual's unit tests They've moved over to textual-dev instead. * Remove the devtools server from Textual itself The start of the process to remove as much of the core devtools as possible from Textual. * Switch the console docs example screenshot over to textual_dev * Remove rednerables.py from Textual * Remove the last parts of devtools from Textual This is the last step. It remains to be seen if this is sustainable, but for testing purposes this is the extreme case we're aiming for. I *think* this will work though. Hereon we'll be needing to do an editable install of textual-dev into textual, and more generally and once this is "live" we'll be needing to make sure that textual[dev] is installed when doing development work on textual apps. The thing that remains to be seen however is how this all works with *developing* Textual itself. Will I always need to do an editable install? Still got to figure that one out. * Start to whittle down the pyproject file The next step is to try and work out what can come out of the pyproject file. * Remove aiohttp from Textual * Remove some more development dependencies we don't need any more * Relock * Remove the pointer to the previews directory * Reintroduce the border preview snapshot test * Reintroduce the color preview snapshot test * Reinstate the key press for the border preview snapshot test * Reintroduce the easing preview snapshot test * Reintroduce the keys tool snapshot test * Add pytest-asyncio as a development dependency * Relock * Pin the textual-dev version to 0.1.0 or later Mostly to try and get the tests kicked off properly. * Relock dependencies * Whitespace cleaning * Swap mentions of textual[dev] to textual-dev * Remove the dev extra * Tweak README.md in response to PR review * Tweak animation.md in response to PR review * Tweak getting_started.md in response to PR review * bump version * lock * drop dev * more * version bump --------- Co-authored-by: Dave Pearson <[email protected]>
1 parent 6b3b1ce commit 65e81c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2093
-4621
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
path: .venv
4141
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
4242
- name: Install dependencies
43-
run: poetry install --extras "dev"
43+
run: poetry install
4444
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
4545
# - name: Typecheck with mypy
4646
# run: |

CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8-
## Unreleased
9-
8+
## [0.29.0] - 2023-07-03
109

1110
### Added
1211

@@ -15,14 +14,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1514
- Added `default` parameter to `DataTable.add_column` for populating existing rows https://github.com/Textualize/textual/pull/2836
1615
- Added can-focus pseudo-class to target widgets that may receive focus
1716

18-
1917
### Fixed
2018

2119
- Fixed crash when columns were added to populated `DataTable` https://github.com/Textualize/textual/pull/2836
2220
- Fixed issues with opacity on Screens https://github.com/Textualize/textual/issues/2616
2321
- Fixed style problem with selected selections in a non-focused selection list https://github.com/Textualize/textual/issues/2768
2422

25-
2623
## [0.28.1] - 2023-06-20
2724

2825
### Fixed
@@ -1098,6 +1095,7 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040
10981095
- New handler system for messages that doesn't require inheritance
10991096
- Improved traceback handling
11001097

1098+
[0.29.0]: https://github.com/Textualize/textual/compare/v0.28.1...v0.29.0
11011099
[0.28.1]: https://github.com/Textualize/textual/compare/v0.28.0...v0.28.1
11021100
[0.28.0]: https://github.com/Textualize/textual/compare/v0.27.0...v0.28.0
11031101
[0.27.0]: https://github.com/Textualize/textual/compare/v0.26.0...v0.27.0

FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ You likely have an older version of Textual. You can install the latest version
2828
The following should do it:
2929

3030
```
31-
pip install "textual[dev]" -U
31+
pip install textual-dev -U
3232
```
3333

3434
<a name="how-can-i-select-and-copy-text-in-a-textual-app"></a>

README.md

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ Textual is a *Rapid Application Development* framework for Python.
1313
Build sophisticated user interfaces with a simple Python API. Run your apps in the terminal and (coming soon) a web browser!
1414

1515

16-
<details>
16+
<details>
1717
<summary> 🎬 Demonstration </summary>
1818
<hr>
19-
19+
2020
A quick run through of some Textual features.
21-
21+
2222

2323

2424
https://user-images.githubusercontent.com/554369/197355913-65d3c125-493d-4c05-a590-5311f16c40ff.mov
@@ -32,7 +32,7 @@ https://user-images.githubusercontent.com/554369/197355913-65d3c125-493d-4c05-a5
3232

3333
Textual adds interactivity to [Rich](https://github.com/Textualize/rich) with an API inspired by modern web development.
3434

35-
On modern terminal software (installed by default on most systems), Textual apps can use **16.7 million** colors with mouse support and smooth flicker-free animation. A powerful layout engine and re-usable components makes it possible to build apps that rival the desktop and web experience.
35+
On modern terminal software (installed by default on most systems), Textual apps can use **16.7 million** colors with mouse support and smooth flicker-free animation. A powerful layout engine and re-usable components makes it possible to build apps that rival the desktop and web experience.
3636

3737
## Compatibility
3838

@@ -43,10 +43,16 @@ Textual runs on Linux, macOS, and Windows. Textual requires Python 3.7 or above.
4343
Install Textual via pip:
4444

4545
```
46-
pip install "textual[dev]"
46+
pip install textual
47+
```
48+
49+
If you plan on developing Textual apps, you should also install the development tools with the following command:
50+
51+
```
52+
pip install textual-dev
4753
```
4854

49-
The addition of `[dev]` installs Textual development tools. See the [docs](https://textual.textualize.io/getting_started/) if you need help getting started.
55+
See the [docs](https://textual.textualize.io/getting_started/) if you need help getting started.
5056

5157
## Demo
5258

@@ -82,12 +88,12 @@ https://user-images.githubusercontent.com/554369/197188237-88d3f7e4-4e5f-40b5-b9
8288
</details>
8389

8490

85-
<details>
91+
<details>
8692
<summary> 📷 Calculator </summary>
8793
<hr>
88-
94+
8995
This is [calculator.py](https://github.com/Textualize/textual/blob/main/examples/calculator.py) which demonstrates Textual grid layouts.
90-
96+
9197
![calculator screenshot](https://raw.githubusercontent.com/Textualize/textual/main/imgs/calculator.png)
9298
</details>
9399

@@ -97,7 +103,7 @@ This is [calculator.py](https://github.com/Textualize/textual/blob/main/examples
97103
<hr>
98104

99105
This is the Stopwatch example from the [tutorial](https://textual.textualize.io/tutorial/).
100-
106+
101107

102108

103109
https://user-images.githubusercontent.com/554369/197360718-0c834ef5-6285-4d37-85cf-23eed4aa56c5.mov
@@ -112,12 +118,12 @@ https://user-images.githubusercontent.com/554369/197360718-0c834ef5-6285-4d37-85
112118

113119
The `textual` command has a few sub-commands to preview Textual styles.
114120

115-
<details>
121+
<details>
116122
<summary> 🎬 Easing reference </summary>
117123
<hr>
118-
124+
119125
This is the *easing* reference which demonstrates the easing parameter on animation, with both movement and opacity. You can run it with the following command:
120-
126+
121127
```bash
122128
textual easing
123129
```
@@ -128,29 +134,29 @@ https://user-images.githubusercontent.com/554369/196157100-352852a6-2b09-4dc8-a8
128134

129135
</details>
130136

131-
<details>
137+
<details>
132138
<summary> 🎬 Borders reference </summary>
133139
<hr>
134-
140+
135141
This is the borders reference which demonstrates some of the borders styles in Textual. You can run it with the following command:
136-
142+
137143
```bash
138144
textual borders
139145
```
140146

141147

142148
https://user-images.githubusercontent.com/554369/196158235-4b45fb78-053d-4fd5-b285-e09b4f1c67a8.mov
143149

144-
150+
145151
</details>
146152

147153

148-
<details>
154+
<details>
149155
<summary> 🎬 Colors reference </summary>
150156
<hr>
151-
157+
152158
This is a reference for Textual's color design system.
153-
159+
154160
```bash
155161
textual colors
156162
```
@@ -161,6 +167,5 @@ https://user-images.githubusercontent.com/554369/197357417-2d407aac-8969-44d3-82
161167

162168

163169

164-
165-
</details>
166170

171+
</details>

docs/blog/posts/release0-29-0.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
draft: false
3+
date: 2023-07-03
4+
categories:
5+
- Release
6+
title: "Textual 0.27.0 refactors dev tools"
7+
authors:
8+
- willmcgugan
9+
---
10+
11+
# Textual 0.27.0 refactors dev tools
12+
13+
It's been a slow week or two at Textualize, with Textual devs taking well-earned annual leave, but we still managed to get a new version out.
14+
15+
<!-- more -->
16+
17+
Version 0.27.0 has shipped with a number of fixes (see the [release notes](https://github.com/Textualize/textual/releases/tag/v0.29.0) for details), but I'd like to use this post to explain a change we made to how Textual developer tools are distributed.
18+
19+
Previously if you installed `textual[dev]` you would get the Textual dev tools plus the library itself. If you were distributing Textual apps and didn't need the developer tools you could drop the `[dev]`.
20+
21+
We did this because the less dependencies a package has, the fewer installation issues you can expect to get in the future. And Textual is surprisingly lean if you only need to *run* apps, and not build them.
22+
23+
Alas, this wasn't quite as elegant solution as we hoped. The dependencies defined in extras wouldn't install commands, so `textual` was bundled with the core library. This meant that if you installed the Textual package *without* the `[dev]` you would still get the `textual` command on your path but it wouldn't run.
24+
25+
We solved this by creating two packages: `textual` contains the core library (with minimal dependencies) and `textual-dev` contains the developer tools. If you are building Textual apps, you should install both as follows:
26+
27+
```
28+
pip install textual textual-dev
29+
```
30+
31+
That's the only difference. If you run in to any issues feel free to ask on the [Discord server](https://discord.gg/Enf6Z3qhVr)!

docs/examples/getting_started/console.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
Simulates a screenshot of the Textual devtools
33
"""
44

5+
from textual_dev.renderables import DevConsoleHeader
6+
57
from textual.app import App
6-
from textual.devtools.renderables import DevConsoleHeader
78
from textual.widgets import Static
89

910

docs/getting_started.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,28 @@ Textual requires Python 3.7 or later (if you have a choice, pick the most recent
2020

2121
## Installation
2222

23-
You can install Textual via PyPI.
24-
25-
If you plan on developing Textual apps, then you should install `textual[dev]`. The `[dev]` part installs a few extra dependencies for development.
23+
You can install Textual via PyPI, with the following command:
2624

2725
```
28-
pip install "textual[dev]"
26+
pip install textual
2927
```
3028

31-
If you only plan on _running_ Textual apps, then you can drop the `[dev]` part:
29+
If you plan on developing Textual apps, you should also install textual developer tools:
3230

3331
```
34-
pip install textual
32+
pip install textual-dev
33+
```
34+
35+
### Textual CLI
36+
37+
If you installed the developer tools you should have access to the `textual` command. There are a number of sub-commands available which will aid you in building Textual apps. Run the following for a list of the available commands:
38+
39+
```bash
40+
textual --help
3541
```
3642

43+
See [devtools](guide/devtools.md) for more about the `textual` command.
44+
3745
## Demo
3846

3947
Once you have Textual installed, run the following to get an impression of what it can do:
@@ -79,15 +87,7 @@ python code_browser.py ../
7987
```
8088

8189

82-
## Textual CLI
83-
84-
If you installed the dev dependencies you have access to the `textual` CLI command. There are a number of sub-commands which will aid you in building Textual apps.
85-
86-
```bash
87-
textual --help
88-
```
8990

90-
See [devtools](guide/devtools.md) for more about the `textual` command.
9191

9292
## Need help?
9393

docs/guide/animation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ You can specify which easing method to use via the `easing` parameter on the `an
7272

7373
!!! note
7474

75-
The `textual easing` preview requires the `dev` extras to be installed (using `pip install textual[dev]`).
75+
The `textual easing` preview requires the `textual-dev` package to be installed (using `pip install textual-dev`).
7676

7777

7878
## Completion callbacks

0 commit comments

Comments
 (0)