Skip to content

Commit

Permalink
Update project from template
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeNaccarato committed Sep 5, 2023
1 parent 2bbd566 commit d9c572e
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ 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"
shell: "pwsh"
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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/minimum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
21 changes: 12 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,21 @@ repos:
pyproject.toml
src/.*
|tests/.*
|.tools/(
pyproject.toml
|requirements/.*
)
|.tools/requirements/.*
)$
- id: "fawltydeps"
name: "fawltydeps"
verbose: true
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.
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions .tools/requirements/requirements_both.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .tools/scripts/Copy-Template.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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' })
}
4 changes: 2 additions & 2 deletions .tools/scripts/Invoke-Pyright.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 $_ }
Expand All @@ -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
16 changes: 11 additions & 5 deletions .tools/scripts/core_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]:
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
42 changes: 21 additions & 21 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -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"],
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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": [
Expand All @@ -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": [
Expand All @@ -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": [
Expand Down

0 comments on commit d9c572e

Please sign in to comment.