From 2a68f137def6ee2edc0ba2d2c40eed0b04feae9c Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Thu, 8 Oct 2026 17:35:04 -0700 Subject: [PATCH 01/17] fix ci.yml? --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 642b821..47df803 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,6 @@ jobs: version: 0.12.24 - name: Run tests run: uv run ./run tests - presubmit: runs-on: ubuntu-latest strategy: From 80ea8e0f63d6f299a159eb4e90e977b9eebb3794 Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Thu, 8 Oct 2026 17:39:14 -0700 Subject: [PATCH 02/17] fix ci.yml again? --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47df803..2e6d82e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,11 +24,13 @@ jobs: version: 0.12.24 - name: Run tests run: uv run ./run tests + presubmit: runs-on: ubuntu-latest strategy: matrix: python-version: ["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 From 576571d69b6a94bcf801b5e1e43d7eec76bf52aa Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Thu, 8 Oct 2026 17:40:46 -0700 Subject: [PATCH 03/17] fix setup-uv version --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e6d82e..ce54d26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install uv - uses: astral-sh/setup-uv@v10 + uses: astral-sh/setup-uv@v7 with: version: 0.12.24 - name: Run tests @@ -37,7 +37,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install uv - uses: astral-sh/setup-uv@v10 + uses: astral-sh/setup-uv@v7 with: version: 0.12.24 - name: Run presubmit From 2d1a0419b6fc4d32394a01c9fd5cef2efd15404e Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Fri, 9 Oct 2026 08:59:52 -0700 Subject: [PATCH 04/17] Split tests into build/tests for old versions, disable regen in presubmit. --- .github/workflows/ci.yml | 40 +++++++++++++++++++++++++++++++--------- run | 3 ++- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce54d26..12b2f73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,24 +7,46 @@ on: - main jobs: - tests: + build: runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10"] steps: - uses: actions/checkout@v6 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - name: Install uv uses: astral-sh/setup-uv@v7 with: version: 0.12.24 - - name: Run tests + - name: Build sdist and wheel + run: uv build --python 3.13 + - uses: actions/upload-artifact@v4 + name: Upload packages + with: name dist + path: dist/ run: uv run ./run tests + test: + needs: build + runs-on: ubuntu-latest + matrix: python-version: ["3.8", "3.9", "3.10"] + steps: + - uses: actions/checkout@v6 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + - uses: astral-sh/setup-uv@v7 + with: + uv: 0.12.24 + - name: Install wheel and run tests + run: | + uv venv --python ${{ matrix.python-vesion }} + uv pip install --python ./venv/bin/python dist/*.whl + ./venv/bin/python ./run tests + + presubmit: runs-on: ubuntu-latest strategy: diff --git a/run b/run index 67063bf..8890457 100755 --- a/run +++ b/run @@ -416,7 +416,8 @@ class Runner: self.args.unit = False steps = ( - ('regen --check', self.run_regen), + # TODO: Enable this once glop is properly packaged and available. + # ('regen --check', self.run_regen), ('format --check', self.run_format), ('checks', self.run_checks), ('tests', self.run_tests), From 10522131f41e4b7df242740fab5c2ebad2d682ab Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Fri, 9 Oct 2026 09:08:54 -0700 Subject: [PATCH 05/17] more ci.yaml fixes --- .github/workflows/ci.yml | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12b2f73..5a67bf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,10 +2,15 @@ name: Python package on: push: + branches: [**] pull_request: - branches: + branches: [main] - main +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: runs-on: ubuntu-latest @@ -17,34 +22,33 @@ jobs: version: 0.12.24 - name: Build sdist and wheel run: uv build --python 3.13 - - uses: actions/upload-artifact@v4 - name: Upload packages - with: name dist - path: dist/ - run: uv run ./run tests + - name: Upload packages + uses: actions/upload-artifact@v4 + - with: + - name: dist + - path: dist/ test: needs: build runs-on: ubuntu-latest - matrix: python-version: ["3.8", "3.9", "3.10"] + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10"] + fail-fast: false steps: - uses: actions/checkout@v6 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - uses: actions/download-artifact@v4 with: name: dist path: dist/ - uses: astral-sh/setup-uv@v7 with: - uv: 0.12.24 + version: 0.12.24 - name: Install wheel and run tests run: | - uv venv --python ${{ matrix.python-vesion }} + uv venv --python ${{ matrix.python-version }} .venv uv pip install --python ./venv/bin/python dist/*.whl - ./venv/bin/python ./run tests + uv run --python ${{ matrix.python-version }} ./run tests presubmit: @@ -52,15 +56,12 @@ jobs: strategy: matrix: python-version: ["3.11", "3.12", "3.13", "3.14"] + fail-fast: false steps: - uses: actions/checkout@v6 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - name: Install uv uses: astral-sh/setup-uv@v7 with: version: 0.12.24 - name: Run presubmit - run: uv run ./run presubmit + run: uv run --python ${{ matrix.python-version }} ./run presubmit From a5e01da45fe6413ef51556a38adaa50f16f6898d Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Fri, 9 Oct 2026 09:12:17 -0700 Subject: [PATCH 06/17] yet more ci.yaml fixes --- .github/workflows/ci.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a67bf3..c17605e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,14 +2,13 @@ name: Python package on: push: - branches: [**] + branches: ["**"] pull_request: branches: [main] - - main concurrency: group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + cancel-in-progress: ${{ github.event_name == "pull_request" }} jobs: build: @@ -25,8 +24,8 @@ jobs: - name: Upload packages uses: actions/upload-artifact@v4 - with: - - name: dist - - path: dist/ + name: dist + path: dist/ test: needs: build @@ -34,7 +33,7 @@ jobs: strategy: matrix: python-version: ["3.8", "3.9", "3.10"] - fail-fast: false + fail-fast: false steps: - uses: actions/checkout@v6 - uses: actions/download-artifact@v4 @@ -48,7 +47,7 @@ jobs: run: | uv venv --python ${{ matrix.python-version }} .venv uv pip install --python ./venv/bin/python dist/*.whl - uv run --python ${{ matrix.python-version }} ./run tests + .venv/bin/python ./run tests presubmit: @@ -56,7 +55,7 @@ jobs: strategy: matrix: python-version: ["3.11", "3.12", "3.13", "3.14"] - fail-fast: false + fail-fast: false steps: - uses: actions/checkout@v6 - name: Install uv From 97762e6322292a0d1960180d224dcfdab56ad09c Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Fri, 9 Oct 2026 09:14:26 -0700 Subject: [PATCH 07/17] try again --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c17605e..6891b66 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == "pull_request" }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: build: @@ -23,7 +23,7 @@ jobs: run: uv build --python 3.13 - name: Upload packages uses: actions/upload-artifact@v4 - - with: + with: name: dist path: dist/ @@ -46,7 +46,7 @@ jobs: - name: Install wheel and run tests run: | uv venv --python ${{ matrix.python-version }} .venv - uv pip install --python ./venv/bin/python dist/*.whl + uv pip install --python .venv/bin/python dist/*.whl .venv/bin/python ./run tests From 2296ad7851fba1c6c221e1de892e9d43a42fa4d1 Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Fri, 9 Oct 2026 09:22:03 -0700 Subject: [PATCH 08/17] fix venv, pdb bugs --- .github/workflows/ci.yml | 5 +++-- run | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6891b66..424d286 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,8 +46,9 @@ jobs: - name: Install wheel and run tests run: | uv venv --python ${{ matrix.python-version }} .venv - uv pip install --python .venv/bin/python dist/*.whl - .venv/bin/python ./run tests + source .venv/bin/activate + uv pip install dist/*.whl + ./run tests presubmit: diff --git a/run b/run index 8890457..1e74cd9 100755 --- a/run +++ b/run @@ -444,7 +444,6 @@ class Runner: return 2 self._check_version() - import pdb; pdb.set_trace() sep = os.path.sep tgz = f'dist{sep}{self.package}-{self.version}.tar.gz' From 4cdfafd7cc52d3b76f1ca107679108cb18398481 Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Fri, 9 Oct 2026 09:37:05 -0700 Subject: [PATCH 09/17] fix run_cmd --- run | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/run b/run index 1e74cd9..65dd7a5 100755 --- a/run +++ b/run @@ -50,9 +50,9 @@ class Runner: sys.exit(2) if 'VIRTUAL_ENV' in os.environ: - self.run_cmd = [] + self.run_cmd = ['python', '-m'] else: - self.run_cmd = [self.uv_path, 'run'] + self.run_cmd = [self.uv_path, 'run', 'python', '-m'] def main(self, argv): self.parse_args(argv) @@ -276,9 +276,7 @@ class Runner: if not self.args.quiet: print('\n### pylint') - proc = self._call( - self.run_cmd[:-1] + ['pylint', 'run'] + self._files() - ) + proc = self._call(self.run_cmd + ['pylint', 'run'] + self._files()) if proc.returncode == 0 and not self.args.quiet: print('Success: pylint found no issues') @@ -316,7 +314,6 @@ class Runner: cmd.append('--branch') cmd.extend( [ - 'python', '-m', 'unittest', 'discover', @@ -353,9 +350,7 @@ class Runner: def run_format(self): self._check_python_version() - cmd = [ - self.uv_path, - 'run', + cmd = self.run_cmd[:-2] + [ 'pyproject-fmt', '--column-width', '80', @@ -432,7 +427,7 @@ class Runner: if not self.args.quiet and not self.returncode: print('\n## Presubmit passed.') - else: + elif self.returncode: print('\n## Presubmit failed.') return self.returncode @@ -535,13 +530,9 @@ class Runner: return proc.returncode def run_tests(self): - _ = self._call( - self.run_cmd + ['python', '-m', 'doctest', 'json5/lib.py'] - ) + _ = self._call(self.run_cmd + ['doctest', 'json5/lib.py']) cmd = self.run_cmd + [ - 'python', - '-m', 'unittest', 'discover', '-p', From 557ddb14d99f8d228fd18a08842076ec4289a62d Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Fri, 9 Oct 2026 09:50:30 -0700 Subject: [PATCH 10/17] add --verbose to ci jobs --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 424d286..dde4b70 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: uv venv --python ${{ matrix.python-version }} .venv source .venv/bin/activate uv pip install dist/*.whl - ./run tests + ./run tests --verbose presubmit: @@ -64,4 +64,4 @@ jobs: with: version: 0.12.24 - name: Run presubmit - run: uv run --python ${{ matrix.python-version }} ./run presubmit + run: uv run --python ${{ matrix.python-version }} ./run presubmit --verbose From 7acafe8469e331693aa443a3224ccbf39cb7a311 Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Fri, 9 Oct 2026 09:52:23 -0700 Subject: [PATCH 11/17] use `uv run ./run build` rather than `uv build` --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dde4b70..68920aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: with: version: 0.12.24 - name: Build sdist and wheel - run: uv build --python 3.13 + run: uv run --python 3.14 ./run build - name: Upload packages uses: actions/upload-artifact@v4 with: From fbd70e673aa5fe297a8f2e4a451a0643668ddea2 Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Fri, 9 Oct 2026 11:50:29 -0700 Subject: [PATCH 12/17] use line buffering on stdout in run --- run | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/run b/run index 65dd7a5..71deb34 100755 --- a/run +++ b/run @@ -55,6 +55,10 @@ class Runner: self.run_cmd = [self.uv_path, 'run', 'python', '-m'] def main(self, argv): + # Change stdout to be unbuffered so that output shows up in + # the right interleaving between this process and any child + # processes. + sys.stdout.reconfigure(line_buffering=True) self.parse_args(argv) self.failfast = getattr(self.args, 'failfast', False) if not self.args.quiet and ( From e3cd9856b6fda0ced2bd1e0b5a1a8133267de595 Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Fri, 9 Oct 2026 12:02:06 -0700 Subject: [PATCH 13/17] add verbose, echoing --- .github/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68920aa..97cb282 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: with: version: 0.12.24 - name: Build sdist and wheel - run: uv run --python 3.14 ./run build + run: uv run --python 3.14 ./run build --verbose - name: Upload packages uses: actions/upload-artifact@v4 with: @@ -45,9 +45,16 @@ jobs: version: 0.12.24 - name: Install wheel and run tests run: | + echo "# uv venv --python ${{ matrix.python-version }} .venv" uv venv --python ${{ matrix.python-version }} .venv + echo "" + echo "source .venv/bin/activate" source .venv/bin/activate + echo "" + echo "uv pip install dist/*.whl" uv pip install dist/*.whl + echo "" + echo "./run tests --verbose" ./run tests --verbose From e983898e5d88911bed874ce723a084d6572d9fb1 Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Fri, 9 Oct 2026 12:23:20 -0700 Subject: [PATCH 14/17] update and pin GH action versions --- .github/workflows/ci.yml | 61 ++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97cb282..ab36387 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,15 +14,16 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Install uv - uses: astral-sh/setup-uv@v7 + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 with: version: 0.12.24 - name: Build sdist and wheel run: uv run --python 3.14 ./run build --verbose - name: Upload packages - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: dist path: dist/ @@ -35,28 +36,30 @@ jobs: python-version: ["3.8", "3.9", "3.10"] fail-fast: false steps: - - uses: actions/checkout@v6 - - uses: actions/download-artifact@v4 - with: - name: dist - path: dist/ - - uses: astral-sh/setup-uv@v7 - with: - version: 0.12.24 - - name: Install wheel and run tests - run: | - echo "# uv venv --python ${{ matrix.python-version }} .venv" - uv venv --python ${{ matrix.python-version }} .venv - echo "" - echo "source .venv/bin/activate" - source .venv/bin/activate - echo "" - echo "uv pip install dist/*.whl" - uv pip install dist/*.whl - echo "" - echo "./run tests --verbose" - ./run tests --verbose - + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Download packages + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: dist + path: dist/ + - name: Install uv + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + with: + version: 0.12.24 + - name: Install package and run tests + run: | + echo "$ uv venv --python ${{ matrix.python-version }} .venv" + uv venv --python ${{ matrix.python-version }} .venv + echo "" + echo "$ source .venv/bin/activate" + source .venv/bin/activate + echo "" + echo "$ uv pip install dist/*.whl" + uv pip install dist/*.whl + echo "" + echo "$ ./run tests --verbose" + ./run tests --verbose presubmit: runs-on: ubuntu-latest @@ -65,10 +68,12 @@ jobs: python-version: ["3.11", "3.12", "3.13", "3.14"] fail-fast: false steps: - - uses: actions/checkout@v6 + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Install uv - uses: astral-sh/setup-uv@v7 + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 with: version: 0.12.24 - name: Run presubmit - run: uv run --python ${{ matrix.python-version }} ./run presubmit --verbose + run: | + uv run --python ${{ matrix.python-version }} ./run presubmit --verbose From f2e6d33b9750bf445986ca8124f2317933e2a2f5 Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Fri, 9 Oct 2026 12:27:40 -0700 Subject: [PATCH 15/17] fix CI warnings and notices --- .github/workflows/ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab36387..0f18202 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ concurrency: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -30,7 +30,7 @@ jobs: test: needs: build - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 strategy: matrix: python-version: ["3.8", "3.9", "3.10"] @@ -47,6 +47,7 @@ jobs: uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 with: version: 0.12.24 + cache-suffix: ${{ matrix.python-version }} - name: Install package and run tests run: | echo "$ uv venv --python ${{ matrix.python-version }} .venv" @@ -62,7 +63,7 @@ jobs: ./run tests --verbose presubmit: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 strategy: matrix: python-version: ["3.11", "3.12", "3.13", "3.14"] @@ -74,6 +75,7 @@ jobs: uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 with: version: 0.12.24 + cache-suffix: ${{ matrix.python-version }} - name: Run presubmit run: | uv run --python ${{ matrix.python-version }} ./run presubmit --verbose From 619d86e6ee71d3cffe82bd89bf17c80b04e5b967 Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Fri, 9 Oct 2026 12:53:56 -0700 Subject: [PATCH 16/17] update README, fix `devenv` --- README.md | 105 ++++++++++++++++++++++++++++++++++++++++++++---------- run | 2 +- 2 files changed, 87 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index cea31a7..f1fc0bc 100644 --- a/README.md +++ b/README.md @@ -64,11 +64,18 @@ be legal object keys in JavaScript, but they aren't in JSON5. ## Contributing -`json5` has no runtime dependencies and it is supported on Python version 3.8 -or later. However, in order to develop and build the package you need a -bunch of extra tools and the latest versions of those tools may require 3.9 -or later. You can install the extra environment on 3.8 (and get older versions -of the tools), but they may not run completely cleanly. +`json5` has no runtime dependencies and it is supported on Python version +**3.8** or later. + +However, in order to develop, test, build and publish the package you need a +bunch of extra tools that are only supported on **3.11** or newer; on older +versions, you can run the test, but not do anything else. + +When changing the code, do not add anything that only runs on 3.9 or later +versions, and do not rely on `from __future__ import annotations`. + +Use a 79-character line and prefer single quotes to double; otherwise follow +PEP-8 and the normal `ruff format` coding style. #### On Mac @@ -97,26 +104,86 @@ $ ./run devenv (This calls `uv sync --extra dev`.) -### Running the tests +### Run tests and other checks ``` -$ ./run tests +$ ./run presubmit ``` +`//run` supports a number of other commands: + +* `regen` will regenerate the parser when the grammar is updated; in order + to run this you need `glop` to be available as described above. + +* `format` will format all the code using `ruff format` for the Python code + and `pyproject-fmt` for the `pyproject.toml` file; `format --check` will + report whether the code is formatted properly without actually changing + anything. It checks for the coding style described above. + +* `checks` checks the code for problems without actually executing the code. + It runs: + * `ruff check` + * `pylint` + * `mypy` + +* `tests` runs all of the tests. Write tests using either `doctest` or + `unittest`. Aim for 100% line coverage in tests (see next bullet). + +* `coverage` runs all of the tests using the `coverage` tool in order to + collect code coverage. You can pass `-b/--branch` to collect branch + coverage. You should target 100% line coverage on any changes, as there + shouldn't be a reason you can't do this, and actually ensuring that you + execute every line can catch problems in Python that might otherwise be + caught earlier in statically-typed languages (though the `checks` go + a long way to accomplishing the same thing). + +* `build` builds the package to get it ready to publish + +* `publish` tries to publish the package. You must specify `--dev` or `--prod` + to indicate which PyPI repository you want to publish to; explicitly having + to mention one or the other helps ensure that you don't try to publish + something by accident. You can run `publish --check` in order to ensure + that the package is built correctly without actually trying to publish it. + You can only actually publish the package if you have permission to do so, + of course. + +`presubmit` just runs all of the above commands at once (though not `regen` +at the moment, because you might not have `glop` installed; this'll change +when `glop` is properly packaged and installed in the venv. + +Other `run` commands: + +* `devenv` creates a virtual environ using `uv` and echoes the command needed +to activate it. + +* `clean` will remove any unversioned files from the repo. + +* `help` prints usage. + ### Updating the packages -``` -# Update the version in json5/version.py to $VERSION, which should be of -# the form X.Y.Z where X, Y, and Z are numbers. -$ ./run regen -$ ./run presubmit -$ git commit -a -m "Bump the version to $VERSION" -$ git tag "v$VERSION" -$ ./run build -$ ./run publish --prod -$ git push origin -$ git push --tags origin -``` +1. Update the version in `json5/version.py` to $VERSION, which should be + of the form X.Y.Z, where X, Y, and Z are numbers. Use + [semantic versioning](https://semver.org/) when increasing the numbers: + * X increases only when making backwards-incompatible or other very + significant changes. Try very hard to avoid this. + * Y increases when adding functionality in a backwards-compatible way. + * Z increases when you are fixing bugs in a backwards-compatible way. + + In between releases, the version *may* be set to `X.Y.Z.dev0' to indicate + that this is not an officially released version. + +2. `./run presubmit` once more and make sure everything passes. + +3. `git commit -a -m "Bump the version to $VERSION"` + +4. `git tag "v$VERSION"` + +5. `./run publish --prod` (which will build the package if need be first) + +6. `git push origin` + +7. `git push --tags origin` (Assuming you have upload privileges to PyPI and the GitHub repo, of course.) diff --git a/run b/run index 71deb34..6ecf566 100755 --- a/run +++ b/run @@ -342,7 +342,7 @@ class Runner: print('You need to have `uv` installed to set up a dev env.') return 1 - cmd = [self.uv_path, 'sync', '--extra', 'dev'] + cmd = [self.uv_path, 'sync'] if self.args.quiet: cmd.append('--quiet') From a4704467fba771baa823ade2752ce61306da6553 Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Fri, 9 Oct 2026 12:58:52 -0700 Subject: [PATCH 17/17] more README tweaks --- README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f1fc0bc..6afcaa6 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ be legal object keys in JavaScript, but they aren't in JSON5. keyword *is* supported, though, and might be able to serve as a workaround. -## Contributing +## Contributing: `json5` has no runtime dependencies and it is supported on Python version **3.8** or later. @@ -77,7 +77,7 @@ versions, and do not rely on `from __future__ import annotations`. Use a 79-character line and prefer single quotes to double; otherwise follow PEP-8 and the normal `ruff format` coding style. -#### On Mac +### On Mac The easiest thing to do is to install [`uv`](https://docs.astral.sh/uv) and use `uv` and the `//run` script to develop things. See `./run --help` for @@ -92,18 +92,21 @@ $ cd pyjson5 $ source $(./run devenv) # To activate a venv w/ all the needed dev tools. ``` -#### On other platforms +### On other platforms Install `uv` via whatever mechanism is appropriate. -### Create the venv +### Creating a venv + +You do not have to create a venv to do anything, if you use the `run` +script, but if you want to invoke tools like `ruff` directly, you +can do so as follows: ``` -$ ./run devenv +$ ./run devenv # which really just calls `uv sync`. +$ source .venv/bin/activate ``` -(This calls `uv sync --extra dev`.) - ### Run tests and other checks ``` @@ -160,7 +163,7 @@ to activate it. * `help` prints usage. -### Updating the packages +## Releasing a new version: 1. Update the version in `json5/version.py` to $VERSION, which should be of the form X.Y.Z, where X, Y, and Z are numbers. Use @@ -187,7 +190,7 @@ to activate it. (Assuming you have upload privileges to PyPI and the GitHub repo, of course.) -## Version History / Release Notes +## Version History / Release Notes: * v0.17.0dev0 (2026-10-08) * Rework the project dependencies. As before, the module still has