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

Additional schema fixes #17414

Merged
merged 2 commits into from
Jun 18, 2022
Merged

Additional schema fixes #17414

merged 2 commits into from
Jun 18, 2022

Conversation

zvecr
Copy link
Member

@zvecr zvecr commented Jun 18, 2022

Description

Continues from 14200 (and somewhat 16635).

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@zvecr zvecr requested a review from a team June 18, 2022 02:09
@github-actions github-actions bot added cli qmk cli command python labels Jun 18, 2022
@zvecr zvecr added the bug label Jun 18, 2022
@tzarc tzarc merged commit 17ec165 into qmk:develop Jun 18, 2022
@sol
Copy link

sol commented Jun 27, 2022

This change breaks the Arch qmk package, e.g.:

$ /bin/qmk compile -c -kb handwired/onekey/blackpill_f401 -km default
Error: %s: %s ('ImportError', ImportError("cannot import name 'Draft202012Validator' from 'jsonschema' (/usr/lib/python3.10/site-packages/jsonschema/__init__.py)"))
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/qmk_cli/script_qmk.py", line 76, in main
    import qmk.cli  # noqa
  File "/home/sol/qmk_firmware/lib/python/qmk/cli/__init__.py", line 230, in <module>
    __import__(subcommand)
  File "/home/sol/qmk_firmware/lib/python/qmk/cli/generate/info_json.py", line 8, in <module>
    from jsonschema import Draft202012Validator, RefResolver, validators
ImportError: cannot import name 'Draft202012Validator' from 'jsonschema' (/usr/lib/python3.10/site-packages/jsonschema/__init__.py)

From what I understand this is what happens:

  1. Arch still uses jsonschema-3.2.0
  2. /bin/qmk (indirectly) invokes qmk from $HOME/qmk_firmware which now requires jsonschema-4.*
  3. Execution fails due to Draft202012Validator not being present in jsonschema-3.2.0

Solutions (non-exhaustive)

This is what a user can do to make things work until Arch updates jsonschema.

Option 1: Update jsonschema for your local Arch installation

I haven't spent extensive time on that route.

Ideally, you would just need to update pkgver in the PKGBUILD, however there are two hings that I noticed:

  1. The PKGBUILD patches jsonschema. This patch does not apply cleanly for the latest version. From what I understand, the patch is not necessary anymore, so just removing that step should be fine.
  2. The PKGBUILD expects that the source tarball contains a setup.py. That file is missing from the tarball of the latest version. I'm not an expert here, but I assume there is an alternative way to install python packages that you would need to use here.

Option 2: Install qmk with pipx

You can use pipx to install qmk into your home directory. The installation is fully isolated and self-contained (as far as the python dependencies are concerned, you still need to ensure that you have avr-gcc etc. in place).

This is what I'm doing for now.

@zvecr @tzarc I'm leaving this here, mainly for others to read if they run into the same issue. Is this something you want to track in qmk/qmk_firmware? If yes, I'm happy to open a separate issue for it. (Technically, it's a downstream issue with Arch, not with qmk itself.)

@zvecr
Copy link
Member Author

zvecr commented Jun 27, 2022

Given that qmk 1.1.0 was incorrectly packaged by Arch maintainers with the wrong dependencies, and QMK does not own that packaging, the issue should be raised/tracked elsewhere.

@zvecr zvecr deleted the feature/more_schema_updates branch June 27, 2022 16:43
0xcharly pushed a commit to Bastardkb/bastardkb-qmk that referenced this pull request Jul 4, 2022
@jasonkena
Copy link
Contributor

You can also enable the community-testing repository in /etc/pacman.conf to install python-jsonschema 4.9.0-1 (link).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cli qmk cli command python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants