From d9c572eb5bdc65edbb3071d910c735fd620b01fe Mon Sep 17 00:00:00 2001 From: blakeNaccarato Date: Tue, 5 Sep 2023 11:43:34 -0700 Subject: [PATCH] Update project from template --- .copier-answers.yml | 2 +- .github/workflows/codeql.yml | 8 ++--- .github/workflows/main.yml | 8 ++--- .github/workflows/minimum.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/sphinx.yml | 2 +- .pre-commit-config.yaml | 21 +++++++----- .tools/requirements/requirements_both.txt | 4 +-- .tools/scripts/Copy-Template.ps1 | 6 ++-- .tools/scripts/Invoke-Pyright.ps1 | 4 +-- .tools/scripts/core_update.py | 16 ++++++--- pyproject.toml | 4 ++- renovate.json | 42 +++++++++++------------ 13 files changed, 66 insertions(+), 55 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index df9b0829..b466a743 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: 120b6fd +_commit: a1e79f0 _src_path: gh:blakeNaccarato/copier-python actions_runner: ubuntu-latest active: true diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 20b5cdcc..005181a5 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -16,14 +16,14 @@ jobs: steps: - name: "Checkout repository" - uses: "actions/checkout@v3.5.3" + uses: "actions/checkout@v4.0.0" - name: "Initialize CodeQL" - uses: "github/codeql-action/init@v2.21.4" + uses: "github/codeql-action/init@v2.21.5" with: languages: "${{ matrix.language }}" - name: "Autobuild" - uses: "github/codeql-action/autobuild@v2.21.4" + uses: "github/codeql-action/autobuild@v2.21.5" - name: "Perform CodeQL Analysis" - uses: "github/codeql-action/analyze@v2.21.4" + uses: "github/codeql-action/analyze@v2.21.5" with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 413ca4c5..6f51f0f7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ jobs: pyright: runs-on: "ubuntu-latest" steps: - - uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.1" + - uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.2" with: python-version: "3.11" - run: ".tools/scripts/Invoke-Pyright.ps1" @@ -17,14 +17,14 @@ jobs: ruff: runs-on: "ubuntu-latest" steps: - - uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.1" + - uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.2" with: python-version: "3.11" - run: "ruff --no-fix --format github ." pytest: runs-on: "ubuntu-latest" steps: - - uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.1" + - uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.2" with: python-version: "3.11" - name: Install PySide6 system dependencies @@ -38,7 +38,7 @@ jobs: needs: ["pyright", "ruff", "pytest"] runs-on: "ubuntu-latest" steps: - - uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.1" + - uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.2" with: python-version: "3.11" install-project: false diff --git a/.github/workflows/minimum.yml b/.github/workflows/minimum.yml index 0cb56b50..cbafaca0 100644 --- a/.github/workflows/minimum.yml +++ b/.github/workflows/minimum.yml @@ -12,7 +12,7 @@ jobs: pytest: runs-on: "ubuntu-latest" steps: - - uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.1" + - uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.2" with: python-version: "3.11" latest-pins: false diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5d4a39b1..8f023c2c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,7 @@ jobs: publish: runs-on: "ubuntu-latest" steps: - - uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.1" + - uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.2" with: python-version: "3.11" install-project: false diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index ef48ba58..61845aa6 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -19,7 +19,7 @@ jobs: build: runs-on: "ubuntu-latest" steps: - - uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.1" + - uses: "blakeNaccarato/copier-python-workflow-setup@v0.2.2" with: python-version: "3.11" - run: "python -m sphinx -T -E docs _site" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7cb8f00f..de574b51 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -48,10 +48,7 @@ repos: pyproject.toml src/.* |tests/.* - |.tools/( - pyproject.toml - |requirements/.* - ) + |.tools/requirements/.* )$ - id: "fawltydeps" name: "fawltydeps" @@ -59,7 +56,13 @@ repos: pass_filenames: false language: "system" entry: "pwsh -Command fawltydeps" - files: "^.*$" + files: | + (?x)^( + src/.* + |pyproject.toml + |requirements.txt + |.tools/requirements/.* + )$ # * ------------------------------------------------------------------------------ * # # * Changes below should persist in significant template updates. @@ -86,25 +89,25 @@ repos: - id: "blacken-docs" additional_dependencies: ["black==23.7.0"] - repo: "https://github.com/charliermarsh/ruff-pre-commit" - rev: "v0.0.284" + rev: "v0.0.287" hooks: - id: "ruff" - repo: "https://github.com/DavidAnson/markdownlint-cli2" - rev: "v0.8.1" + rev: "v0.9.2" hooks: - id: "markdownlint-cli2-fix" - repo: "https://github.com/nbQA-dev/nbQA" rev: "1.7.0" hooks: - id: "nbqa-ruff" - additional_dependencies: ["ruff==0.0.284"] + additional_dependencies: ["ruff==0.0.287"] - repo: "https://github.com/psf/black" rev: "23.7.0" hooks: - id: "black" - id: "black-jupyter" - repo: "https://github.com/srstevenson/nb-clean" - rev: "2.4.0" + rev: "3.0.0" hooks: - id: "nb-clean" args: diff --git a/.tools/requirements/requirements_both.txt b/.tools/requirements/requirements_both.txt index 976266c1..4552c37f 100644 --- a/.tools/requirements/requirements_both.txt +++ b/.tools/requirements/requirements_both.txt @@ -10,9 +10,9 @@ numexpr==2.8.4 # * Changes below may be lost in significant template updates. # Type checking -pyright==1.1.318 +pyright==1.1.323 # Pre-commit common requirements -ruff==0.0.284 +ruff==0.0.287 # Testing pytest==7.4.0 # Testing plugins diff --git a/.tools/scripts/Copy-Template.ps1 b/.tools/scripts/Copy-Template.ps1 index 8b6a6212..3d25eb61 100644 --- a/.tools/scripts/Copy-Template.ps1 +++ b/.tools/scripts/Copy-Template.ps1 @@ -17,9 +17,9 @@ if ( $Recopy ) { copier recopy --overwrite $(if ($Defaults) { '--defaults' }) } else { - git submodule update --init --remote --merge template + git submodule update --init --remote --merge submodules/template git add --all git commit $(if ($NoVerify) { '--no-verify' }) -m "Update template digest to $(git rev-parse --short HEAD:template)" - git submodule deinit --force template - copier update --vcs-ref $(git rev-parse HEAD:template) $(if ($Defaults) { '--defaults' }) + git submodule deinit --force submodules/template + copier update --vcs-ref $(git rev-parse HEAD:submodules/template) $(if ($Defaults) { '--defaults' }) } diff --git a/.tools/scripts/Invoke-Pyright.ps1 b/.tools/scripts/Invoke-Pyright.ps1 index a711f380..dcf8fce2 100644 --- a/.tools/scripts/Invoke-Pyright.ps1 +++ b/.tools/scripts/Invoke-Pyright.ps1 @@ -2,7 +2,7 @@ Ensure type stubs are synchronized and run pyright. #> -git submodule update --init --merge typings +git submodule update --init --merge submodules/typings Get-Content .tools/requirements/requirements_both.txt | Select-String pyright | ForEach-Object { pip install $_ } @@ -13,4 +13,4 @@ $NbqaPyrightExitCode = $LastExitCode if (($PyrightExitCode -ne 0) -or ($NbqaPyrightExitCode -ne 0)) { Exit $PyrightExitCode -or $NbqaPyrightExitCode } -git submodule deinit typings +git submodule deinit submodules/typings diff --git a/.tools/scripts/core_update.py b/.tools/scripts/core_update.py index be7c1398..3eb7fb70 100644 --- a/.tools/scripts/core_update.py +++ b/.tools/scripts/core_update.py @@ -28,16 +28,22 @@ def main(): class Submodule: """Represents a git submodule.""" - name: str - """The submodule name.""" + _path: str | bytes + """Submodule path as reported by the submodule source.""" commit: str - """The commit hash currently tracked by the submodule.""" + """Commit hash currently tracked by the submodule.""" + path: Path = Path() + """Submodule path.""" + name: str = "" + """Submodule name.""" def __post_init__(self): """Handle byte strings reported by some submodule sources, like dulwich.""" # dulwich.porcelain.submodule_list returns bytes - if isinstance(self.name, bytes): - self.name = self.name.decode("utf-8") + self.path = Path( + self._path.decode("utf-8") if isinstance(self._path, bytes) else self._path + ) + self.name = self.path.name def get_submodules() -> tuple[Submodule, Submodule, list[Submodule]]: diff --git a/pyproject.toml b/pyproject.toml index 6a07c5ad..1d110d01 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -98,6 +98,8 @@ reportPrivateUsage = "none" # Paths include = ["src", "tests", "docs"] +# Stubs +stubPath = "submodules/typings" # Type inference helps with untyped upstream but can be unpredictable useLibraryCodeForTypes = true # Sets most checks to "error". See overrides below @@ -141,7 +143,7 @@ fix = true select = ["ALL"] src = ["src", "tests"] target-version = "py311" -extend-exclude = ["template", "typings", ".github"] +extend-exclude = ["template", "submodules", ".github"] ignore = [ # * ---------------------------------------------------------------------------- * # # * Changes below should persist in significant template updates. diff --git a/renovate.json b/renovate.json index b2a76a7b..0373c09b 100644 --- a/renovate.json +++ b/renovate.json @@ -1,6 +1,6 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "description": "Establish base config, schedule, and manager defaults.", + "description": "Establish base config, schedule, and manager defaults", "extends": ["config:base", ":enablePreCommit", ":disableRateLimiting"], "dependencyDashboardApproval": false, "schedule": ["on the 16th day of the month"], @@ -14,27 +14,21 @@ "pre-commit" ], "pip_requirements": { - "description": "Additionally monitor these files.", + "description": "Additionally monitor these files", "fileMatch": ["^\\.tools/requirements/*"] }, "packageRules": [ { - "description": "Don't bump pydantic until we're ready for migration.", - "matchManagers": ["pip_requirements"], - "matchPaths": [".tools/requirements/*"], - "ignoreDeps": ["pydantic"] - }, - { - "description": "Core dependencies, unmmatched by the rules below.", + "description": "Core dependencies, unmmatched by the rules below", "groupName": "core", "matchPackagePatterns": ["*"], "matchUpdateTypes": ["minor", "patch"] }, { - "description": "Type checking dependencies.", + "description": "Type checking dependencies", "groupName": "type checking", "matchManagers": ["pip_requirements", "git-submodules"], - "matchPackageNames": ["pyright", "typings"] + "matchPackageNames": ["pyright", "submodules/typings"] }, { "groupName": "numpy", @@ -49,17 +43,23 @@ "matchPackageNames": ["numexpr"] }, { - "description": "Ignore changerelease.yml workflow deps managed by the template.", + "description": "Don't bump pydantic until we're ready for migration.", + "matchManagers": ["pip_requirements"], + "matchPaths": [".tools/requirements/*"], + "ignoreDeps": ["pydantic"] + }, + { + "description": "Ignore changerelease.yml workflow deps managed by the template", "matchManagers": ["github-actions"], "ignoreDeps": ["dropseed/changerelease"] }, { - "description": "Ignore codeql.yml workflow deps managed by the template.", + "description": "Ignore codeql.yml workflow deps managed by the template", "matchManagers": ["github-actions"], "ignoreDeps": ["actions/checkout", "github/codeql-action"] }, { - "description": "Ignore main.yml workflow deps managed by the template.", + "description": "Ignore main.yml workflow deps managed by the template", "matchManagers": ["github-actions"], "ignoreDeps": [ "blakeNaccarato/copier-python-workflow-setup", @@ -68,12 +68,12 @@ ] }, { - "description": "Ignore publish.yml workflow deps managed by the template.", + "description": "Ignore publish.yml workflow deps managed by the template", "matchManagers": ["github-actions"], "ignoreDeps": ["actions/upload-pages-artifact", "actions/deploy-pages"] }, { - "description": "Ignore sphinx.yml workflow deps managed by the template.", + "description": "Ignore sphinx.yml workflow deps managed by the template", "matchManagers": ["github-actions"], "ignoreDeps": [ "dropseed/changerelease", @@ -87,7 +87,7 @@ ] }, { - "description": "Ignore pre-commit dependencies managed by the template.", + "description": "Ignore pre-commit dependencies managed by the template", "matchManagers": ["pre-commit"], "ignoreDeps": [ "pre-commit/pre-commit-hooks", @@ -100,7 +100,7 @@ ] }, { - "description": "Ignore requirements_both.txt deps managed by this template.", + "description": "Ignore requirements_both.txt deps managed by this template", "matchManagers": ["pip_requirements"], "matchPaths": [".tools/requirements/*"], "ignoreDeps": [ @@ -113,13 +113,13 @@ ] }, { - "description": "Ignore requirements_core.txt deps managed by this template.", + "description": "Ignore requirements_core.txt deps managed by this template", "matchManagers": ["pip_requirements"], "matchPaths": [".tools/requirements/*"], "ignoreDeps": ["copier", "dulwich", "flit_core", "pip", "wheel"] }, { - "description": "Ignore requirements_dev.txt deps managed by this template.", + "description": "Ignore requirements_dev.txt deps managed by this template", "matchManagers": ["pip_requirements"], "matchPaths": [".tools/requirements/*"], "ignoreDeps": [ @@ -135,7 +135,7 @@ ] }, { - "description": "Ignore requirements_docs.txt deps managed by this template.", + "description": "Ignore requirements_docs.txt deps managed by this template", "matchManagers": ["pip_requirements"], "matchPaths": [".tools/requirements/*"], "ignoreDeps": [