From 027970bf36b81c0b51af9a4010c083f25ed04371 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Fri, 12 Jan 2024 07:48:40 -0800 Subject: [PATCH 1/3] Ensure that pre-commit is installed for publish. --- .github/workflows/npm-publish.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index cf7444e..e36276a 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -17,6 +17,10 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.9 + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install pre-commit - run: make release-npm env: NODE_AUTH_TOKEN: ${{secrets.NPM_API_TOKEN}} From 0bd48e5fff50d0b2cac560a418aa7a2b2d113688 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Fri, 12 Jan 2024 08:00:44 -0800 Subject: [PATCH 2/3] Add pre-commit hook to check for uncommitted regenerated spec files. Skip hook when calling pre-commit in generate script to avoid recursion. --- .pre-commit-config.yaml | 8 ++++++++ scripts/generate_from_specs.py | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b52e549..20726dc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,13 @@ exclude: (\.git/|\.tox/|\.venv/|le_utils\.egg-info) repos: +- repo: local + hooks: + - id: rebuild-from-specs + name: Regenerate files + description: Regenerates files when specs or version has changed + entry: make build + language: system + files: (spec/.*\.json|setup\.py)$ - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.0.0 hooks: diff --git a/scripts/generate_from_specs.py b/scripts/generate_from_specs.py index 8032f58..48d52c7 100644 --- a/scripts/generate_from_specs.py +++ b/scripts/generate_from_specs.py @@ -307,4 +307,7 @@ def set_package_json_version(): output_files += set_package_json_version() - subprocess.call(["pre-commit", "run", "--files"] + output_files) + env = os.environ.copy() + env["SKIP"] = "rebuild-from-specs" + + subprocess.call(["pre-commit", "run", "--files"] + output_files, env=env) From b17514f7634a478e5aa0ec64dd1c10737030088e Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Fri, 12 Jan 2024 08:03:34 -0800 Subject: [PATCH 3/3] Expand Python support for le-utils for ease. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ce37712..8508bb9 100644 --- a/setup.py +++ b/setup.py @@ -33,5 +33,5 @@ ], author="Learning Equality", author_email="info@learningequality.org", - python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <3.12", + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <3.13", )