Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Chan committed Feb 9, 2024
1 parent cfdbf51 commit 69da8aa
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 75 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
_commit: 1.0.2-67-g6d08806
_commit: 1.0.2-78-gf6a7685
_src_path: gh:DiamondLightSource/python-copier-template
author_email: tom.cobb@diamond.ac.uk
author_name: Tom Cobb
Expand Down
46 changes: 21 additions & 25 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,41 @@
"target": "developer"
},
"remoteEnv": {
// Allow X11 apps to run inside the container
"DISPLAY": "${localEnv:DISPLAY}"
},
// Add the URLs of features you want added when the container is built.
"features": {
"ghcr.io/devcontainers/features/common-utils:1": {
"username": "none",
"upgradePackages": false
}
},
"customizations": {
// Set *default* container specific settings.json values on container create.
"settings": {
"python.defaultInterpreterPath": "/venv/bin/python"
},
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"python.defaultInterpreterPath": "/venv/bin/python"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"github.vscode-github-actions",
"tamasfe.even-better-toml",
"redhat.vscode-yaml",
"ryanluker.vscode-coverage-gutters"
"ryanluker.vscode-coverage-gutters",
"charliermarsh.ruff",
"ms-azuretools.vscode-docker"
]
}
},
// Make sure the files we are mapping into the container exist on the host
"initializeCommand": "bash -c 'for i in $HOME/.inputrc; do [ -f $i ] || touch $i; done'",
"features": {
// Some default things like git config
"ghcr.io/devcontainers/features/common-utils:2": {
"upgradePackages": false
}
},
"runArgs": [
// Allow the container to access the host X11 display and EPICS CA
"--net=host",
"--security-opt=label=type:container_runtime_t"
],
"mounts": [
"source=${localEnv:HOME}/.ssh,target=/root/.ssh,type=bind",
"source=${localEnv:HOME}/.inputrc,target=/root/.inputrc,type=bind",
// map in home directory - not strictly necessary but useful
"source=${localEnv:HOME},target=${localEnv:HOME},type=bind,consistency=cached"
// Make sure SELinux does not disable with access to host filesystems like tmp
"--security-opt=label=disable"
],
// make the workspace folder the same inside and outside of the container
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind",
"workspaceFolder": "${localWorkspaceFolder}",
// Mount the parent as /workspaces so we can pip install peers as editable
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
// After the container is created, install the python project in editable form
"postCreateCommand": "pip install -e '.[dev]'"
"postCreateCommand": "pip install $([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e '.[dev]' && pre-commit install"
}
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-yaml
- id: check-merge-conflict

- repo: local
hooks:
- id: black
name: Run black
stages: [commit]
- id: ruff
name: lint with ruff
language: system
entry: black --check --diff
entry: ruff check --force-exclude
types: [python]
require_serial: true

- id: ruff
name: Run ruff
stages: [commit]
- id: ruff-format
name: format with ruff
language: system
entry: ruff
entry: ruff format --force-exclude
types: [python]
require_serial: true
7 changes: 1 addition & 6 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{
"recommendations": [
"ms-vscode-remote.remote-containers",
"ms-python.python",
"tamasfe.even-better-toml",
"redhat.vscode-yaml",
"ryanluker.vscode-coverage-gutters",
"charliermarsh.Ruff"
]
}
}
8 changes: 1 addition & 7 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
"debug-test"
],
"console": "integratedTerminal",
"env": {
// The default config in pyproject.toml's "[tool.pytest.ini_options]" adds coverage.
// Cannot have coverage and debugging at the same time.
// https://github.com/microsoft/vscode-python/issues/693
"PYTEST_ADDOPTS": "--no-cov"
},
}
]
}
}
22 changes: 6 additions & 16 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
{
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": false,
"python.linting.enabled": true,
"python.testing.pytestArgs": [
"--cov=python_copier_template_example",
"--cov-report",
"xml:cov.xml"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.formatting.provider": "black",
"python.languageServer": "Pylance",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"[python]": {
"editor.codeActionsOnSave": {
"source.fixAll.ruff": false,
"source.organizeImports.ruff": true
}
}
}
"editor.defaultFormatter": "charliermarsh.ruff",
},
}
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"problemMatcher": [],
}
]
}
}
9 changes: 0 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,6 @@
# A dictionary of graphviz graph attributes for inheritance diagrams.
inheritance_graph_attrs = {"rankdir": "TB"}

# Common links that should be available on every page
rst_epilog = """
.. _Diamond Light Source: http://www.diamond.ac.uk
.. _black: https://github.com/psf/black
.. _ruff: https://beta.ruff.rs/docs/
.. _pyright: https://microsoft.github.io/pyright/#/
.. _pre-commit: https://pre-commit.com/
"""

# Ignore localhost links for periodic check that links in docs are valid
linkcheck_ignore = [r"http://localhost:\d+/"]

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ requires-python = ">=3.7"

[project.optional-dependencies]
dev = [
"black",
"copier",
"myst-parser",
"pipdeptree",
Expand Down

0 comments on commit 69da8aa

Please sign in to comment.