Skip to content

Commit

Permalink
Modify handling of travertino dependency in example apps, CI and test…
Browse files Browse the repository at this point in the history
…bed. (#3155)

* Modifies the CI configuration so that Travertino is installed by pip finding the wheel in the dist folder, rather than by explicitly installing the package from the source directory.
* Modifies the testbed to look in the `dist` folder for prerelease wheels, but *doesn't* modify the platform configurations to use those wheels. This is so that local testing continues to work. However, the Textual backend *will* use the `dist` folder to install packages, so there is at least *some* testing of wheel usage by Briefcase.
* Updates all the examples and the demo app to include an explicit install of Travertino.
* Includes a hard version pin of PyGObject 3.50.0 to work around #3143.
* Includes a conditional coverage tweak that I noticed being reported on each of the standalone core test runs. This wasn't an issue for overall coverage, but it helps to keep local single-Python version test results clean.
  • Loading branch information
freakboy3742 authored Feb 4, 2025
1 parent 8e222c2 commit 48b094b
Show file tree
Hide file tree
Showing 53 changed files with 102 additions and 37 deletions.
38 changes: 28 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ jobs:
name: Pre-commit checks
uses: beeware/.github/.github/workflows/pre-commit-run.yml@main
with:
pre-commit-source: "./core[dev]"
# Although we only want to install the dev dependencies, we have to install the
# core, which means we need travertino as well.
pre-commit-source: "./travertino ./core[dev]"

towncrier:
name: Check towncrier
uses: beeware/.github/.github/workflows/towncrier-run.yml@main
with:
tox-source: "./core[dev]"
# Although we only want to install the dev dependencies, we have to install the
# core, which means we need travertino as well.
tox-source: "./travertino ./core[dev]"

package:
name: Package Toga
Expand Down Expand Up @@ -119,9 +123,12 @@ jobs:

- name: Test
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) ../$(ls dist/travertino-*.whl)"
# 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. We don't *explicitly* install the Travertino wheel; we provide the
# dist dir as a source of wheels, and rely on pip to resolve the explicit
# version match to the Travertino wheel in that folder.
export TOGA_INSTALL_COMMAND="python -m pip install --find-links ../dist ../$(ls dist/toga_core-*.whl)[dev] ../$(ls dist/toga_dummy-*.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 }}
Expand Down Expand Up @@ -184,7 +191,11 @@ jobs:

- name: Test
run: |
pip install dist/toga_core-*.whl dist/travertino-*.whl
# We don't *explicitly* install the Travertino wheel; we provide the dist dir
# as a source of wheels, and rely on pip to resolve the explicit version match
# to the travertino wheel in that folder.
pip install --find-links ./dist dist/toga_core-*.whl
site_packages=$(python -c '
import sys
print([path for path in sys.path if "site-packages" in path][0])
Expand Down Expand Up @@ -247,7 +258,7 @@ jobs:

testbed:
name: Testbed
needs: core-and-travertino
needs: [ package, core-and-travertino ]
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -373,21 +384,21 @@ jobs:
platform: "linux"
runs-on: "ubuntu-latest"
setup-python: false # Use the system Python packages
briefcase-run-args: --config 'requires=["../core","../textual", "../travertino"]' --config 'console_app=true'
briefcase-run-args: --config 'requires=["toga-core", "toga-textual"]' --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", "../travertino"]' --config 'console_app=true'
briefcase-run-args: --config 'requires=["toga-core", "toga-textual"]' --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", "../travertino"]' --config 'console_app=true'
briefcase-run-args: --config 'requires=["toga-core", "toga-textual"]' --config 'console_app=true'
app-user-data-path: '$HOME\AppData\Local\Tiberius Yak\Toga Testbed\Data'

- backend: "windows"
Expand Down Expand Up @@ -444,6 +455,13 @@ jobs:
python -m pip install -U pip
python -m pip install git+https://github.com/beeware/briefcase.git
- name: Get Packages
uses: actions/[email protected]
with:
pattern: ${{ format('{0}-*', needs.package.outputs.artifact-basename) }}
merge-multiple: true
path: dist

- name: Test App
working-directory: testbed
timeout-minutes: 15
Expand Down
8 changes: 5 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ sphinx:
formats:
- pdf

# Install extras for build - dev is needed to run tox
# Install extras for build. Order is significant; each entry is a separate call to
# `pip`, and we need Travertino to exist before core is installed. core[dev] is needed
# to run `tox -e docs-lint` as a pre-build step.
python:
install:
- method: pip
path: travertino
- method: pip
path: core
extra_requirements:
- dev
- docs
- method: pip
path: travertino
1 change: 1 addition & 0 deletions changes/3154.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The handling of the Travertino dependency in examples, CI and testbed was modified.
2 changes: 1 addition & 1 deletion core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ requires = [
build-backend = "setuptools.build_meta"

[project]
dynamic = ["version"]
dynamic = ["version", "dependencies"]
name = "toga-core"
description = "A Python native, OS native GUI toolkit."
readme = "README.rst"
Expand Down
4 changes: 2 additions & 2 deletions core/src/toga/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

# Emulate the Python 3.10+ entry_points API on older Python versions.
def entry_points(*, group):
if sys.version_info < (3, 10):
if sys.version_info < (3, 10): # pragma: no-cover-if-gte-py310
return metadata.entry_points()[group]
else:
else: # pragma: no-cover-if-lt-py310
return metadata.entry_points(group=group)


Expand Down
16 changes: 0 additions & 16 deletions demo/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,33 +83,17 @@ author_email = "[email protected]"
formal_name = "Toga Demo"
description = "A demonstration of the capabilities of the Toga widget toolkit."
sources = ["toga_demo"]
requires = ["../core"]

[tool.briefcase.app.toga-demo.macOS]
requires = [
"../cocoa",
]

[tool.briefcase.app.toga-demo.linux]
requires = [
"../gtk",
]

[tool.briefcase.app.toga-demo.windows]
requires = [
"../winforms",
]

# Mobile deployments
[tool.briefcase.app.toga-demo.iOS]
requires = [
"../iOS",
]

[tool.briefcase.app.toga-demo.android]
requires = [
"../android",
]

base_theme = "Theme.MaterialComponents.Light.DarkActionBar"

Expand Down
1 change: 1 addition & 0 deletions examples/activityindicator/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["activityindicator"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/beeliza/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["beeliza"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/box/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["box"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/button/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["button"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/canvas/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["canvas"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/colors/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["colors"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/command/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["command"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/date_and_time/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["date_and_time"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/detailedlist/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["detailedlist"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/dialogs/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["dialogs"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/divider/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["divider"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/documentapp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["documentapp"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/examples_overview/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["examples_overview"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/focus/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["focus"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/font/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["font"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/font_size/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["font_size"]
requires = [
"../../core",
"../../travertino",
]

[tool.briefcase.app.font_size.macOS]
Expand Down
1 change: 1 addition & 0 deletions examples/handlers/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["handlers"]
requires = [
"../../core",
"../../travertino",
"httpx",
]

Expand Down
1 change: 1 addition & 0 deletions examples/imageview/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["imageview"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/layout/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["layout"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/multilinetextinput/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["multilinetextinput"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/numberinput/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["numberinput"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/optioncontainer/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["optioncontainer"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/positron-django/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ icon = "src/positron/resources/positron"
sources = ["src/positron", "src/webapp"]
requires = [
"../../core",
"../../travertino",
"django~=4.1",
]

Expand Down
1 change: 1 addition & 0 deletions examples/positron-static/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ icon = "src/positron/resources/positron"
sources = ["src/positron"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/progressbar/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["progressbar"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/resize/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["resize"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
1 change: 1 addition & 0 deletions examples/screenshot/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["screenshot"]
requires = [
"../../core",
"../../travertino",
"pillow",
]

Expand Down
1 change: 1 addition & 0 deletions examples/scrollcontainer/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description = "A testing app"
sources = ["scrollcontainer"]
requires = [
"../../core",
"../../travertino",
]


Expand Down
Loading

0 comments on commit 48b094b

Please sign in to comment.