Skip to content

Commit 0447659

Browse files
committed
Fix spelling
1 parent 81bfa76 commit 0447659

5 files changed

Lines changed: 172 additions & 10 deletions

File tree

.devcontainer/Dockerfile.cli

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# HOW TO BUILD AND RUN THIS DOCKERFILE
2+
# * Clone mdio-python and build a Docker image:
3+
# git clone https://github.com/TGSAI/mdio-python.git
4+
# cd mdio-python
5+
# docker build -t mdio-cli -f .devcontainer/Dockerfile.cli .
6+
# * Run /bin/bash in the Docker container:
7+
#
8+
#
9+
# USAGE:
10+
# docker run -it --rm --name mdio-cli mdio-cli --version
11+
# docker run -it --rm --name mdio-cli mdio-cli --help
12+
#
13+
# LOCAL_DATA_DIR=$(pwd); \
14+
# docker run -it --rm -v $LOCAL_DATA_DIR:/DATA --name mdio-cli mdio-cli \
15+
# segy import \
16+
# /DATA/segy_file.segy \
17+
# /DATA/mdio_file.mdio \
18+
# -loc 181,185 \
19+
# -names inline,crossline
20+
#
21+
# LOCAL_DATA_DIR=$(pwd); \
22+
# docker run -it --rm -v $LOCAL_DATA_DIR:/DATA --name mdio-cli mdio-cli \
23+
# segy export \
24+
# /DATA/mdio_file.mdio \
25+
# /DATA/segy_file_copy.segy
26+
#
27+
FROM python:3.13-bookworm
28+
# Create the user (https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user)
29+
ENV USERNAME=python
30+
ENV USER_UID=1000
31+
ENV USER_GID=$USER_UID
32+
RUN groupadd --gid $USER_GID $USERNAME && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
33+
34+
# Set the default non-root user
35+
USER $USERNAME
36+
37+
# Add path to the user-installed packages
38+
ENV PYTHONUSERBASE=/home/$USERNAME/.local
39+
ENV PATH="$PYTHONUSERBASE/bin:$PATH"
40+
41+
COPY --chown=$USERNAME:$USERNAME ./ /home/$USERNAME/mdio-python
42+
43+
WORKDIR /home/$USERNAME/mdio-python
44+
RUN pip install pre-commit ruff
45+
RUN pip install .
46+
47+
ENTRYPOINT ["mdio"]
48+
CMD ["--version"]

.devcontainer/Dockerfile.dev

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# USAGE:
2+
# This file will be used by the VS Code DevContainer extension
3+
# to create a development environment for the mdio-python project.
4+
# HOW TO RUN TESTS
5+
# 1. Open the project in VS Code.
6+
# 2. Open the Command Palette (Ctrl+Shift+P) and select "Dev Containers: Reopen in Container".
7+
# 3. Once the container is running, open a terminal in VS Code.
8+
# 4. Run the tests using the command: `nox -s test`.
9+
# HOW TO MANUALLY BUILD AND RUN THE CONTAINER
10+
# docker build -t mdio-dev -f .devcontainer/Dockerfile.dev .
11+
# docker run -it --rm --entrypoint /bin/bash --name mdio-dev mdio-dev
12+
# NOTES:
13+
# 1. The container will be run as the non-root user 'vscode' with UID 1000.
14+
# 2. The virtual environment will be setup at /home/vscode/venv
15+
# 3. The project source code will be mounted at /workspaces/mdio-python
16+
ARG PYTHON_VERSION="3.13"
17+
ARG LINUX_DISTRO="bookworm"
18+
ARG UV_VERSION="0.6.11"
19+
ARG NOX_VERSION="2025.2.9"
20+
FROM mcr.microsoft.com/devcontainers/python:1-${PYTHON_VERSION}-${LINUX_DISTRO}
21+
22+
# Install git for nox pre-commit
23+
RUN apt-get update \
24+
&& apt-get install -y --no-install-recommends \
25+
git \
26+
&& rm -rf /var/lib/apt/lists/*
27+
28+
ENV USERNAME="vscode"
29+
USER $USERNAME
30+
31+
# # Add path to the user-installed packages
32+
# ENV PYTHONUSERBASE=/home/$USERNAME/.local
33+
# ENV PATH="$PYTHONUSERBASE/bin:$PATH"
34+
35+
COPY --chown=$USERNAME:$USERNAME ./ /workspaces/mdio-python
36+
37+
WORKDIR /workspaces/mdio-python
38+
39+
ARG UV_VERSION
40+
ARG NOX_VERSION
41+
RUN python3 -m pip install uv==${UV_VERSION} nox==${NOX_VERSION} msgpack ipykernel
42+
43+
# Initialize virtual environement in the container
44+
ENV VIRTUAL_ENV="/home/$USERNAME/venv"
45+
RUN python3 -m venv $VIRTUAL_ENV
46+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
47+
48+
# installing pytest is required for VS Code Python Testing
49+
RUN pip install pytest pytest-cov pytest-mock pytest-asyncio
50+
# install packages required to run `pre-commit run --all-files`
51+
RUN pip install ruff pre-commit pre-commit-hooks
52+
53+
# Install the project in editable mode
54+
# This allows for live reloading of the code during development
55+
RUN pip install -e .
56+
57+
# RUN uv pip install snakeviz
58+
59+
60+
61+
62+
63+

.devcontainer/Dockerfile.nox

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# HOW TO BUILD AND RUN THIS DOCKERFILE
2+
# 1. Make sure you have Docker installed and running.
3+
# 2. Clone mdio-python and build the Docker image:
4+
# git clone https://github.com/TGSAI/mdio-python.git
5+
# cd mdio-python
6+
# docker build -t mdio-nox -f .devcontainer/Dockerfile.nox .
7+
# 3. Run /bin/bash in the Docker container :
8+
# LOCAL_DATA_DIR=$(pwd); \
9+
# docker run -it --rm -v $LOCAL_DATA_DIR:/DATA --entrypoint /bin/bash --name mdio-nox mdio-nox
10+
#
11+
# USAGE:
12+
# docker run -it --rm mdio-nox --list
13+
# docker run -it --rm mdio-nox -s tests-3.13
14+
# docker run -it --rm mdio-nox --no-stop-on-first-error
15+
#
16+
# NOTE: nox will fail if run in the directory mounted from the host machine
17+
ARG PYTHON_VERSION="3.13"
18+
ARG LINUX_DISTRO="bookworm"
19+
ARG UV_VERSION="0.6.11"
20+
ARG NOX_VERSION="2025.2.9"
21+
FROM python:${PYTHON_VERSION}-${LINUX_DISTRO}
22+
ARG PYTHON_VERSION
23+
ARG LINUX_DISTRO
24+
RUN echo "Using python:${PYTHON_VERSION}-${LINUX_DISTRO}"
25+
# Create the user (https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user)
26+
ENV USERNAME=python
27+
ENV USER_UID=1000
28+
ENV USER_GID=$USER_UID
29+
RUN groupadd --gid $USER_GID $USERNAME && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
30+
# Set the default non-root user
31+
USER $USERNAME
32+
33+
# Add path to the user-installed packages
34+
ENV PYTHONUSERBASE=/home/$USERNAME/.local
35+
ENV PATH="$PYTHONUSERBASE/bin:$PATH"
36+
37+
COPY --chown=$USERNAME:$USERNAME ./ /home/$USERNAME/mdio-python
38+
39+
WORKDIR /home/$USERNAME/mdio-python
40+
RUN pip install .
41+
42+
# Install UV dependency manager and Nox test automator
43+
ARG UV_VERSION
44+
ARG NOX_VERSION
45+
RUN echo "Using uv: $UV_VERSION and nox: $NOX_VERSION"
46+
RUN python3 -m pip install uv==${UV_VERSION} nox==${NOX_VERSION} msgpack ipykernel
47+
48+
ENTRYPOINT ["nox"]
49+
CMD ["--list"]

.devcontainer/devcontainer.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
// README at: https://github.com/devcontainers/templates/tree/main/src/python
33
{
44
"build": {
5-
"dockerfile": "Dockerfile",
5+
"dockerfile": "Dockerfile.dev",
66
"context": ".."
77
},
88
// Use 'postCreateCommand' to run commands after the container is created.
99
"postCreateCommand": {
10-
"post_create_script": "bash ./.devcontainer/post-install.sh"
10+
// "post_create_script": "bash ./.devcontainer/post-install.sh"
1111
},
1212
// Forward 8787 to enable us to view dask dashboard
1313
"forwardPorts": [8787],
@@ -16,8 +16,9 @@
1616
// Configure properties specific to VS Code.
1717
"vscode": {
1818
"settings": {
19-
"python.terminal.activateEnvInCurrentTerminal": true,
20-
"python.defaultInterpreterPath": "/opt/venv/bin/python"
19+
"python.testing.pytestArgs": ["tests"],
20+
"python.testing.unittestEnabled": false,
21+
"python.testing.pytestEnabled": true
2122
},
2223
"extensions": [
2324
"ms-python.python",
@@ -27,17 +28,18 @@
2728
"ms-toolsai.jupyter-renderers",
2829
"vscode-icons-team.vscode-icons",
2930
"wayou.vscode-todo-highlight",
30-
"streetsidesoftware.code-spell-checker"
31+
"streetsidesoftware.code-spell-checker",
32+
"eamodio.gitlens",
33+
"visualstudioexptteam.vscodeintellicode"
3134
]
3235
}
3336
},
3437
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
3538
// "remoteUser": "root",
3639
"updateRemoteUserUID": true,
40+
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/mdio-python,type=bind",
41+
"workspaceFolder": "/workspaces/mdio-python",
3742
"mounts": [
38-
// Re-use local Git configuration
39-
"source=${localEnv:HOME}/.gitconfig,target=/home/vscode/.gitconfig_tmp,type=bind,consistency=cached",
40-
"source=${localEnv:HOME}/.gitconfig,target=/root/.gitconfig_tmp,type=bind,consistency=cached",
41-
"source=${localEnv:SCRATCH_DIR}/${localEnv:USER},target=/scratch/,type=bind,consistency=cached"
43+
// "source=${localWorkspaceFolder}/../DATA/,target=/DATA/,type=bind,consistency=cached"
4244
]
4345
}

tests/unit/v1/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def _get_coordinate(
129129

130130

131131
def _get_all_coordinates(dataset: Dataset) -> list[Coordinate]:
132-
"""Get all coordinates from the dataset."""
132+
"""Get all Coordinates from the Dataset."""
133133
all_coords: dict[str, Coordinate] = {}
134134
for v in dataset.variables:
135135
if v.coordinates is not None:

0 commit comments

Comments
 (0)