Compare commits

...

22 Commits

Author SHA1 Message Date
Cutieguwu 54f9e749d2 Shed CI things that I'll never use.
- Rename qmk to qmk.py
2026-07-03 06:04:01 -04:00
Cutieguwu 28250c5f16 Remove the stupid requirements for qmk clone detection.
CLI Lint / lint (push) Has been cancelled
CLI Setup / test_cli_base_container (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
CLI Setup / test_cli_linux_macos (macos-latest, 3.10) (push) Has been cancelled
CLI Setup / test_cli_linux_macos (macos-latest, 3.11) (push) Has been cancelled
CLI Setup / test_cli_linux_macos (macos-latest, 3.12) (push) Has been cancelled
CLI Setup / test_cli_linux_macos (macos-latest, 3.13) (push) Has been cancelled
CLI Setup / test_cli_linux_macos (macos-latest, 3.14) (push) Has been cancelled
CLI Setup / test_cli_linux_macos (macos-latest, 3.9) (push) Has been cancelled
CLI Setup / test_cli_linux_macos (ubuntu-latest, 3.10) (push) Has been cancelled
CLI Setup / test_cli_linux_macos (ubuntu-latest, 3.11) (push) Has been cancelled
CLI Setup / test_cli_linux_macos (ubuntu-latest, 3.12) (push) Has been cancelled
CLI Setup / test_cli_linux_macos (ubuntu-latest, 3.13) (push) Has been cancelled
CLI Setup / test_cli_linux_macos (ubuntu-latest, 3.14) (push) Has been cancelled
CLI Setup / test_cli_linux_macos (ubuntu-latest, 3.9) (push) Has been cancelled
CLI Setup / test_cli_win (push) Has been cancelled
CLI Setup / test_docker_container (push) Has been cancelled
2026-07-03 06:00:59 -04:00
Cutieguwu ea7b79127a Delete requirements.txt 2026-07-03 06:00:17 -04:00
Cutieguwu e771a06841 Scrap useless CI.
- Also moved ci_tests to ci_tests.sh
2026-07-03 05:58:22 -04:00
Joel Challis 8c6339493d Handle errors on Windows where some of the files have their read-only bit set (#242) 2026-07-01 02:48:30 +01:00
Joel Challis b87b18e9d4 Delete .flake8 2026-07-01 01:01:34 +01:00
Joel Challis e7b88acea2 Update docker workflow to actually run tests inside built container (#237) 2026-06-29 07:44:33 +01:00
Joel Challis 45c8ad6709 Run test script on Windows (#241) 2026-06-29 06:28:53 +01:00
Joel Challis 2116dd9582 Migrate to ruff for python linting (#240) 2026-06-29 06:10:55 +01:00
Joel Challis 05d1c36f49 Migrate setup.cfg to pyproject.toml (#236) 2026-06-29 04:07:19 +01:00
Joel Challis 5e57fdefe0 Add 'slim' container (#231) 2026-06-29 04:06:02 +01:00
dependabot[bot] af2ef5d90f Bump actions/checkout from 6 to 7 (#239)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-20 23:56:18 +01:00
Joel Challis 1f6bb7dab0 Fix badge link in README.md 2026-04-21 00:45:36 +01:00
Joel Challis 2eb3279945 Align README with other repos 2026-04-21 00:41:11 +01:00
Joel Challis 8fd7af98d9 Remove qmk_fpm references (#233) 2026-04-21 00:21:40 +01:00
Joel Challis 240ccd781a Remove the release script 2026-04-21 00:18:36 +01:00
Joel Challis af9e8063f6 Remove Windows environment checks (#232) 2026-04-20 18:18:03 +01:00
dependabot[bot] 3054dad82b Bump docker/setup-buildx-action from 3 to 4 (#226)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 3 to 4.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-13 20:45:31 +00:00
dependabot[bot] 39a271132b Bump docker/build-push-action from 6.18.0 to 7.0.0 (#227)
* Bump docker/build-push-action from 6.18.0 to 7.0.0

Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.18.0 to 7.0.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v6.18.0...v7.0.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply suggestions from code review

Co-authored-by: Joel Challis <git@zvecr.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Joel Challis <git@zvecr.com>
2026-03-13 20:45:16 +00:00
dependabot[bot] c19c21449e Bump docker/login-action from 3 to 4 (#225)
Bumps [docker/login-action](https://github.com/docker/login-action) from 3 to 4.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-13 20:44:55 +00:00
dependabot[bot] f245cb7899 Bump docker/setup-qemu-action from 3 to 4 (#224)
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 3 to 4.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-13 20:44:19 +00:00
dependabot[bot] 0b5866159a Bump WyriHaximus/github-action-get-previous-tag from 1 to 2 (#221)
Bumps [WyriHaximus/github-action-get-previous-tag](https://github.com/wyrihaximus/github-action-get-previous-tag) from 1 to 2.
- [Release notes](https://github.com/wyrihaximus/github-action-get-previous-tag/releases)
- [Commits](https://github.com/wyrihaximus/github-action-get-previous-tag/compare/v1...v2)

---
updated-dependencies:
- dependency-name: WyriHaximus/github-action-get-previous-tag
  dependency-version: '2'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-13 20:44:01 +00:00
24 changed files with 183 additions and 667 deletions
+1 -1
View File
@@ -9,4 +9,4 @@ message = New release: {current_version} → {new_version}
[bumpversion:file:qmk_cli/__init__.py]
[bumpversion:file:setup.cfg]
[bumpversion:file:pyproject.toml]
-17
View File
@@ -1,17 +0,0 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/"
schedule:
interval: "daily"
reviewers:
- "qmk/collaborators"
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
reviewers:
- "qmk/collaborators"
-77
View File
@@ -1,77 +0,0 @@
name: CLI Setup
on:
push:
branches:
- master
pull_request:
jobs:
test_cli_base_container:
runs-on: ubuntu-latest
container: ghcr.io/qmk/qmk_base_container
env:
QMK_HOME: ~/qmk_firmware
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: apt-get update && apt-get install -y python3-venv
- name: Run ci_tests
run: ./ci_tests -a
test_cli_linux_macos:
needs: test_cli_base_container
runs-on: ${{ matrix.os }}
env:
QMK_HOME: ~/qmk_firmware
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Run ci_tests
run: ./ci_tests -a
test_cli_win:
needs: test_cli_base_container
runs-on: windows-latest
env:
QMK_HOME: $HOME/qmk_firmware
steps:
- uses: actions/checkout@v6
- name: (MSYS2) Setup and install dependencies
uses: msys2/setup-msys2@v2
with:
update: true
install: git mingw-w64-x86_64-toolchain mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-build mingw-w64-x86_64-python-pillow mingw-w64-x86_64-rust
# Upgrade pip due to msys packaging + pypa/build/pull/736 issues
- name: (MSYS2) Install Python dependencies
shell: msys2 {0}
run: |
python3 -m pip install --break-system-packages --force-reinstall --upgrade pip
- name: (MSYS2) Install QMK CLI from source
shell: msys2 {0}
run: |
python3 -m build
python3 -m pip install --break-system-packages dist/qmk-*.tar.gz
- name: (MSYS2) Run qmk setup -y
shell: msys2 {0}
run: qmk setup -y
-71
View File
@@ -1,71 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '22 18 * * 0'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@v6
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v4
# ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
-42
View File
@@ -1,42 +0,0 @@
name: Test Docker Image
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/checkout@v6
- name: Run ci_tests
run: ./ci_tests
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install setuptools wheel
pip install -r requirements-dev.txt
- name: Build Python
run: |
python3 -m build
- name: Build Container
uses: docker/build-push-action@v6.18.0
with:
context: .
platforms: linux/amd64,linux/arm64
-60
View File
@@ -1,60 +0,0 @@
name: Rebuild Docker Image
on:
workflow_dispatch:
jobs:
redeploy:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
- name: Download previous artifact
run: |
pip download -d "${GITHUB_WORKSPACE}/dist" qmk=="${{ steps.previoustag.outputs.tag }}"
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and Push to Docker Hub
uses: docker/build-push-action@v6.18.0
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/qmk/qmk_cli:latest
qmkfm/qmk_cli:latest
ghcr.io/qmk/qmk_cli:${{ github.sha }}
qmkfm/qmk_cli:${{ github.sha }}
ghcr.io/qmk/qmk_cli:${{ steps.previoustag.outputs.tag }}
qmkfm/qmk_cli:${{ steps.previoustag.outputs.tag }}
-94
View File
@@ -1,94 +0,0 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Upload Python Package
on:
workflow_dispatch:
inputs:
version_part:
description: 'Which part of the version to increment (patch, minor, major)'
required: true
default: 'patch'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/checkout@v6
- name: Run ci_tests
run: ./ci_tests
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install setuptools wheel
pip install -r requirements-dev.txt
- name: Bump version
run: |
git config --local user.email "hello@qmk.fm"
git config --local user.name "QMK Bot"
bumpversion --dry-run --list ${{ github.event.inputs.version_part }} | grep new_version= | sed "s/new_version/NEW_CLI_VERSION/" >> "$GITHUB_ENV"
bumpversion ${{ github.event.inputs.version_part }}
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master
tags: true
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_APITOKEN }}
run: |
python3 -m build
twine upload dist/*
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and Push to Docker Hub
uses: docker/build-push-action@v6.18.0
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/qmk/qmk_cli:latest
qmkfm/qmk_cli:latest
ghcr.io/qmk/qmk_cli:${{ github.sha }}
qmkfm/qmk_cli:${{ github.sha }}
ghcr.io/qmk/qmk_cli:${{ env.NEW_CLI_VERSION }}
qmkfm/qmk_cli:${{ env.NEW_CLI_VERSION }}
- name: Trigger OS package builds
run: ./trigger_packages
env:
QMK_BOT_TOKEN: ${{ secrets.QMK_BOT_TOKEN }}
+1
View File
@@ -24,6 +24,7 @@ wheels/
.installed.cfg
*.egg
MANIFEST
*.lock
# PyInstaller
# Usually these files are written by a python script from a template
-35
View File
@@ -1,35 +0,0 @@
FROM ghcr.io/qmk/qmk_base_container:latest as builder
# Copy package in
ADD dist /tmp/dist
# Install QMK CLI via bootstrap script
RUN mkdir -p /opt/uv/bin \
&& export UV_PYTHON_INSTALL_DIR=/opt/uv/bin \
&& /bin/bash -c "curl -fsSL https://install.qmk.fm | sh -s -- --confirm --uv-install-dir=/usr/local/bin --uv-tool-dir=/opt/uv/tools --qmk-distrib-dir=/opt/qmk"
# Do the equivalent of entering the virtual environment
ENV PATH=/opt/qmk/bin:/opt/uv/tools/qmk/bin:/usr/local/bin:$PATH \
VIRTUAL_ENV=/opt/uv/tools/qmk
# Install python packages
RUN python3 -m pip uninstall -y qmk || true
RUN python3 -m pip install --upgrade pip setuptools wheel nose2 && \
python3 -m pip install /tmp/dist/qmk-*.whl
# Allow the uv-installed python to be usable by others
RUN chmod -R go=u,go-w /opt/uv /opt/qmk
# 2nd stage so we don't have /tmp/dist in the final image
FROM ghcr.io/qmk/qmk_base_container:latest
COPY --from=builder /opt/uv /opt/uv
COPY --from=builder /opt/qmk /opt/qmk
# Do the equivalent of entering the virtual environment
ENV PATH=/opt/qmk/bin:/opt/uv/tools/qmk/bin:$PATH \
VIRTUAL_ENV=/opt/uv/tools/qmk \
QMK_DISTRIB_DIR=/opt/qmk \
QMK_HOME=/qmk_firmware \
QMK_USERSPACE=/qmk_userspace
+16 -18
View File
@@ -1,9 +1,12 @@
# QMK CLI
[![CLI Setup](https://github.com/qmk/qmk_cli/actions/workflows/cli_setup.yml/badge.svg)](https://github.com/qmk/qmk_cli/actions/workflows/cli_setup.yml)
A program to help users work with [QMK Firmware](https://qmk.fm/).
> A program to help users work with [QMK Firmware](https://qmk.fm/).
# Features
[![Latest Release](https://img.shields.io/github/v/tag/qmk/qmk_cli?color=3D87CE&label=Latest&sort=semver&style=for-the-badge)](https://github.com/qmk/qmk_cli/tags)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/qmk/qmk_cli/cli_setup.yml?logo=github&style=for-the-badge)](https://github.com/qmk/qmk_cli/actions?query=workflow%3ACLI+branch%3Amaster)
[![Discord](https://img.shields.io/discord/440868230475677696.svg?logo=discord&logoColor=white&color=7289DA&style=for-the-badge)](https://discord.gg/qmk)
## Features
* Interact with your qmk_firmware tree from any location
* Use `qmk clone` to pull down anyone's `qmk_firmware` fork
@@ -17,36 +20,31 @@ A program to help users work with [QMK Firmware](https://qmk.fm/).
* `qmk lint`
* ...and many more!
# Packages
## Quickstart
Follow our [documentation to get started](https://docs.qmk.fm/newbs_getting_started).
## Packages
We provide "install and go" packages for many Operating Systems.
## Linux
Packages for several distributions available here: https://github.com/qmk/qmk_fpm
## macOS
### macOS
Using [Homebrew](https://brew.sh):
brew install qmk/qmk/qmk
## Windows
### Windows
Download our custom MSYS2 installer here: https://msys.qmk.fm/
# Quickstart
* `python3 -m pip install qmk`
* `qmk setup`
# Building
## Building
We follow PEP517, you can install using [build](https://pypi.org/project/build/):
Setup:
python3 -m pip install build
python3 -m pip install --group dev
Build:
@@ -54,6 +52,6 @@ Build:
You can read more about working with PEP517 packages in the [Python Packaging User Guide](https://packaging.python.org/guides/distributing-packages-using-setuptools/#packaging-your-project).
# Documentation
## Documentation
Full documentation: <https://docs.qmk.fm/#/tutorial>
-59
View File
@@ -1,59 +0,0 @@
#!/usr/bin/env bash
set -e
#set -x
ADVANCED=false
TMPDIR=$(mktemp -d)
QMK_HOME="$TMPDIR/qmk_firmware"
export QMK_HOME
for arg in $@; do
if [ "$arg" = "-a" ]; then
ADVANCED=true
fi
done
if [ $ADVANCED = true ]; then
echo "*** Running in advanced mode with tmp files in $TMPDIR"
else
echo "*** Running in basic mode with tmp files in $TMPDIR"
fi
# Setup our virtualenv
if [ -e .ci_venv ]; then
rm -rf .ci_venv
fi
python3 -m venv .ci_venv
source .ci_venv/bin/activate
# Install dependencies
python3 -m pip install -U pip wheel
python3 -m pip install .
python3 -m pip install -r requirements-dev.txt
# Ensure that qmk works
echo "*** Testing 'qmk clone -h'"
qmk clone -h
#echo "*** Testing 'qmk config -a'" # Test disabled as `milc` at least 1.6.8+ returns False and thus non-zero exit code
#qmk config -a
echo "*** Testing 'qmk setup -n'"
qmk setup -n
echo
echo "*** Basic tests completed successfully!"
# Run advanced test if requested
if [ $ADVANCED = true ]; then
echo
echo "*** Testing 'qmk setup -y'"
qmk setup -y
echo
echo "*** Advanced tests completed successfully!"
fi
# Cleanup
deactivate
rm -rf .ci_venv $TMPDIR
+133 -4
View File
@@ -1,6 +1,135 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
requires = ["setuptools>=82.0.1"]
build-backend = "setuptools.build_meta"
[project]
name = "qmk"
version = "1.2.0"
license = "MIT"
readme = "README.md"
authors = [{name = "skullydazed", email = "skullydazed@gmail.com"}]
description = "A program to help users work with QMK Firmware."
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Intended Audience :: End Users/Desktop",
"Natural Language :: English",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Scientific/Engineering",
"Topic :: Software Development",
"Topic :: Utilities",
]
requires-python = ">=3.9"
dependencies = [
"hid",
"milc>=1.9.0",
"platformdirs",
"pyusb",
# qmk_firmware packages
"dotty-dict",
"hjson",
"jsonschema>=4",
"pillow",
"pygments",
"pyserial",
]
[dependency-groups]
dev = [
"build",
"bumpversion",
"ruff",
"twine",
"yapf",
]
[project.urls]
"Bug Tracker" = "https://github.com/qmk/qmk_cli/issues"
Documentation = "https://docs.qmk.fm/cli"
Homepage = "https://qmk.fm/"
Source = "https://github.com/qmk/qmk_cli/"
[project.scripts]
qmk = "qmk_cli.script_qmk:main"
[tool.setuptools]
include-package-data = false
[tool.setuptools.packages]
find = {namespaces = false}
[tool.ruff]
target-version = "py39"
include = ['qmk_cli/**/*.py']
[tool.ruff.lint]
select = ["E", "F", "B", "N", "W", "COM", "C901", "PGH004"]
ignore = [
"E501", # QMK is ok with long lines.
"E231", # Conflicts with our yapf config
]
[tool.ruff.lint.mccabe]
max-complexity = 14 # Let's slowly crank this down
[tool.yapfignore]
ignore_patterns = [
".direnv/**/*",
".env/**/*",
]
[tool.yapf]
align_closing_bracket_with_visual_indent = true
allow_multiline_dictionary_keys = false
allow_multiline_lambdas = false
allow_split_before_default_or_named_assigns = true
allow_split_before_dict_value = true
arithmetic_precedence_indication = true
blank_lines_around_top_level_definition = 2
blank_line_before_class_docstring = false
blank_line_before_module_docstring = false
blank_line_before_nested_class_or_def = false
coalesce_brackets = true
column_limit = 256
continuation_align_style = "SPACE"
continuation_indent_width = 4
dedent_closing_brackets = true
disable_ending_comma_heuristic = false
each_dict_entry_on_separate_line = true
i18n_comment = ""
i18n_function_call = ""
indent_blank_lines = false
indent_dictionary_value = true
indent_width = 4
join_multiple_lines = false
no_spaces_around_selected_binary_operators = ""
spaces_around_default_or_named_assign = false
spaces_around_power_operator = false
spaces_before_comment = 2
space_between_ending_comma_and_closing_bracket = false
split_all_comma_separated_values = false
split_arguments_when_comma_terminated = true
split_before_arithmetic_operator = false
split_before_bitwise_operator = true
split_before_closing_bracket = true
split_before_dict_set_generator = true
split_before_dot = false
split_before_expression_after_opening_paren = false
split_before_first_argument = false
split_before_logical_operator = false
split_before_named_assigns = true
split_complex_comprehension = true
split_penalty_after_opening_bracket = 300
split_penalty_after_unary_operator = 10000
split_penalty_arithmetic_operator = 300
split_penalty_before_if_expr = 0
split_penalty_bitwise_operator = 300
split_penalty_comprehension = 80
split_penalty_excess_character = 7000
split_penalty_for_added_line_split = 30
split_penalty_import_names = 0
split_penalty_logical_operator = 300
use_tabs = false
+1
View File
@@ -2,4 +2,5 @@
"""Wrapper to call the qmk cli script entrypoint.
"""
import qmk_cli.script_qmk
qmk_cli.script_qmk.main()
+20 -5
View File
@@ -1,14 +1,17 @@
"""Useful helper functions.
"""
import os
import sys
import stat
import json
import shutil
from functools import lru_cache
from pathlib import Path
from milc import cli
def AbsPath(arg):
def AbsPath(arg): # noqa: N802
"""Resolve relative paths to the original working directory.
"""
arg = Path(arg)
@@ -18,15 +21,27 @@ def AbsPath(arg):
return arg
def rmtree(path):
"""Safe version of shutil.rmtree which handles errors on Windows where some of the files have their read-only bit set."""
def remove_readonly(func, path, _):
"""Clear the readonly bit and reattempt the removal."""
os.chmod(path, stat.S_IWRITE)
func(path)
if sys.version_info >= (3, 12):
# See https://docs.python.org/3.12/whatsnew/3.12.html#shutil
return shutil.rmtree(path, onexc=remove_readonly)
else:
return shutil.rmtree(path, onerror=remove_readonly)
def is_qmk_firmware(qmk_firmware):
"""Returns True if the given Path() is a qmk_firmware clone.
"""
paths = [
qmk_firmware,
qmk_firmware / 'quantum',
qmk_firmware / 'requirements.txt',
qmk_firmware / 'requirements-dev.txt',
qmk_firmware / 'lib/python/qmk/cli/__init__.py'
qmk_firmware / 'lib/python/qmk/cli/__init__.py',
]
for path in paths:
@@ -80,7 +95,7 @@ def is_qmk_userspace(qmk_userspace):
try:
return 'userspace_version' in json.loads(path.read_text(encoding="UTF-8"))
except json.decoder.JSONDecodeError as e:
except json.decoder.JSONDecodeError:
return False
+3 -24
View File
@@ -43,7 +43,7 @@ milc.cli.milc_options(version=__version__)
milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}Ψ{style_reset_all}'
# These must happen after the milc.milc_options() call
import milc.subcommand.config # noqa, must come after milc.milc_options()
import milc.subcommand.config # noqa: E402, must come after milc.milc_options()
@milc.cli.entrypoint('CLI wrapper for running QMK commands.')
@@ -73,27 +73,6 @@ def main():
print('Warning: Your Python version is out of date! Some subcommands may not work!')
print('Please upgrade to Python 3.9 or later.')
if 'windows' in platform().lower():
msystem = os.environ.get('MSYSTEM', '')
# Assume the environment isn't workable by default
env_ok = False
# Check if we're using the mingw64/msys2 environment
if 'mingw64' in sys.executable and 'MINGW64' in msystem:
env_ok = True
# Check if we're using a `uv`-based environment
if '\\uv\\' in sys.executable or '/uv/' in sys.executable:
env_ok = True
# If none of the options above were true, then we're in an unsupported environment. Bomb out.
if not env_ok:
print('ERROR: It seems you are not using the MINGW64 terminal.')
print('Please close this terminal and open a new MSYS2 MinGW 64-bit terminal.')
print('Python: %s, MSYSTEM: %s' % (sys.executable, msystem))
exit(1)
# Environment setup
qmk_userspace = find_qmk_userspace()
qmk_firmware = find_qmk_firmware()
@@ -104,7 +83,7 @@ def main():
os.environ['QMK_HOME'] = str(qmk_firmware)
os.environ['ORIG_CWD'] = os.getcwd()
import qmk_cli.subcommands
import qmk_cli.subcommands # noqa: F401
# Check out and initialize the qmk_firmware environment
if is_qmk_firmware(qmk_firmware):
@@ -113,7 +92,7 @@ def main():
sys.path.append(str(qmk_firmware / 'lib/python'))
try:
import qmk.cli # noqa
import qmk.cli # noqa: F401
except ImportError as e:
if qmk_firmware.name != 'qmk_firmware':
+4 -4
View File
@@ -2,7 +2,7 @@
We list each subcommand here explicitly because all the reliable ways of searching for modules are slow and delay startup.
"""
from . import clone # noqa
from . import console # noqa
from . import env # noqa
from . import setup # noqa
from . import clone # noqa: F401
from . import console # noqa: F401
from . import env # noqa: F401
from . import setup # noqa: F401
+1 -1
View File
@@ -53,7 +53,7 @@ KNOWN_BOOTLOADERS = {
('2A03', '0036'): 'caterina: Arduino Leonardo',
('2A03', '0037'): 'caterina: Arduino Micro',
('314B', '0106'): 'apm32-dfu: APM32 DFU ISP Mode',
('342D', 'DFA0'): 'wb32-dfu: WB32 Device in DFU Mode'
('342D', 'DFA0'): 'wb32-dfu: WB32 Device in DFU Mode',
}
+1 -1
View File
@@ -17,7 +17,7 @@ def env(cli):
'QMK_FIRMWARE': home if is_qmk_firmware(Path(home)) else "",
'QMK_USERSPACE': userspace if is_qmk_userspace(Path(userspace)) else "",
'QMK_DISTRIB_DIR': os.environ.get('QMK_DISTRIB_DIR', ""),
'QMK_PATH_PREFIX': os.environ.get('QMK_PATH_PREFIX', "")
'QMK_PATH_PREFIX': os.environ.get('QMK_PATH_PREFIX', ""),
}
# Now munge the current cli config
+2 -3
View File
@@ -5,12 +5,11 @@ import shlex
import subprocess
import sys
from pathlib import Path
from shutil import rmtree
from milc import cli
from milc.questions import choice, question, yesno
from qmk_cli.git import git_clone
from qmk_cli.helpers import AbsPath, is_qmk_firmware
from qmk_cli.helpers import AbsPath, is_qmk_firmware, rmtree
default_base = 'https://github.com'
default_repo = 'qmk_firmware'
@@ -82,7 +81,7 @@ def setup(cli):
found_options = [
f"Delete and reclone {cli.args.fork}",
"Delete and clone a different fork",
"Keep it and continue"
"Keep it and continue",
]
delete_confirm = "WARNING: This will delete your current qmk_firmware directory. Proceed?"
-7
View File
@@ -1,7 +0,0 @@
#!/bin/bash
# Increment the verison number and release a new version of qmk_cli.
#
# Required packages: pip3 install bumpversion twine
echo "Use the github action instead!"
exit 1
-4
View File
@@ -1,4 +0,0 @@
build
bumpversion
requests
twine
-3
View File
@@ -1,3 +0,0 @@
--index-url https://pypi.python.org/simple/
-e .
-108
View File
@@ -1,108 +0,0 @@
#[bumpversion]
# Bumpversion config has been moved to .bumpversion.cfg
[bdist_wheel]
universal = 1
[flake8]
ignore = E501,E226
[metadata]
name = qmk
version = 1.2.0
author = skullydazed
author_email = skullydazed@gmail.com
description = A program to help users work with QMK Firmware.
long_description = file: README.md
long_description_content_type = text/markdown
license = MIT License
project_urls =
Bug Tracker = https://github.com/qmk/qmk_cli/issues
Documentation = https://docs.qmk.fm/#/cli
Homepage = https://qmk.fm/
Source = https://github.com/qmk/qmk_cli/
classifiers =
Development Status :: 3 - Alpha
Environment :: Console
Intended Audience :: Developers
Intended Audience :: System Administrators
Intended Audience :: End Users/Desktop
License :: OSI Approved :: MIT License
Natural Language :: English
Programming Language :: Python :: 3 :: Only
Topic :: Scientific/Engineering
Topic :: Software Development
Topic :: Utilities
[options]
install_requires =
hid
milc>=1.9.0
platformdirs
pyusb
# qmk_firmware packages
dotty-dict
hjson
jsonschema>=4
pillow
pygments
pyserial
packages = find:
python_requires = >=3.9
[options.entry_points]
console_scripts =
qmk = qmk_cli.script_qmk:main
[yapf]
align_closing_bracket_with_visual_indent = True
allow_multiline_dictionary_keys = False
allow_multiline_lambdas = False
allow_split_before_default_or_named_assigns = True
allow_split_before_dict_value = True
arithmetic_precedence_indication = True
blank_lines_around_top_level_definition = 2
blank_line_before_class_docstring = False
blank_line_before_module_docstring = False
blank_line_before_nested_class_or_def = False
coalesce_brackets = True
column_limit = 256
continuation_align_style = SPACE
continuation_indent_width = 4
dedent_closing_brackets = True
disable_ending_comma_heuristic = False
each_dict_entry_on_separate_line = True
i18n_comment =
i18n_function_call =
indent_blank_lines = False
indent_dictionary_value = True
indent_width = 4
join_multiple_lines = False
no_spaces_around_selected_binary_operators =
spaces_around_default_or_named_assign = False
spaces_around_power_operator = False
spaces_before_comment = 2
space_between_ending_comma_and_closing_bracket = False
split_all_comma_separated_values = False
split_arguments_when_comma_terminated = True
split_before_arithmetic_operator = False
split_before_bitwise_operator = True
split_before_closing_bracket = True
split_before_dict_set_generator = True
split_before_dot = False
split_before_expression_after_opening_paren = False
split_before_first_argument = False
split_before_logical_operator = False
split_before_named_assigns = True
split_complex_comprehension = True
split_penalty_after_opening_bracket = 300
split_penalty_after_unary_operator = 10000
split_penalty_arithmetic_operator = 300
split_penalty_before_if_expr = 0
split_penalty_bitwise_operator = 300
split_penalty_comprehension = 80
split_penalty_excess_character = 7000
split_penalty_for_added_line_split = 30
split_penalty_import_names = 0
split_penalty_logical_operator = 300
use_tabs = False
-29
View File
@@ -1,29 +0,0 @@
#!/usr/bin/env python3
"""Trigger workflows that build QMK packages.
"""
from os import environ
from pathlib import Path
import requests
# Pull in environment vars
gh_user = environ.get('GH_USERNAME', 'qmk-bot')
gh_pat = environ.get('QMK_BOT_TOKEN', '')
gh_repo_owner = environ.get('REPO_OWNER', 'qmk')
gh_repo_name = environ.get('REPO_NAME', 'qmk_fpm')
gh_ref = environ.get('BRANCH_NAME', 'main')
gh_workflow_ids = environ.get('WORKFLOW_IDS', 'all-trigger.yml').split(',')
gh_api_url = environ.get('GITHUB_API_URL', 'https://api.github.com')
gh_workflow_args = {'ref': gh_ref}
gh_workflow_headers = {'Accept': 'application/vnd.github.v3+json'}
for gh_workflow_id in gh_workflow_ids:
gh_workflow_endpoint = f'{gh_api_url}/repos/{gh_repo_owner}/{gh_repo_name}/actions/workflows/{gh_workflow_id}/dispatches'
print(f'Triggering {gh_workflow_id} workflow at: {gh_workflow_endpoint}')
workflow_dispatch = requests.post(gh_workflow_endpoint, headers=gh_workflow_headers, json=gh_workflow_args, auth=(gh_user, gh_pat))
if workflow_dispatch.status_code != 204:
print(f'Error from GitHub API, status_code {workflow_dispatch.status_code}!')
print(workflow_dispatch.text)
exit(1)
exit(0)