Skip to content

Commit

Permalink
fixup! python3: Package with pyproject/hatch
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnAZoidberg committed Nov 17, 2023
1 parent 17f1675 commit 3408b4c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 89 deletions.
84 changes: 1 addition & 83 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Rust CI
on:
push:

Expand Down Expand Up @@ -107,85 +107,3 @@ jobs:

- name: Run cargo clippy
run: cargo clippy -- -D warnings

build-gui:
name: Build GUI
runs-on: windows-2022
steps:
- uses: actions/checkout@v3

- name: Download releases to bundle
run: |
mkdir releases
mkdir releases\0.2.3
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.3/framework_ansi_default_v0.2.3.uf2 -OutFile releases\0.2.3\framework_ansi_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.3/framework_iso_default_v0.2.3.uf2 -OutFile releases\0.2.3\framework_iso_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.3/framework_jis_default_v0.2.3.uf2 -OutFile releases\0.2.3\framework_jis_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.3/framework_numpad_default_v0.2.3.uf2 -OutFile releases\0.2.3\framework_numpad_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.3/framework_macropad_default_v0.2.3.uf2 -OutFile releases\0.2.3\framework_macropad_default.uf2
mkdir releases\0.2.2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.2/framework_ansi_default_v0.2.2.uf2 -OutFile releases\0.2.2\framework_ansi_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.2/framework_iso_default_v0.2.2.uf2 -OutFile releases\0.2.2\framework_iso_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.2/framework_jis_default_v0.2.2.uf2 -OutFile releases\0.2.2\framework_jis_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.2/framework_numpad_default_v0.2.2.uf2 -OutFile releases\0.2.2\framework_numpad_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.2/framework_macropad_default_v0.2.2.uf2 -OutFile releases\0.2.2\framework_macropad_default.uf2
mkdir releases\0.2.1
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.1/framework_ansi_default_v0.2.1.uf2 -OutFile releases\0.2.1\framework_ansi_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.1/framework_iso_default_v0.2.1.uf2 -OutFile releases\0.2.1\framework_iso_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.1/framework_jis_default_v0.2.1.uf2 -OutFile releases\0.2.1\framework_jis_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.1/framework_numpad_default_v0.2.1.uf2 -OutFile releases\0.2.1\framework_numpad_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.1/framework_macropad_default_v0.2.1.uf2 -OutFile releases\0.2.1\framework_macropad_default.uf2
mkdir releases\0.2.0
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.0/framework_ansi_default_v0.2.0.uf2 -OutFile releases\0.2.0\framework_ansi_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.0/framework_iso_default_v0.2.0.uf2 -OutFile releases\0.2.0\framework_iso_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.0/framework_jis_default_v0.2.0.uf2 -OutFile releases\0.2.0\framework_jis_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.0/framework_numpad_default_v0.2.0.uf2 -OutFile releases\0.2.0\framework_numpad_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.2.0/framework_macropad_default_v0.2.0.uf2 -OutFile releases\0.2.0\framework_macropad_default.uf2
mkdir releases\0.1.9
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.9/framework_ansi_default_v0.1.9.uf2 -OutFile releases\0.1.9\framework_ansi_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.9/framework_iso_default_v0.1.9.uf2 -OutFile releases\0.1.9\framework_iso_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.9/framework_jis_default_v0.1.9.uf2 -OutFile releases\0.1.9\framework_jis_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.9/framework_numpad_default_v0.1.9.uf2 -OutFile releases\0.1.9\framework_numpad_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.9/framework_macropad_default_v0.1.9.uf2 -OutFile releases\0.1.9\framework_macropad_default.uf2
mkdir releases\0.1.8
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.8/framework_ansi_default.uf2 -OutFile releases\0.1.8\framework_ansi_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.8/framework_iso_default.uf2 -OutFile releases\0.1.8\framework_iso_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.8/framework_jis_default.uf2 -OutFile releases\0.1.8\framework_jis_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.8/framework_numpad_default.uf2 -OutFile releases\0.1.8\framework_numpad_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.8/framework_gridpad_default.uf2 -OutFile releases\0.1.8\framework_gridpad_default.uf2
mkdir releases\0.1.7
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.7/framework_ansi_default_v0.1.7.uf2 -OutFile releases\0.1.7\framework_ansi_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.7/framework_iso_default_v0.1.7.uf2 -OutFile releases\0.1.7\framework_iso_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.7/framework_jis_default_v0.1.7.uf2 -OutFile releases\0.1.7\framework_jis_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.7/framework_numpad_default_v0.1.7.uf2 -OutFile releases\0.1.7\framework_numpad_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.7/framework_gridpad_default_v0.1.7.uf2 -OutFile releases\0.1.7\framework_gridpad_default.uf2
mkdir releases\0.1.6
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.6/framework_ansi_default.uf2 -OutFile releases\0.1.6\framework_ansi_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.6/framework_iso_default.uf2 -OutFile releases\0.1.6\framework_iso_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.6/framework_jis_default.uf2 -OutFile releases\0.1.6\framework_jis_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.6/framework_numpad_default.uf2 -OutFile releases\0.1.6\framework_numpad_default.uf2
Invoke-WebRequest -Uri https://github.com/FrameworkComputer/qmk_firmware/releases/download/v0.1.6/framework_gridpad_default.uf2 -OutFile releases\0.1.6\framework_gridpad_default.uf2
# To run locally, need to make sure to include the pywin32 DLL
# pyinstaller --onefile, --name "qmk_gui", --windowed, --add-data "releases;releases" --path C:\users\skype\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\Python311\site-packages\pywin32_system32 --icon=res\logo_cropped_transparent_keyboard_48x48.ico --add-data 'res;res' qmk_gui.py
- name: Create Executable
uses: JohnAZoidberg/pyinstaller-action@dont-clean
with:
python_ver: '3.11'
spec: python/qmk_hid/gui.py
requirements: 'requirements.txt'
upload_exe_with_name: 'qmk_gui.exe'
options: --onefile, --name "qmk_gui", --windowed, --add-data "releases;releases" --icon=res/logo_cropped_transparent_keyboard_48x48.ico --add-data 'res;res'

package-python:
name: Package Python
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- run: |
cd python
python3 -m pip install --upgrade build
python3 -m pip install --upgrade hatch
python3 -m pip install --upgrade twine
python3 -m build
10 changes: 4 additions & 6 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
requires = ["hatchling", "hatch-vcs", "hatch-requirements-txt"]
build-backend = "hatchling.build"

[project]
Expand All @@ -23,11 +23,6 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
]
dependencies = [
"hidapi==0.14.0",
"PySimpleGUI==4.60.5",
"pywin32; os_name == 'nt'",
]

[project.urls]
Issues = "https://github.com/FrameworkComputer/qmk_hid/issues"
Expand All @@ -46,6 +41,9 @@ qmk_gui = "qmk_hid.gui:main"
#[tool.hatch.build.hooks.vcs]
#version-file = "qmk_hid/_version.py"

[tool.hatch.metadata.hooks.requirements_txt]
files = ["requirements.txt"]

[tool.hatch.build.targets.sdist]
exclude = [
"/.github",
Expand Down
3 changes: 3 additions & 0 deletions python/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
hidapi==0.14.0
PySimpleGUI==4.60.5
pywin32; os_name == 'nt'

0 comments on commit 3408b4c

Please sign in to comment.