Skip to content

Commit

Permalink
Merge pull request #82 from rmartin16/gui-plugin-support
Browse files Browse the repository at this point in the history
Generalize template for GUI framework plugins
  • Loading branch information
rmartin16 committed Nov 18, 2023
2 parents 6b0c557 + 1afa46c commit 0a22308
Show file tree
Hide file tree
Showing 20 changed files with 584 additions and 558 deletions.
53 changes: 39 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,52 @@ concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

env:
FORCE_COLOR: "1"

jobs:
pre-commit:
name: Pre-commit checks
uses: beeware/.github/.github/workflows/pre-commit-run.yml@main
with:
pre-commit-source: -r requirements.txt

unit-tests:
name: Unit tests
needs: pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4.1.1

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v4.7.1
with:
python-version: "3.X"
- name: Install dependencies
run: |
python -m pip install tox

- name: Install Dependencies
run: python -m pip install -r requirements.txt

- name: Test with tox
run: |
tox
run: tox

verify-templates:
name: Verify Templates
needs: unit-tests
uses: beeware/.github/.github/workflows/app-create-verify.yml@main
with:
runner-os: ${{ matrix.runner-os }}
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
framework: [ "toga", "pyside6", "ppb", "pygame" ]
runner-os: [ "macos-latest", "ubuntu-22.04", "windows-latest" ]


verify-apps:
name: Build App
Expand All @@ -37,16 +68,10 @@ jobs:
# ubuntu-latest upgrades to ubuntu-24.04, it will happen gradually, so the
# system Python version won't be predictable.
python-version: "3.10"
briefcase-template-source: "../../"
runner-os: ${{ matrix.runner-os }}
framework: ${{ matrix.framework }}
strategy:
fail-fast: false
matrix:
framework: [ "toga", "pyside2", "pyside6", "ppb", "pygame" ]
framework: [ "toga", "pyside6", "ppb", "pygame" ]
runner-os: [ "macos-latest", "ubuntu-22.04", "windows-latest" ]
exclude:
# PySide2 doesn't publish *any* universal or ARM64 wheels, and is unlikely to
# ever do so, so we can't test pyside2 on macOS
- runner-os: "macos-latest"
framework: "pyside2"
12 changes: 12 additions & 0 deletions .github/workflows/pre-commit-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Update pre-commit

on:
schedule:
- cron: "0 20 * * SUN" # Sunday @ 2000 UTC
workflow_dispatch:

jobs:
pre-commit-update:
name: Update pre-commit
uses: beeware/.github/.github/workflows/pre-commit-update.yml@main
secrets: inherit
41 changes: 41 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
exclude: ^{{ cookiecutter.app_name }}/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-toml
- id: check-yaml
- id: check-case-conflict
- id: check-docstring-first
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
additional_dependencies: [toml]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
- id: docformatter
args: [--in-place, --black]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.10.1
hooks:
- id: black
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
args: [--max-line-length=119]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies: [tomli]
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ BeeWare <3's contributions!
Please be aware, BeeWare operates under a Code of Conduct.

See [CONTRIBUTING to BeeWare](https://beeware.org/contributing) for details.

28 changes: 19 additions & 9 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,32 @@
"Proprietary",
"Other"
],
"gui_framework": [
"Toga",
"PySide2",
"PySide6",
"PursuedPyBear",
"Pygame",
"None"
],
"test_framework": [
"pytest",
"unittest"
],
"app_source": "",
"app_start_source": "",
"pyproject_table_briefcase_extra_content": "",
"pyproject_table_briefcase_app_extra_content": "",
"pyproject_table_macOS": "",
"pyproject_table_linux": "",
"pyproject_table_linux_system_debian": "",
"pyproject_table_linux_system_rhel": "",
"pyproject_table_linux_system_suse": "",
"pyproject_table_linux_system_arch": "",
"pyproject_table_linux_appimage": "",
"pyproject_table_linux_flatpak": "",
"pyproject_table_windows": "",
"pyproject_table_iOS": "",
"pyproject_table_android": "",
"pyproject_table_web": "",
"pyproject_extra_content": "",
"briefcase_version": "Unknown",
"template_source": "Not provided",
"template_branch": "Not provided",
"_extensions": [
"briefcase.integrations.cookiecutter.TOMLEscape"
]
],
"_jinja2_env_vars": {"lstrip_blocks": true, "trim_blocks": true}
}
10 changes: 3 additions & 7 deletions hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import re
import sys


# The restriction on application naming comes from PEP508
PEP508_NAME_RE = re.compile(
r'^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$',
re.IGNORECASE
)
PEP508_NAME_RE = re.compile(r"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$", re.IGNORECASE)

app_name = '{{ cookiecutter.app_name }}'
app_name = "{{ cookiecutter.app_name }}"

if not re.match(PEP508_NAME_RE, app_name):
print('ERROR: `%s` is not a valid Python package name!' % app_name)
print("ERROR: `%s` is not a valid Python package name!" % app_name)

# exits with status 1 to indicate failure
sys.exit(1)
7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
briefcase @ git+https://github.com/beeware/briefcase.git
cookiecutter == 2.4.0
flake8 == 6.1.0
pre-commit == 3.5.0
pytest == 7.4.3
toml == 0.10.2
tox == 4.11.3
10 changes: 0 additions & 10 deletions tests/apps/verify-ppb.config

This file was deleted.

10 changes: 0 additions & 10 deletions tests/apps/verify-pygame.config

This file was deleted.

10 changes: 0 additions & 10 deletions tests/apps/verify-pyside2.config

This file was deleted.

10 changes: 0 additions & 10 deletions tests/apps/verify-pyside6.config

This file was deleted.

10 changes: 0 additions & 10 deletions tests/apps/verify-toga.config

This file was deleted.

0 comments on commit 0a22308

Please sign in to comment.