From d56f148f66e35f350edeb32fc48083ac42661c7b Mon Sep 17 00:00:00 2001 From: Pamela Fox Date: Tue, 17 Oct 2023 18:11:40 +0000 Subject: [PATCH] Update template --- .devcontainer/Dockerfile | 4 ---- .devcontainer/devcontainer.json | 34 ++++++++++----------------------- .github/workflows/python.yaml | 2 +- .pre-commit-config.yaml | 9 ++++----- README.md | 2 +- pyproject.toml | 15 +++++++-------- 6 files changed, 23 insertions(+), 43 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6404118..3a8ee0f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1 @@ -# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3/.devcontainer/base.Dockerfile - -# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster -ARG VARIANT="3.10-bullseye" FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d136a8a..db28e39 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,17 +2,7 @@ // https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3 { "name": "Python 3", - "forwardPorts": [8000], - "build": { - "dockerfile": "Dockerfile", - "context": "..", - "args": { - // Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6 - // Append -bullseye or -buster to pin to an OS version. - // Use -bullseye variants on local on arm64/Apple Silicon. - "VARIANT": "3.10-bullseye" - } - }, + "image": "mcr.microsoft.com/vscode/devcontainers/python:3.11-bullseye", // Configure tool-specific properties. "customizations": { @@ -20,25 +10,21 @@ "vscode": { // Set *default* container specific settings.json values on container create. "settings": { - "python.defaultInterpreterPath": "/usr/local/bin/python", - "python.linting.enabled": true, - "python.linting.pylintEnabled": true, - "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", - "python.formatting.blackPath": "/usr/local/py-utils/bin/black", - "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", - "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", - "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", - "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", - "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", - "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint", + "python.defaultInterpreterPath": "/usr/local/bin/python", + "python.testing.pytestEnabled": true, "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true + "files.exclude": { + ".coverage": true, + ".pytest_cache": true, + "__pycache__": true + } }, // Add the IDs of extensions you want installed when the container is created. "extensions": [ "ms-python.python", - "ms-python.vscode-pylance" + "charliermarsh.ruff", + "ms-python.black-formatter" ] } }, diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml index 35c2d4c..a224d2b 100644 --- a/.github/workflows/python.yaml +++ b/.github/workflows/python.yaml @@ -14,7 +14,7 @@ jobs: - name: Set up Python 3 uses: actions/setup-python@v3 with: - python-version: "3.10" + python-version: "3.11" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 74c50b5..839d4fc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,16 +1,15 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace -- repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.252 +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.0 hooks: - id: ruff - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.9.1 hooks: - id: black - args: ['--config=./pyproject.toml'] diff --git a/README.md b/README.md index e8011c6..6b01461 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It includes `pytest` for testing plus the `pytest-cov` plugin to measure coverag The checks and tests are all run using Github actions on every pull request and merge to main. -This repository is setup for Python 3.10. To customize that, change the `VARIANT` argument in `.devcontainer/devcontainer.json`, change the config options in `.precommit-config.yaml` and change the version number in `.github/workflows/python.yaml`. +This repository is setup for Python 3.11. To customize that, change the `VARIANT` argument in `.devcontainer/devcontainer.json`, change the config options in `.precommit-config.yaml` and change the version number in `.github/workflows/python.yaml`. ## Development instructions diff --git a/pyproject.toml b/pyproject.toml index 95f732c..fadfc3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,18 +1,17 @@ [tool.ruff] -line-length = 100 -target-version = "py310" +line-length = 120 +target-version = "py311" select = ["E", "F", "I", "UP"] ignore = ["D203"] -show-source = true [tool.black] -line-length = 100 -target-version = ["py310"] - -[tool.pylint.messages_control] -disable = "C0114,C0115,C0116" +line-length = 120 +target-version = ["py311"] [tool.pytest.ini_options] addopts = "-ra --cov" testpaths = ["tests"] pythonpath = ['.'] + +[tool.coverage.report] +show_missing = true