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 Oct 27, 2023
1 parent 99a44ac commit 6b45833
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 116 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: 0b754aa
_commit: f2a149b
_src_path: gh:blakeNaccarato/copier-python
actions_runner: ubuntu-latest
active: true
Expand Down
20 changes: 11 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ repos:
hooks:
- id: "end-of-file-fixer"
- id: "trailing-whitespace"
- repo: "https://github.com/charliermarsh/ruff-pre-commit"
rev: "v0.1.3"
hooks:
- id: "ruff"
- id: "ruff-format"
- repo: "https://github.com/DavidAnson/markdownlint-cli2"
rev: "v0.10.0"
hooks:
- id: "markdownlint-cli2-fix"
- repo: "https://github.com/srstevenson/nb-clean"
rev: "3.1.0"
hooks:
Expand All @@ -111,3 +102,14 @@ repos:
|docs/.*
|tests/.*
)$
- repo: "https://github.com/DavidAnson/markdownlint-cli2"
rev: "v0.10.0"
hooks:
- id: "markdownlint-cli2-fix"
- repo: "https://github.com/charliermarsh/ruff-pre-commit"
rev: "v0.1.3"
hooks:
- id: "ruff"
types_or: ["python", "pyi", "jupyter"]
- id: "ruff-format"
types_or: ["python", "pyi", "jupyter"]
1 change: 0 additions & 1 deletion .tools/requirements/requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ debugpy==1.8.0
# For `pythonstartup.py`
rich==13.6.0
# Format
black[jupyter]==23.7.0
sourcery-cli==1.11.0
# Profiling
snakeviz==2.2.0
Expand Down
4 changes: 0 additions & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,20 @@

"aaron-bond.better-comments",
"bierner.markdown-preview-github-styles",
"blackmist.linkcheckmd",
"charliermarsh.ruff",
"davidanson.vscode-markdownlint",
"donjayamanne.githistory",
"dotjoshjohnson.xml",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"executablebookproject.myst-highlight",
"github.codespaces",
"github.vscode-github-actions",
"github.vscode-pull-request-github",
"redhat.vscode-yaml",
"reverbc.vscode-pytest",
"ryanluker.vscode-coverage-gutters",
"sourcery.sourcery",
"stkb.rewrap",
"tamasfe.even-better-toml",
"tyriar.shell-launcher",
"yzhang.markdown-all-in-one"
]
}
91 changes: 27 additions & 64 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,53 @@

//! Pylance
"python.languageServer": "Pylance",
"python.analysis.diagnosticMode": "openFilesOnly",
"python.analysis.indexing": true,
//? These are safer defaults which are overridden in `pyrightconfig.json`.
"python.analysis.typeCheckingMode": "off",
"python.analysis.useLibraryCodeForTypes": false,
"python.analysis.persistAllIndices": true,
//? See "include" and "extrapaths" in pyrightconfig.json
"python.analysis.autoSearchPaths": false,
//? Helpers
"python.analysis.autoFormatStrings": true,
"python.analysis.completeFunctionParens": true,
"python.analysis.gotoDefinitionInStringLiteral": true,
//? Related autoformatting and format on save settings
"editor.formatOnType": true,
"editor.formatOnSave": true,
"notebook.formatOnCellExecution": true,
"notebook.formatOnSave.enabled": true,
//? Related autoformatting of whitespace conventions
//? Note that notebook cells gain new lines and it can't be stopped for now.
//? https://github.com/microsoft/vscode/issues/195223
//? https://github.com/microsoft/vscode/issues/195011
"files.eol": "\n",
"files.refactoring.autoSave": true,
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
//? Refactoring
//? https://code.visualstudio.com/updates/v1_83#_code-actions-on-save-and-auto-save
"python.analysis.fixAll": [
"source.convertImportFormat",
"source.unusedImports"
],
"editor.codeActionsOnSave": {
"source.organizeImports.ruff": "always",
"source.organizeImports": "always",
"source.fixAll": "always"
},
"notebook.codeActionsOnSave": {
"source.organizeImports.isort": "explicit",
"source.organizeImports": "explicit",
"source.fixAll": "explicit"
},
"python.analysis.completeFunctionParens": false, // Buggy
//? Auto imports
"python.analysis.importFormat": "absolute",
"python.analysis.autoImportCompletions": true,
"python.analysis.extraCommitChars": true,
"python.analysis.addImport.exactMatchOnly": false,
//? Inlay hints
"editor.inlayHints.enabled": "offUnlessPressed",
"python.analysis.inlayHints.callArgumentNames": "all",
"python.analysis.inlayHints.functionReturnTypes": true,
"python.analysis.inlayHints.variableTypes": true,
"python.analysis.inlayHints.pytestParameters": true,
//? See "include" and "extrapaths" in pyrightconfig.json
"python.analysis.autoSearchPaths": false,

//! Lint, test, format
//* pytest
Expand All @@ -55,35 +71,12 @@
//! GitHub Actions
"github-actions.workflows.pinned.workflows": [".github/workflows/main.yml"],

//! Shell Launcher
"shellLauncher.shells.windows": [
{
//* Launches IPython in the virtual environment. Lets you try things out in without having to fire up an entire Jupyter notebook.
//*
//* Use alongside the following keybind in your "keybindings.json".
//*
//? {
//? "key": "ctrl+alt+1",
//? "command": "shellLauncher.launch"
//? },
"label": "IPython (.venv)",
"shell": "pwsh.exe",
"args": ["-NoExit", "-Command", "python", "-m", "IPython"]
}
],

//! Files
//* Experimental file nesting
"explorer.sortOrder": "foldersNestsFiles",
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"*.ts": "${capture}.js",
"*.js": "${capture}.js.map, ${capture}.min.js, ${capture}.d.ts",
"*.jsx": "${capture}.js",
"*.tsx": "${capture}.ts",
"tsconfig.json": "tsconfig.*.json",
"package.json": "package-lock.json, yarn.lock, pnpm-lock.yaml",
"*.root": ".*, a*, b*, c*, d*, e*, f*, g*, h*, i*, j*, k*, l*, m*, n*, o*, p*, q*, r*, s*, t*, u*, v*, w*, x*, y*, z*, 0*, 1*, 2*, 3*, 4*, 5*, 6*, 7*, 8*, 9*, _*, -*, {*"
},
//* File associations
Expand All @@ -99,50 +92,20 @@
},
//* Exclude problematic files in Problems panel filter and elsewhere
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
//? Pylance notebook cell temp files that get picked up in Problems pane before deletion
//? Pylance temp files get picked up in Problems pane before deletion
"**/*pylance-notebook-cell*": true
},
//* File icon associations
"workbench.iconTheme": "vscode-icons",
"vsicons.presets.hideExplorerArrows": true,
"vsicons.dontShowNewVersionMessage": false,
"vsicons.associations.files": [
{ "icon": "ini", "extensions": ["root"], "format": "svg" }
],

//! Built-in
//* Allow auto-running tasks
"task.allowAutomaticTasks": "on",
//* Enable native bracket pair colorization
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": true,
//* Editor format on save and more. Can run "File: Save without formatting" to skip.
"editor.formatOnType": true,
"editor.formatOnSave": true,
//* Enforce whitespace and newlines.
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
//* Periodically fetch changes to tracked repo. Don't confirm on push/pull.
"git.autofetch": true,
"git.commandsToLog": ["commit", "push"],
"git.confirmSync": false,
"git.ignoredRepositories": ["template", "typings"],
//* Markdown editor moves jarringly when this is "true"
"markdown.preview.scrollEditorWithPreview": false,
//* Exclude
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"typings": true,
"template": true
"submodules": true
},

//! Line-width
Expand Down
29 changes: 6 additions & 23 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@

// * -------------------------------------------------------------------------- * //
// * PROJECT SETUP * //

{
"label": "setup: Copy template",
"type": "shell",
Expand Down Expand Up @@ -142,6 +143,7 @@

// * -------------------------------------------------------------------------- * //
// * PRE-COMMIT * //

{
"label": "pre-commit",
"type": "shell",
Expand All @@ -161,6 +163,7 @@

// * -------------------------------------------------------------------------- * //
// * GIT * //

{
"label": "git: Rebase back to fork",
"type": "shell",
Expand All @@ -170,34 +173,14 @@
"problemMatcher": []
},

// * -------------------------------------------------------------------------- * //
// * BLACK * //
{
"label": "black: Ignore magic comma in this file",
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"command": "black -C ${file}",
"icon": { "id": "code" },
"problemMatcher": []
},
{
"label": "black: Ignore magic comma in all project files",
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"command": "black -C src tests",
"icon": { "id": "code" },
"problemMatcher": []
},

// * -------------------------------------------------------------------------- * //
// * OTHER TASKS * //

{
"label": "task: format and clear notebook",
"dependsOrder": "sequence",
"dependsOn": ["task: format notebook"],
"label": "task: format notebook",
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"command": "nbqa ruff --fix-only ${file}; nb-clean clean --remove-empty-cells --preserve-cell-metadata special tags -- ${file}; black ${file}",
"command": "nb-clean clean --remove-empty-cells --preserve-cell-outputs --preserve-cell-metadata special tags -- ${file}; ruff --fix-only ${file}; ruff format ${file}",
"icon": { "id": "notebook" },
"problemMatcher": []
},
Expand Down
2 changes: 1 addition & 1 deletion boiler.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"notebook.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports.isort": "explicit"
"source.organizeImports": "explicit"
},
"explorer.fileNesting.expand": false,
"explorer.sortOrder": "foldersNestsFiles",
Expand Down
15 changes: 3 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ ignore_unused = [
"gmpy2", # for faster sympy computations
]

# Use ruff for sorting, but configure this in case isort is being used in IDE tooling
[tool.isort]
profile = "black"

[tool.pyright]

# * -------------------------------------------------------------------------------- * #
Expand Down Expand Up @@ -180,17 +176,12 @@ unfixable = [
preview = true
skip-magic-trailing-comma = true

[tool.ruff.pydocstyle]
convention = "google"

[tool.ruff.isort]
# * ---------------------------------------------------------------------------- * #
# * Changes below should persist in significant template updates.

# * ---------------------------------------------------------------------------- * #
# * Changes below may be lost in significant template updates.
split-on-trailing-comma = false

[tool.ruff.pydocstyle]
convention = "google"

[tool.ruff.per-file-ignores]
"docs/**" = [
"E402", # Need to allow imports below patches in docs notebooks
Expand Down
2 changes: 1 addition & 1 deletion tests/boilercore_tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Tests."""
"""Helper functions for tests."""

0 comments on commit 6b45833

Please sign in to comment.