Skip to content

Commit fa81791

Browse files
authored
Merge pull request #13804 from notatallshaw/dev-container-improvements
devcontainer improvements
2 parents cf4dbd5 + 2e63d9a commit fa81791

File tree

4 files changed

+47
-11
lines changed

4 files changed

+47
-11
lines changed

.devcontainer/devcontainer.json

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
{
22
"name": "pip",
33
"image": "mcr.microsoft.com/devcontainers/python:3",
4+
"remoteUser": "vscode",
5+
"remoteEnv": {
6+
"PATH": "/home/vscode/.local/bin:${containerEnv:PATH}"
7+
},
48
"features": {
59
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
6-
"packages": "mercurial,subversion,bzr"
10+
"packages": "mercurial,subversion,bzr,python3-venv"
711
}
812
},
9-
"postCreateCommand": "python -m venv .venv\nsource .venv/bin/activate\npip install nox\npip install -e .",
13+
"postCreateCommand": "bash ${containerWorkspaceFolder}/.devcontainer/postCreate.sh",
1014
"customizations": {
1115
"vscode": {
1216
"extensions": [
13-
"hbenl.vscode-test-explorer",
14-
"ms-python.python"
15-
]
17+
"ms-python.python",
18+
"ms-python.black-formatter",
19+
"charliermarsh.ruff"
20+
],
21+
"settings": {
22+
"python.testing.pytestEnabled": true,
23+
"python.testing.pytestArgs": [
24+
"-n",
25+
"auto"
26+
]
27+
}
1628
}
1729
}
1830
}

.devcontainer/postCreate.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -Eeuo pipefail
3+
4+
# Get the workspace directory
5+
WORKSPACE_DIR="${WORKSPACE_DIR:-/workspaces/pip}"
6+
cd "$WORKSPACE_DIR"
7+
8+
# Upgrade pip and install development dependencies
9+
python -m pip install --upgrade pip
10+
python -m pip install nox --group test
11+
python -m nox -s common-wheels
12+
python -m pip install -e .

noxfile.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,8 @@ def should_update_common_wheels(session: nox.Session) -> bool:
9696
return need_to_repopulate
9797

9898

99-
# -----------------------------------------------------------------------------
100-
# Development Commands
101-
# -----------------------------------------------------------------------------
102-
@nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "pypy3"])
103-
def test(session: nox.Session) -> None:
104-
# Get the common wheels.
99+
def get_common_wheels(session: nox.Session) -> None:
100+
"""Build the common wheels needed by tests."""
105101
if should_update_common_wheels(session):
106102
# fmt: off
107103
run_with_protected_pip(
@@ -115,6 +111,21 @@ def test(session: nox.Session) -> None:
115111
msg = f"Reusing existing common-wheels at {LOCATIONS['common-wheels']}."
116112
session.log(msg)
117113

114+
115+
# -----------------------------------------------------------------------------
116+
# Development Commands
117+
# -----------------------------------------------------------------------------
118+
@nox.session(name="common-wheels")
119+
def common_wheels(session: nox.Session) -> None:
120+
"""Build the common wheels needed by tests."""
121+
get_common_wheels(session)
122+
123+
124+
@nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "pypy3"])
125+
def test(session: nox.Session) -> None:
126+
# Get the common wheels.
127+
get_common_wheels(session)
128+
118129
# Build source distribution
119130
# HACK: we want to skip building and installing pip when nox's --no-install
120131
# flag is given (to save time when running tests back to back with different

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ git-only = [
381381
"tests/**",
382382
"tools/**",
383383
"news/.gitignore",
384+
".devcontainer/**",
384385
".gitattributes",
385386
".gitignore",
386387
".git-blame-ignore-revs",

0 commit comments

Comments
 (0)