Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ARG UV_VERSION=latest
ARG DEBIAN_VERSION=bookworm


FROM ghcr.io/astral-sh/uv:$UV_VERSION AS uv


FROM mcr.microsoft.com/vscode/devcontainers/base:$DEBIAN_VERSION
LABEL maintainer="IPA Research Support <researchsupport@poverty-action.org>"

# hadolint ignore=DL3008
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
# For OpenCV etc...
libgl1 libglib2.0-0 \
# To remove the image size, it is recommended refresh the package cache as follows
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY --from=uv --chown=vscode: /uv /uvx /bin/
51 changes: 51 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "uv",
"build": {
"context": "..",
"dockerfile": "Dockerfile",
"args": {
"UV_VERSION": "0.5.4",
"DEBIAN_VERSION": "bookworm"
}
},
"features": {
"ghcr.io/dhoeric/features/hadolint:1": {},
"ghcr.io/shinepukur/devcontainer-features/vale:1": {},
"ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": {},
"ghcr.io/rocker-org/devcontainer-features/r-apt:0": {},
"ghcr.io/guiyomh/features/just:0": {}
},
"customizations": {
"vscode": {
"extensions": [
"charliermarsh.ruff",
"exiasr.hadolint",
"ms-azuretools.vscode-docker",
"ms-python.python",
"ms-python.vscode-pylance",
"redhat.vscode-yaml",
"shardulm94.trailing-spaces",
"yzhang.markdown-all-in-one",
"ms-toolsai.jupyter",
"kylebarron.stata-enhanced",
"quarto.quarto",
"davidanson.vscode-markdownlint",
"bierner.markdown-preview-github-styles",
"chrischinchilla.vale-vscode",
"posit.air-vscode",
"tamasfe.even-better-toml"
]
}
},
"containerEnv": {
"DISPLAY": "dummy",
"PYTHONUNBUFFERED": "True",
"UV_LINK_MODE": "copy",
"UV_PROJECT_ENVIRONMENT": "/home/vscode/.venv",
"QUARTO_PYTHON": "/home/vscode/.venv/bin/python3",
"QUARTO_R": "/usr/bin/R"
},
"postCreateCommand": "uv sync --frozen",
"postStartCommand": "uv run pre-commit install",
"remoteUser": "vscode"
}
186 changes: 186 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# Byte-compiled / optimized / DLL files
**/__pycache__/
**/*.py[cod]
**/*$py.class

# C extensions
**/*.so

# Distribution / packaging
**/.Python
**/build/
**/develop-eggs/
**/dist/
**/downloads/
**/eggs/
**/.eggs/
**/lib/
**/lib64/
**/parts/
**/sdist/
**/var/
**/wheels/
**/share/python-wheels/
**/*.egg-info/
**/.installed.cfg
**/*.egg
**/MANIFEST

# Docker
**/compose.yml
**/docker-compose.yml
**/*Dockerfile
.dockerignore

# Git
.git
.github
**/.gitignore

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
**/*.manifest
**/*.spec

# Installer logs
**/pip-log.txt
**/pip-delete-this-directory.txt

# Unit test / coverage reports
**/htmlcov/
**/.tox/
**/.nox/
**/.coverage
**/.coverage.*
**/.*cache
**/nosetests.xml
**/coverage.xml
**/*.cover
**/*.py,cover
**/.hypothesis/
**/.pytest_cache/
**/cover/

# Translations
**/*.mo
**/*.pot

# Django stuff:
**/*.log
**/local_settings.py
**/db.sqlite3
**/db.sqlite3-journal

# Flask stuff:
**/instance/
**/.webassets-cache

# Scrapy stuff:
**/.scrapy

# Sphinx documentation
**/docs/_build/

# PyBuilder
**/.pybuilder/
**/target/

# Jupyter Notebook
**/.ipynb_checkpoints

# IPython
**/profile_default/
**/ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
**/__pypackages__/

# Celery stuff
**/celerybeat-schedule
**/celerybeat.pid

# SageMath parsed files
**/*.sage.py

# Environments
**/.env
**/.venv
**/env/
**/venv/
**/ENV/
**/env.bak/
**/venv.bak/

# Spyder project settings
**/.spyderproject
**/.spyproject

# Rope project settings
**/.ropeproject

# mkdocs documentation
**/site

# mypy
**/.mypy_cache/
**/.dmypy.json
**/dmypy.json

# Pyre type checker
**/.pyre/

# pytype static type analyzer
**/.pytype/

# Cython debug symbols
**/cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# VS Code
.vscode
.devcontainer

# Custom
.pre-commit-config.yaml
assets
LICENSE
pyrightconfig.json
README.md
ruff.toml
tests
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ repos:
- id: check-merge-conflict
stages: [pre-commit]
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
args: [--toml, pyproject.toml, --ignore-words=.codespell-ignore.txt]
exclude: (styles|.devcontainer|.quarto|.venv|.vscode|_site|_freeze|\.lock$)
additional_dependencies:
- tomli
- repo: https://github.com/google/yamlfmt
rev: v0.10.0
rev: v0.16.0
hooks:
- id: yamlfmt
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.23
rev: v0.24.1
hooks:
- id: validate-pyproject
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.43.0
rev: v0.45.0
hooks:
- id: markdownlint-fix
exclude: (.github/pull_request_template.md|LICENSE.md)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
rev: v0.11.10
hooks:
- id: ruff-format
types_or: [python, pyi, jupyter]
Expand All @@ -42,6 +42,6 @@ repos:
types_or: [python, pyi, jupyter]
require_serial: true
- repo: https://github.com/rhysd/actionlint
rev: v1.7.4
rev: v1.7.7
hooks:
- id: actionlint
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"bierner.markdown-preview-github-styles",
"chrischinchilla.vale-vscode",
"posit.air-vscode",
"tamasfe.even-better-toml"
"tamasfe.even-better-toml",
"exiasr.hadolint"
]
}
18 changes: 17 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,21 @@
"!**/_site",
"!**/.quarto",
"!LICENSE.md"
]
],
"[dockercompose]": {
"editor.autoIndent": "advanced",
"editor.defaultFormatter": "redhat.vscode-yaml",
"editor.formatOnSave": true,
"editor.insertSpaces": true,
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": true
},
"editor.tabSize": 4
},
"[dockerfile]": {
"editor.defaultFormatter": "ms-azuretools.vscode-containers",
"editor.formatOnSave": true
}
}
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ARG DEBIAN_VERSION=bookworm
ARG UV_VERSION=0.5.4
ARG VARIANT=3.12


FROM ghcr.io/astral-sh/uv:$UV_VERSION AS uv


FROM python:$VARIANT-slim-$DEBIAN_VERSION
LABEL maintainer="IPA Research Support <researchsupport@poverty-action.org>"

ENV PYTHONDONTWRITEBYTECODE=True
ENV PYTHONUNBUFFERED=True
ENV UV_LINK_MODE=copy

WORKDIR /app

COPY --from=uv /uv /uvx /bin/
COPY pyproject.toml uv.lock ./

RUN uv sync --frozen --no-install-project
9 changes: 7 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ venv:
uv tool install pre-commit
uv run pre-commit install

activate-venv:
uv shell
# Activate interactive python
ipython:
uv run ipython

# Activate interactive R
ir:
uv run radian

# launch jupyter lab
lab:
Expand Down
Loading
Loading