From 2619e52ad1644853aa4b473dbab40f2365b28cc7 Mon Sep 17 00:00:00 2001 From: Thor Whalen <1906276+thorwhalen@users.noreply.github.com> Date: Sun, 22 Nov 2026 22:51:06 +0100 Subject: [PATCH] ci: setup.cfg -> pyproject, wads reusable-workflow stub, drop stale docsrc [skip publish] --- .github/workflows/ci.yml | 154 ++++++++++++---------------------- docsrc/.gitignore | 1 - docsrc/Makefile | 33 -------- docsrc/conf.py | 82 ------------------- docsrc/index.rst | 18 ---- docsrc/make.bat | 35 -------- pyproject.toml | 173 +++++++++++++++++++++++++++++++++++++++ setup.cfg | 31 ------- setup.py | 3 - 9 files changed, 226 insertions(+), 304 deletions(-) delete mode 100644 docsrc/.gitignore delete mode 100644 docsrc/Makefile delete mode 100644 docsrc/conf.py delete mode 100644 docsrc/index.rst delete mode 100644 docsrc/make.bat create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de4e699..8552469 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,104 +1,56 @@ +# wads CI — calls the reusable workflow hosted in i2mint/wads. +# +# All configuration comes from this repo's pyproject.toml [tool.wads.ci.*]. +# To customize the workflow itself (rare), replace this file with the +# full inline template `wads/data/github_ci_uv.yml` from i2mint/wads. +# +# Pinning: `@master` floats with wads. If you need a stable job graph for +# a release-sensitive repo, change `@master` to a wads tag (e.g. `@0.2.15`; +# tags have no `v` prefix). That freezes this workflow, not the actions it +# calls, which still run at `@master`. +# CI failure does not block a published release — it blocks the publish +# step itself — so floating master is generally safe. +# +# Permissions: GitHub validates that the caller grants AT LEAST the +# permissions any job in the called workflow requests — at workflow-parse +# time, not at run-time, even if the job would be skipped via `if:`. +# The reusable workflow needs: +# contents: write for the publish job's version-bump push-back +# and for the github-pages job's gh-pages branch push +# pages: write for the github-pages job's REST API Pages config +# Both default to `write` on org-account GITHUB_TOKEN and need to be +# granted explicitly on personal-account callers (where the default is +# read-only). No `id-token: write` needed — the publish-github-pages +# action uses peaceiris/actions-gh-pages (branch-based) + REST API, +# not the OIDC `actions/deploy-pages` flow. name: Continuous Integration on: [push, pull_request] -env: - PROJECT_NAME: ju - jobs: - validation: - name: Validation - if: "!contains(github.event.head_commit.message, '[skip ci]')" - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10", "3.12"] - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - # Necessary for 3.12, since setuptools was removed there - - name: Install setuptools - run: python -m pip install setuptools - - - name: Install Dependencies - uses: i2mint/isee/actions/install-packages@master - with: - dependency-files: setup.cfg - # ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} # Uncomment this if you need to install private dependencies from source - - # - name: Format Source Code - # uses: i2mint/isee/actions/format-source-code@master - - # TODO: The ignore stopped working. - # - name: Pylint Validation - # uses: i2mint/isee/actions/pylint-validation@master - # with: - # root-dir: ${{ env.PROJECT_NAME }} - # enable: missing-module-docstring - # ignore: tests,examples,scrap - - - name: Pytest Validation - uses: i2mint/isee/actions/pytest-validation@master - with: - root-dir: ${{ env.PROJECT_NAME }} - - publish: - name: Publish - if: "!contains(github.event.head_commit.message, '[skip ci]') && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')" - needs: validation - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.12"] - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Format Source Code - uses: i2mint/isee/actions/format-source-code@master - - - name: Update Version Number - uses: i2mint/isee/actions/bump-version-number@master - - - name: Package - uses: i2mint/isee/actions/package@master - # Uncomment this if you need to install private dependencies from source - # with: - # ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - - name: Publish - uses: i2mint/isee/actions/publish@master - with: - pypi-username: ${{ secrets.PYPI_USERNAME }} - pypi-password: ${{ secrets.PYPI_PASSWORD }} - - - name: Check In - uses: i2mint/isee/actions/check-in@master - with: - commit-message: "**CI** Formatted code + Updated version number and documentation. [skip ci]" - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - - name: Tag Repository With New Version Number - uses: i2mint/isee/actions/tag-repository@master - with: - tag: $VERSION - - github-pages: - name: Publish GitHub Pages - if: "!contains(github.event.head_commit.message, '[skip ci]') && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)" - needs: publish - runs-on: ubuntu-latest - steps: - - uses: i2mint/epythet/actions/publish-github-pages@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} + ci: + uses: i2mint/wads/.github/workflows/uv-ci.yml@master + permissions: + contents: write + pages: write + # Transport (named): passes ONLY the secrets listed below — PYPI_PASSWORD + # (for the publish job) plus the secret behind each env var declared in + # [tool.wads.ci.env]. `wads-secrets add VAR_NAME` declares a var and adds + # its secret here. Every listed name must be declared by the reusable + # workflow (the superset in wads/ci_secrets.py) or GitHub rejects this + # workflow at parse time; a missing name is a one-line addition there. + # (Cross-owner `secrets: inherit` does not propagate secrets, so it + # cannot replace this list.) + # + # Opt-in alternative: `wads-migrate ci-to-stub --transport json` passes + # this repo's WHOLE secrets context — every secret it can read, including + # org-level ones — as one WADS_CI_SECRETS_JSON secret. GitHub's + # malicious-workflow scanner may hold runs that do that: `action_required`, + # zero jobs, no log (i2mint/wads#74, #101). + # + # *Which* of these become job env vars — and which are required — is + # driven entirely by [tool.wads.ci.env] in pyproject.toml; nothing is + # exported unless declared there. Non-sensitive values don't need a secret: + # use [tool.wads.ci.env].defaults (committed literals) or a repository + # *variable* (`gh variable set NAME`) — declared names fall back to + # repo variables automatically. + secrets: + PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} diff --git a/docsrc/.gitignore b/docsrc/.gitignore deleted file mode 100644 index 69fa449..0000000 --- a/docsrc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_build/ diff --git a/docsrc/Makefile b/docsrc/Makefile deleted file mode 100644 index 5f01b86..0000000 --- a/docsrc/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = . -BUILDDIR = _build -GITHUBPAGESDIR = ../docs -GITLABPAGESDIR = ../public - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -github: - @make html - @cp -a "$(BUILDDIR)"/html/. $(GITHUBPAGESDIR) - -gitlab: - @make html - @cp -a "$(BUILDDIR)"/html/. $(GITLABPAGESDIR) - -clean: - rm -rfv $(BUILDDIR) $(GITHUBPAGESDIR) $(GITLABPAGESDIR) - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docsrc/conf.py b/docsrc/conf.py deleted file mode 100644 index f85e344..0000000 --- a/docsrc/conf.py +++ /dev/null @@ -1,82 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. -# For a full list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. - -import os -import sys - -sys.path.insert(0, os.path.abspath("..")) - -# -- Project information ----------------------------------------------------- -from epythet.config_parser import parse_config -from pathlib import Path - -project, copyright, author, release, display_name = parse_config( - Path(__file__).absolute().parent.parent / "setup.cfg" -) - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - "sphinx_toggleprompt", - "sphinx_copybutton", - "sphinx.ext.autodoc", # Include documentation from docstrings - "sphinx.ext.doctest", # Test snippets in the documentation - "sphinx.ext.githubpages", # This extension creates .nojekyll file - "sphinx.ext.graphviz", # Add Graphviz graphs - "sphinx.ext.napoleon", # Support for NumPy and Google style docstrings - "sphinx.ext.todo", # Support for todo items - "sphinx.ext.viewcode", # Add links to highlighted source code - "myst_parser", # Parse .md files -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = "sphinx_rtd_theme" - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] - - -# -- Options for Markdown support ------------------------------------------- -# TODO: fix md support so that it doesn't interfere with rst docs -# import commonmark -# -# -# def docstring(app, what, name, obj, options, lines): -# md = '\n'.join(lines) -# ast = commonmark.Parser().parse(md) -# rst = commonmark.ReStructuredTextRenderer().render(ast) -# lines.clear() -# lines += rst.splitlines() -# -# -# def setup(app): -# app.connect('autodoc-process-docstring', docstring) - - -toggleprompt_offset_right = 30 diff --git a/docsrc/index.rst b/docsrc/index.rst deleted file mode 100644 index c5e46bf..0000000 --- a/docsrc/index.rst +++ /dev/null @@ -1,18 +0,0 @@ -Welcome to ju's documentation! -============================== - - -.. include:: ./table_of_contents.rst - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - - -Release: |release| - -Last change: |today| diff --git a/docsrc/make.bat b/docsrc/make.bat deleted file mode 100644 index 2119f51..0000000 --- a/docsrc/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=. -set BUILDDIR=_build - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..00226be --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,173 @@ +[build-system] +requires = [ + "hatchling", +] +build-backend = "hatchling.build" + +[project] +name = "ju" +version = "0.1.44" +description = "JSON schema Utils" +readme = "README.md" +requires-python = ">=3.10" +license = "Apache-2.0" +keywords = [] +authors = [] +dependencies = [ + "importlib_resources", + "i2", + "dol", + "pydantic", + "glom", + "datamodel-code-generator", + "traitlets", + "ipywidgets", + "requests", +] + +[project.urls] +Homepage = "https://github.com/i2mint/ju" + +[project.optional-dependencies] +test = [ + "pytest", +] + +[tool.hatch.build] +skip-excluded-dirs = true + +[tool.hatch.build.targets.sdist] +exclude = [ + ".claude", + ".github", + "scrap", +] + +[tool.ruff] +line-length = 88 +target-version = "py310" +exclude = [ + "**/*.ipynb", + "**/*.md", + ".git", + ".venv", + "build", + "dist", + "tests", + "examples", + "scrap", +] + +[tool.ruff.lint] +select = [ + "D100", +] +ignore = [ + "D203", + "E501", + "B905", +] + +[tool.ruff.lint.pydocstyle] +convention = "google" + +[tool.ruff.lint.per-file-ignores] +"**/tests/*" = [ + "D", +] +"**/examples/*" = [ + "D", +] +"**/scrap/*" = [ + "D", +] + +[tool.pytest.ini_options] +minversion = "6.0" +testpaths = [ + "ju", +] +doctest_optionflags = [ + "NORMALIZE_WHITESPACE", + "ELLIPSIS", +] + +[tool.wads.ci] +project_name = "" + +[tool.wads.ci.install] +extras = "dev" + +[tool.wads.ci.commands] +pre_test = [] +test = [] +post_test = [] +lint = [] +format = [] + +[tool.wads.ci.env] +required_envvars = [] +test_envvars = [] +extra_envvars = [] + +[tool.wads.ci.env.defaults] + +[tool.wads.ci.quality.ruff] +enabled = true + +[tool.wads.ci.quality.black] +enabled = false + +[tool.wads.ci.quality.mypy] +enabled = false + +[tool.wads.ci.testing] +enabled = true +python_versions = [ + "3.10", + "3.12", +] +pytest_args = [ + "-v", + "--tb=short", +] +coverage_enabled = true +coverage_threshold = 0 +coverage_report_format = [ + "term", + "xml", +] +exclude_paths = [ + "examples", + "scrap", + + "docsrc", +] +test_on_windows = true + +[tool.wads.ci.metrics] +enabled = true +config_path = ".github/umpyre-config.yml" +storage_branch = "code-metrics" +python_version = "3.10" +force_run = false + +[tool.wads.ci.build] +sdist = true +wheel = true + +[tool.wads.ci.publish] +enabled = true +skip_ci_marker = "[skip ci]" +publish_marker = "[publish]" +skip_publish_marker = "[skip publish]" + +[tool.wads.ci.docs] +enabled = true +skip_marker = "[skip github-pages]" +builder = "epythet" +ignore_paths = [ + "tests/", + "scrap/", + "examples/", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 84d1e9f..0000000 --- a/setup.cfg +++ /dev/null @@ -1,31 +0,0 @@ -[metadata] -root_url = https://github.com/i2mint/ -license = apache-2.0 -version = 0.1.44 -description = JSON schema Utils -description_file = README.md -long_description = file:README.md -long_description_content_type = text/markdown -keywords = -name = ju -display_name = ju - -[options] -packages = find: -include_package_data = True -zip_safe = False -install_requires = - importlib_resources - i2 - dol - pydantic - glom - datamodel-code-generator - traitlets - ipywidgets - requests - -[options.extras_require] -test = - pytest - diff --git a/setup.py b/setup.py deleted file mode 100644 index 201cd4c..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() # Note: Everything should be in the local setup.cfg