Skip to content

Commit e04c580

Browse files
authored
Merge pull request #215 from DoubleML/dev
Update stable docs version
2 parents e73d644 + 36fc3ad commit e04c580

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+730
-648
lines changed

.devcontainer/Dockerfile.dev

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
FROM ubuntu:24.04
2+
3+
# Set non-interactive mode to avoid prompts
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
6+
# Update package list and install dependencies
7+
RUN apt-get update && \
8+
apt-get install -y \
9+
software-properties-common \
10+
graphviz \
11+
wget \
12+
dirmngr \
13+
gnupg \
14+
apt-transport-https \
15+
ca-certificates \
16+
git \
17+
cmake
18+
19+
# Install locale packages
20+
RUN apt-get update && \
21+
apt-get install -y locales && \
22+
locale-gen en_US.UTF-8 && \
23+
update-locale LANG=en_US.UTF-8
24+
25+
# Set environment variables for locale
26+
ENV LANG=en_US.UTF-8
27+
ENV LANGUAGE=en_US:en
28+
ENV LC_ALL=en_US.UTF-8
29+
30+
# Install Python 3.12
31+
RUN add-apt-repository ppa:deadsnakes/ppa && \
32+
apt-get update && \
33+
apt-get install -y python3.12 python3.12-venv python3.12-dev python3-pip python3-full && \
34+
apt-get clean && rm -rf /var/lib/apt/lists/*
35+
36+
# Set Python 3.12 as the default for both python and python3
37+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 && \
38+
update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1
39+
40+
# Add R repository and install R
41+
RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc && \
42+
add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu noble-cran40/' && \
43+
apt-get update && \
44+
apt-get install -y r-base r-base-dev zlib1g-dev libicu-dev pandoc make libcurl4-openssl-dev libssl-dev
45+
46+
# Install Python packages
47+
COPY requirements.txt /tmp/requirements.txt
48+
RUN python -m venv /opt/venv && \
49+
/opt/venv/bin/python -m pip install --upgrade pip && \
50+
/opt/venv/bin/pip install -r /tmp/requirements.txt
51+
52+
# Set the virtual environment as the default Python environment
53+
ENV PATH="/opt/venv/bin:$PATH"
54+
55+
# Check out the repo containing the Python package DoubleML (dev)
56+
RUN git clone https://github.com/DoubleML/doubleml-for-py.git /doubleml-for-py
57+
WORKDIR /doubleml-for-py
58+
RUN /opt/venv/bin/pip uninstall -y DoubleML && \
59+
/opt/venv/bin/pip install -e .[rdd]
60+
61+
# Create a directory for R user libraries and set the default R user library path
62+
RUN mkdir -p /usr/local/lib/R/site-library
63+
ENV R_LIBS_USER=/usr/local/lib/R/site-library
64+
65+
# Install R packages and Jupyter kernel
66+
RUN Rscript -e "install.packages('remotes')" && \
67+
Rscript -e "remotes::install_github('DoubleML/doubleml-for-r', dependencies = TRUE)" && \
68+
Rscript -e "install.packages(c('ggplot2', 'IRkernel', 'xgboost', 'hdm', 'reshape2', 'gridExtra', 'igraph', 'mlr3filters', 'mlr3measures', 'did', dependencies=TRUE))" && \
69+
Rscript -e "IRkernel::installspec()"
70+
71+
# Set the working directory
72+
WORKDIR /workspace
73+

.devcontainer/devcontainer.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "DoubleML Documentation Development",
3+
"dockerFile": "Dockerfile.dev", // Path to your Dockerfile
4+
"context": "..", // Context for the build (root of your project)
5+
"workspaceFolder": "/workspace", // Folder inside the container for your project
6+
// Customizations for VS Code
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
"ms-python.python", // Python extension for VS Code
11+
"ms-azuretools.vscode-docker", // Docker integration for VS Code
12+
"njpwerner.autodocstring", // Optional: Auto-generate docstrings
13+
"ms-python.black-formatter", // Optional: Black formatter
14+
"streetsidesoftware.code-spell-checker", // Optional: Spell checker
15+
"github.copilot" // Add GitHub Copilot extension
16+
"GitHub.github-vscode-theme", // GitHub theme
17+
"github.vscode-github-actions" // GitHub Actions extension
18+
"ms-toolsai.jupyter", // Jupyter extension
19+
"charliermarsh.ruff" // Ruff extension
20+
],
21+
"settings": {
22+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python", // Poetry virtual environment path
23+
"editor.formatOnSave": true, // Auto-format code when saving
24+
"editor.codeActionsOnSave": {
25+
"source.organizeImports": true // Auto-organize imports on save
26+
},
27+
"python.linting.enabled": true, // Enable linting
28+
"python.linting.flake8Enabled": false, // Disable Flake8 for linting
29+
"python.linting.ruffEnabled": true, // Enable Ruff for linting
30+
"python.formatting.provider": "black", // Use Black for formatting
31+
"python.testing.pytestEnabled": false, // Enable Pytest for testing
32+
"python.testing.pytestArgs": [],
33+
"python.testing.unittestEnabled": false,
34+
"files.exclude": {
35+
"**/__pycache__": true, // Hide __pycache__ directories
36+
"**/*.pyc": true, // Hide .pyc files
37+
"**/.DS_Store": true // Hide .DS_Store files (macOS)
38+
}
39+
}
40+
}
41+
},
42+
"mounts": [
43+
"source=${localWorkspaceFolder},target=/workspace,type=bind" // Mount your local workspace into the container
44+
],
45+
"remoteUser": "root" // Set the user inside the container
46+
}

.devcontainer/guide.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Build Documentation with Development Container
2+
3+
This guide shows how to use WSL2 (Windows Subsystem for Linux), Docker Desktop, Visual Studio Code (VS Code), and how to work with Development Containers in VS Code on a Windows machine.
4+
5+
Requirements:
6+
- [VS Code](https://code.visualstudio.com/)
7+
- [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install)
8+
- [Docker Desktop](https://docs.docker.com/desktop/setup/install/windows-install/)
9+
10+
## Verify installations & Setup
11+
12+
You can verify the installations in a terminal:
13+
14+
```bash
15+
code --version
16+
wsl --version
17+
docker --version
18+
```
19+
20+
### Configure Docker to Use WSL2
21+
22+
See [Docker Desktop Documentation](https://docs.docker.com/desktop/features/wsl/#turn-on-docker-desktop-wsl-2).
23+
- Open Docker Desktop.
24+
- Go to **Settings > General** and make sure **Use the WSL 2 based engine** is checked.
25+
- Under **Settings > Resources > WSL Integration**, ensure that your desired Linux distribution(s) are selected for integration with Docker.
26+
27+
### Install Extensions
28+
29+
- Open Visual Studio Code.
30+
- Press `Ctrl+Shift+X` to open the Extensions view.
31+
- Search and install (includes WSL and Dev Containers Extensions):
32+
- [Remote Development Extension Pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack)
33+
34+
VS Code Documentations:
35+
- [Developing in WSL](https://code.visualstudio.com/docs/remote/wsl)
36+
- [Developing inside a Container](https://code.visualstudio.com/docs/devcontainers/containers)
37+
38+
39+
## Build & Open the Development Container
40+
41+
- Open the project `doubleml-docs` in VS code:
42+
43+
```bash
44+
code .
45+
```
46+
47+
- Open the Command Palette (`Ctrl+Shift+P`).
48+
- Type `Remote-Containers: Reopen Folder in Container`.
49+
- VS Code will build the new container(this may take some time) and open the project in it.
50+
51+
52+
## Build the documentation
53+
54+
You can build the documentation via
55+
56+
```bash
57+
cd doc
58+
make html
59+
```
60+
61+
Open the directory in WSL with
62+
```bash
63+
explorer.exe .
64+
```

.github/workflows/deploy_docu_dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676

7777
- name: Build docu with sphinx
7878
run: |
79-
make -C doc html # build docu
79+
make -C doc html
8080
8181
- name: Deploy to dev
8282
uses: JamesIves/github-pages-deploy-action@v4

.github/workflows/deploy_docu_stable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565

6666
- name: Build docu with sphinx
6767
run: |
68-
make -C doc html # build docu
68+
make -C doc html
6969
7070
- name: Deploy to stable
7171
uses: JamesIves/github-pages-deploy-action@v4

.github/workflows/test_build_docu_dev.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ on:
2020
description: 'Branch in https://github.com/DoubleML/doubleml-for-r'
2121
required: true
2222
default: 'main'
23+
nbsphinx-execute:
24+
description: 'Execute notebooks with nbsphinx'
25+
required: false
26+
default: 'auto'
2327
schedule:
2428
- cron: "0 9 * * 1,3,5"
2529

@@ -113,7 +117,7 @@ jobs:
113117

114118
- name: Build docu with sphinx
115119
run: |
116-
make -C doc html # build docu
120+
make -C doc html NBSPHINX_EXECUTE=${{ github.event.inputs.nbsphinx-execute || 'auto' }}
117121
118122
- name: Check for broken links / URLs
119123
run: |

.github/workflows/test_build_docu_released.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
- main
1212
- dev
1313
workflow_dispatch:
14+
inputs:
15+
nbsphinx-execute:
16+
description: 'Execute notebooks with nbsphinx'
17+
required: false
18+
default: 'auto'
1419
schedule:
1520
- cron: "0 9 * * 1,3,5"
1621

@@ -74,9 +79,10 @@ jobs:
7479

7580
- name: Build docu with sphinx
7681
run: |
77-
make -C doc html # build docu
82+
make -C doc html NBSPHINX_EXECUTE=${{ github.event.inputs.nbsphinx-execute || 'auto' }}
7883
7984
- name: Check for broken links / URLs
85+
8086
run: |
8187
make -C doc linkcheck
8288

.idea/.gitignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/doubleml-docs.iml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.idea/inspectionProfiles/profiles_settings.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/misc.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.

.idea/modules.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/rGraphicsSettings.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.idea/rSettings.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

doc/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
_build
2+
3+
# Ignore generated API documentation
4+
api/generated/

doc/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ SPHINXOPTS ?=
77
SPHINXBUILD ?= sphinx-build
88
SOURCEDIR = .
99
BUILDDIR = _build
10+
NBSPHINX_EXECUTE = auto
11+
12+
# Add NBSPHINX_EXECUTE to SPHINXOPTS
13+
SPHINXOPTS += -D nbsphinx_execute=$(NBSPHINX_EXECUTE)
14+
1015

1116
# Put it first so that "make" without argument is like "make help".
1217
help:

doc/_static/switcher.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{
3+
"name": "dev",
4+
"version": "dev",
5+
"url": "https://docs.doubleml.org/dev/"
6+
},
7+
{
8+
"name": "stable",
9+
"version": "stable",
10+
"url": "https://docs.doubleml.org/stable/",
11+
"preferred": true
12+
}
13+
]

0 commit comments

Comments
 (0)