Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Travertino to Toga repository #3086

Merged
merged 55 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
9e03714
Add Travertino verbatim (except for line-length fixes and removed git…
HalfWhitt Jan 9, 2025
3349fbd
Move tests and fix configurations
HalfWhitt Jan 10, 2025
c1eace4
Switch to dataclass style properties
HalfWhitt Jan 10, 2025
7cd22b2
Remove Travertino 0.3.0 compat code in Toga
HalfWhitt Jan 10, 2025
105afca
Added changenote
HalfWhitt Jan 10, 2025
30b270d
Ran pre-commit to reorder imports across Toga
HalfWhitt Jan 10, 2025
3a0fda4
Moved Travertino tests back; altered tox and CI
HalfWhitt Jan 18, 2025
96f243f
Merge branch 'main' into add_travertino
HalfWhitt Jan 18, 2025
46959b6
Add Travertino to RTD install
HalfWhitt Jan 18, 2025
e604846
Fixed test imports, and fail handling in CI coverage
HalfWhitt Jan 18, 2025
48667e8
Fixed matrix location in CI
HalfWhitt Jan 18, 2025
cac6e91
Fixed job needs names
HalfWhitt Jan 18, 2025
36db68d
Fixed style mixin with validated_property
HalfWhitt Jan 18, 2025
0cb994e
Missing $
HalfWhitt Jan 18, 2025
c2f461e
Fix coverage file name
HalfWhitt Jan 18, 2025
71f4c95
Fix it *more*
HalfWhitt Jan 18, 2025
8e89176
Add -trav to tox call
HalfWhitt Jan 18, 2025
b839a5e
Add Travertino to Testbed pyproject; set project root for tox in CI
HalfWhitt Jan 18, 2025
6855af7
Revert tox root
HalfWhitt Jan 18, 2025
f92e866
Add Travertino to textual testbed
HalfWhitt Jan 18, 2025
c0027d2
Separate isort settings so Toga reverts to treating Travertino as thi…
HalfWhitt Jan 18, 2025
e652c07
Make sure style mixin works for property aliases too
HalfWhitt Jan 18, 2025
a73b150
Fix rcfile for coverage-trav
HalfWhitt Jan 18, 2025
bd37dec
Add dev extras to Travertino and use as tox project root in CI
HalfWhitt Jan 18, 2025
51ebc6a
put env name parts in right order
HalfWhitt Jan 18, 2025
807c9bc
consistent env var names, updated Travertino URLs
HalfWhitt Jan 18, 2025
4afdc85
Fix layout() signature in gtk container.py
HalfWhitt Jan 20, 2025
9257749
Only test Travertino on one platform
HalfWhitt Jan 20, 2025
e62e1cd
Fix more links in readme
HalfWhitt Jan 20, 2025
26b529e
Remove placeholder future Pack properties in old format
HalfWhitt Jan 20, 2025
61d5a19
remove more backwards compat; switch Travertino test to Ubuntu
HalfWhitt Jan 21, 2025
f0d545c
Merge branch 'main' into add_travertino
HalfWhitt Jan 21, 2025
5d260e5
Remove subclass_init to fix MicroPython
HalfWhitt Jan 22, 2025
12f61db
Remove non-MicroPython-compatible syntax
HalfWhitt Jan 22, 2025
e46124b
Change matrix variable name
HalfWhitt Jan 22, 2025
0878634
Change matrix variable name
HalfWhitt Jan 22, 2025
f0b609e
Change matrix variable name
HalfWhitt Jan 22, 2025
17ad086
Right folder for version
HalfWhitt Jan 22, 2025
1933350
Add coverage to envlist
HalfWhitt Jan 22, 2025
c3d533e
Change matrix variable name
HalfWhitt Jan 22, 2025
52a2738
trim Travertino test deps; editable install for docs-live
HalfWhitt Jan 23, 2025
2347dc2
Add Travertino changelog, including 0.5.0
HalfWhitt Jan 23, 2025
4c65c7d
re-add tox
HalfWhitt Jan 23, 2025
54f0763
Change name back to dev, makes things simpler
HalfWhitt Jan 23, 2025
8fe41d2
Fixed markdown link to RST
HalfWhitt Jan 23, 2025
986f99d
Escape | in RST
HalfWhitt Jan 23, 2025
618d50c
Standardize RST formatting
HalfWhitt Jan 23, 2025
8079fa4
Added to how-to; added test-core and test-trav labels
HalfWhitt Jan 23, 2025
4b4536a
Added Travertino to spelling list
HalfWhitt Jan 23, 2025
37251ce
Add Travertino to dependabot.yml
HalfWhitt Jan 23, 2025
1ea9df7
Rearrange mixin_dict to avoid creating intermediate dict
HalfWhitt Jan 23, 2025
858d2a1
Promote release note to Feature.
freakboy3742 Jan 24, 2025
0bee60a
Minor edits to Travertino release notes.
freakboy3742 Jan 24, 2025
30dd277
Minor tweaks to contribution docs.
freakboy3742 Jan 24, 2025
55988b8
Minor tweaks to Travertino project metadata.
freakboy3742 Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ updates:
day: "sunday"
time: "20:00"

- package-ecosystem: "pip"
directory: "/travertino"
schedule:
# Check for updates on Sunday, 8PM UTC
interval: "weekly"
day: "sunday"
time: "20:00"

- package-ecosystem: "pip"
directory: "/testbed"
ignore:
Expand Down
77 changes: 49 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
- "gtk"
- "iOS"
- "toga"
- "travertino"
- "textual"
- "web"
- "winforms"
Expand All @@ -67,8 +68,8 @@ jobs:
build-subdirectory: ${{ matrix.subdir }}
attest: ${{ inputs.attest-package }}

core:
name: Test core
core-and-travertino:
name: Test ${{ matrix.package }} (${{ matrix.platform }}, ${{ matrix.python-version }})
runs-on: ${{ matrix.platform }}
needs: [ pre-commit, towncrier, package ]
continue-on-error: ${{ matrix.experimental }}
Expand All @@ -77,8 +78,18 @@ jobs:
matrix:
platform: [ "macos-latest", "ubuntu-latest", "windows-latest" ]
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
package: ["core", "travertino"]
exclude:
- package: travertino
platform: macos-latest
- package: travertino
platform: windows-latest
include:
- experimental: false
- package: "core"
tox-suffix: ""
- package: "travertino"
tox-suffix: "-trav"

steps:
- name: Checkout
Expand All @@ -97,7 +108,7 @@ jobs:
with:
requirements: tox
extra: dev
project-root: core
project-root: ${{ matrix.package }}

- name: Get Packages
uses: actions/[email protected]
Expand All @@ -110,16 +121,16 @@ jobs:
run: |
# The $(ls ...) shell expansion is done in the Github environment;
# the value of TOGA_INSTALL_COMMAND will be a literal string without any shell expansions to perform
TOGA_INSTALL_COMMAND="python -m pip install ../$(ls dist/toga_core-*.whl)[dev] ../$(ls dist/toga_dummy-*.whl)" \
tox -e py-cov
tox -qe coverage$(tr -dc "0-9" <<< "${{ matrix.python-version }}")
mv core/.coverage core/.coverage.${{ matrix.platform }}.${{ matrix.python-version }}
TOGA_INSTALL_COMMAND="python -m pip install ../$(ls dist/toga_core-*.whl)[dev] ../$(ls dist/toga_dummy-*.whl) ../$(ls dist/travertino-*.whl)"
tox -e py-cov${{ matrix.tox-suffix }}
tox -qe coverage$(tr -dc "0-9" <<< "${{ matrix.python-version }}")${{ matrix.tox-suffix }}
mv ${{ matrix.package }}/.coverage ${{ matrix.package }}/.coverage.${{ matrix.platform }}.${{ matrix.python-version }}

- name: Store Coverage Data
uses: actions/[email protected]
with:
name: core-coverage-data-${{ matrix.platform }}-${{ matrix.python-version }}
path: "core/.coverage.*"
name: ${{ matrix.package }}-coverage-data-${{ matrix.platform }}-${{ matrix.python-version }}
path: "${{ matrix.package }}/.coverage.*"
if-no-files-found: error
include-hidden-files: true

Expand Down Expand Up @@ -159,15 +170,21 @@ jobs:
with:
python-version: "3.13"

- name: Get Packages
- name: Get Core Package
uses: actions/[email protected]
with:
name: Packages-toga-core
path: dist

- name: Get Travertino Package
uses: actions/[email protected]
with:
name: Packages-toga-travertino
path: dist

- name: Test
run: |
pip install dist/toga_core-*.whl
pip install dist/toga_core-*.whl dist/travertino-*.whl
site_packages=$(python -c '
import sys
print([path for path in sys.path if "site-packages" in path][0])
Expand All @@ -176,17 +193,20 @@ jobs:
cd core
export MICROPYPATH="$site_packages:.frozen"

echo "Stable Travertino"
${{ steps.micropython.outputs.executable }} micropython_check.py

echo "Development Travertino"
pip install git+https://github.com/beeware/travertino
${{ steps.micropython.outputs.executable }} micropython_check.py

core-coverage:
name: Coverage
needs: core
core-and-travertino-coverage:
name: "Coverage: ${{ matrix.package }}"
needs: core-and-travertino
runs-on: ubuntu-latest
strategy:
matrix:
package: ["core", "travertino"]
include:
- package: "core"
tox-suffix: ""
- package: "travertino"
tox-suffix: "-trav"
steps:
- name: Checkout
uses: actions/[email protected]
Expand All @@ -205,28 +225,29 @@ jobs:
with:
requirements: tox
extra: dev
project-root: core
project-root: ${{ matrix.package }}

- name: Retrieve Coverage Data
uses: actions/[email protected]
with:
pattern: core-coverage-data-*
path: core
pattern: ${{ matrix.package }}-coverage-data-*
path: ${{ matrix.package }}
merge-multiple: true

- name: Generate Coverage Report
run: tox -e coverage-html-fail-platform
# Even with "fail" on, Travertino will accept <100%.
run: tox -e coverage${{ matrix.tox-suffix }}-html-fail-platform

- name: Upload HTML Coverage Report
uses: actions/[email protected]
if: failure()
with:
name: html-coverage-report
path: core/htmlcov
path: ${{ matrix.package }}/htmlcov

testbed:
name: Testbed
needs: core
needs: core-and-travertino
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -321,21 +342,21 @@ jobs:
platform: "linux"
runs-on: "ubuntu-latest"
setup-python: false # Use the system Python packages
briefcase-run-args: --config 'requires=["../core","../textual"]' --config 'console_app=true'
briefcase-run-args: --config 'requires=["../core","../textual", "../travertino"]' --config 'console_app=true'
app-user-data-path: "$HOME/.local/share/testbed"
# install the meta-package build-essential since Briefcase explicitly checks for it
pre-command: sudo apt update -y && sudo apt install -y build-essential

- backend: "textual-macOS"
platform: "macOS"
runs-on: "macos-latest"
briefcase-run-args: --config 'requires=["../core","../textual"]' --config 'console_app=true'
briefcase-run-args: --config 'requires=["../core","../textual", "../travertino"]' --config 'console_app=true'
app-user-data-path: "$HOME/Library/Application Support/org.beeware.toga.testbed"

- backend: "textual-windows"
platform: "windows"
runs-on: "windows-latest"
briefcase-run-args: --config 'requires=["../core","../textual"]' --config 'console_app=true'
briefcase-run-args: --config 'requires=["../core","../textual", "../travertino"]' --config 'console_app=true'
app-user-data-path: '$HOME\AppData\Local\Tiberius Yak\Toga Testbed\Data'

- backend: "windows"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/config-file-deps-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
uses: beeware/.github/.github/workflows/dep-version-bump.yml@main
secrets: inherit
with:
subdirectory: . core dummy android cocoa demo gtk iOS testbed textual toga web winforms
subdirectory: . core dummy android cocoa demo gtk iOS testbed textual toga travertino web winforms
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- "toga_iOS"
- "toga_web"
- "toga_winforms"
- "travertino"
steps:
- name: Get packages
uses: dsaltares/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
- "toga_textual"
- "toga_web"
- "toga_winforms"
- "travertino"
steps:
- name: Get Packages
uses: actions/[email protected]
Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ repos:
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
# isort for Travertino
- id: isort
args: [--settings-path=travertino]
# For some reason, providing "travertino" as an argument doesn't work to specify
# the target, like it would on the command line; it still runs against the
# whole repo. Setting it here seems to work, though.
files: travertino
# isort for the rest of the repo
- id: isort
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.10.0
Expand Down
2 changes: 2 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ python:
extra_requirements:
- dev
- docs
- method: pip
path: travertino
3 changes: 3 additions & 0 deletions changes/3086.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The Travertino library, providing the base classes for Toga's style and box model, is now managed as part of the Toga release process.

TODO: CORRECT THE RELEASE DATE ON THE TRAVERTINO RELEASE NOTES
8 changes: 5 additions & 3 deletions core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ classifiers = [
"Topic :: Software Development :: User Interfaces",
"Topic :: Software Development :: Widget Sets",
]
dependencies = [
"travertino >= 0.3.0, < 0.4.0",
]

[project.optional-dependencies]
# Extras used by developers *of* Toga are pinned to specific versions to
Expand Down Expand Up @@ -104,6 +101,11 @@ pil = "toga.plugins.image_formats.PILConverter"
[tool.setuptools_scm]
root = ".."

[tool.setuptools_dynamic_dependencies]
dependencies = [
"travertino == {version}",
]

[tool.coverage.run]
parallel = true
branch = true
Expand Down
20 changes: 7 additions & 13 deletions core/src/toga/style/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,14 @@ def __delete__(self, widget):

def style_mixin(style_cls):
mixin_dict = {
"__doc__": f"""
Allows accessing the {style_cls.__name__} {style_cls._doc_link} directly on
the widget. For example, instead of ``widget.style.color``, you can simply
write ``widget.color``.
"""
name: StyleProperty() for name in style_cls._BASE_ALL_PROPERTIES[style_cls]
}

try:
_all_properties = style_cls._BASE_ALL_PROPERTIES
except AttributeError:
# Travertino 0.3 compatibility
_all_properties = style_cls._ALL_PROPERTIES

for name in _all_properties[style_cls]:
mixin_dict[name] = StyleProperty()
mixin_dict["__doc__"] = (
f"""Allows accessing the {style_cls.__name__} {style_cls._doc_link} directly on
the widget. For example, instead of ``widget.style.color``, you can simply write
``widget.color``.
"""
)

return type(style_cls.__name__ + "Mixin", (), mixin_dict)
Loading
Loading