Skip to content
This repository was archived by the owner on Mar 6, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
584a239
add optional depedencies
LukeWeidenwalker Jul 25, 2022
011c1ba
pin xarray to 2022.3.0
LukeWeidenwalker Jul 25, 2022
4bec57b
Update xarray version range to avoid ufunc deprecation.
LukeWeidenwalker Jul 26, 2022
70badd1
Get rid of package renaming in __init__.py, this is now handled by po…
LukeWeidenwalker Jul 26, 2022
e286af6
Update noxfile to install the extras.
LukeWeidenwalker Jul 26, 2022
4bfdfb5
add example for multiple dispatch
LukeWeidenwalker Jul 27, 2022
f26cec9
Add parsing of requires_dist items
LukeWeidenwalker Jul 28, 2022
7629ad1
fix remaining issue with regex
LukeWeidenwalker Jul 28, 2022
2a3cbb1
more fixes to regex
LukeWeidenwalker Jul 28, 2022
bc8bd47
parse name of import
LukeWeidenwalker Jul 28, 2022
82d581d
make raster & dask core again.
LukeWeidenwalker Jul 29, 2022
f8b8108
remove build variants from noxfile.
LukeWeidenwalker Jul 29, 2022
389861b
finish poc for multi type dispatch
LukeWeidenwalker Jul 29, 2022
2d892ae
remove the multi dispatch example again
LukeWeidenwalker Jul 29, 2022
204174f
remove unused mypy setting again
LukeWeidenwalker Jul 29, 2022
5ca1a34
Add docker-compose to spin up dask cluster
LukeWeidenwalker Aug 1, 2022
dd5e7ed
add .dockerignore
LukeWeidenwalker Aug 1, 2022
b176c9f
Update devcontainer to install optional dependencies
LukeWeidenwalker Aug 1, 2022
9444180
update dockerignore.
LukeWeidenwalker Aug 1, 2022
d30341b
minor edits to compose file.
LukeWeidenwalker Aug 1, 2022
4a2a143
progress dump.
LukeWeidenwalker Aug 3, 2022
3dba762
fix dockerfile
LukeWeidenwalker Aug 8, 2022
7869bdd
sync versions across all containers.
LukeWeidenwalker Aug 9, 2022
80896fb
add lz4 dependency.
LukeWeidenwalker Aug 9, 2022
131aa2f
move docker-compose to .devcontainer folder
LukeWeidenwalker Aug 9, 2022
fb90ef6
update reference to docker-compose
LukeWeidenwalker Aug 9, 2022
f8f88b5
fix dir for volume mount
LukeWeidenwalker Aug 9, 2022
2b66310
get rid of equi7grid dependency & update lockfile.
LukeWeidenwalker Aug 9, 2022
f8c0b13
rename notebook.
LukeWeidenwalker Aug 9, 2022
2552e0a
bump dask version
LukeWeidenwalker Aug 9, 2022
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
51 changes: 48 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
FROM osgeo/gdal:ubuntu-small-3.5.0 AS base

ARG DEBIAN_FRONTEND=noninteractive
ARG USERNAME=ubuntu
ARG GROUPNAME=ubuntu
ARG USER_UID=1000
ARG USER_GID=1000

FROM osgeo/gdal:ubuntu-small-3.5.0 AS devcontainer
ARG DEBIAN_FRONTEND
ARG USERNAME
ARG GROUPNAME
ARG USER_UID
ARG USER_GID

ENV TZ=Etc/GMT

ENV PYTHONUNBUFFERED=1 \
Expand All @@ -24,7 +30,8 @@ RUN apt-get update -qy && \
apt-get install -qy --no-install-recommends \
# libpq-dev and build-essential are necessary for psycopg2, which is required for datacube
build-essential \
libpq-dev
libpq-dev \
graphviz

# Adapted from https://github.com/TheKevJames/tools/blob/master/docker-nox/Dockerfile
RUN apt-get update -qy && \
Expand Down Expand Up @@ -84,3 +91,41 @@ RUN python3.6 -m pip install --user --no-cache-dir --upgrade pip && \
rm -rf /var/cache/apt/lists

RUN python3.10 -m pip install --user --no-cache-dir 'nox-poetry==1.0.0'

COPY pyproject.toml poetry.lock /home/$USERNAME/
RUN cd /home/$USERNAME && \
poetry install --no-root --extras 'load-save vector ml'

# Build the wheel in an ephemeral stage to make it available to dask workers later!
FROM devcontainer as wheel-builder
ARG USERNAME

COPY . /home/$USERNAME/
WORKDIR /home/$USERNAME/

RUN poetry build --format wheel

# Dask worker stage
FROM ghcr.io/dask/dask:2022.8.0 AS dask-worker
ARG USERNAME

# store previous pwd
ENV DASK_WORKER_CWD="$PWD"

COPY --from=wheel-builder /home/$USERNAME/dist /home/$USERNAME/dist

RUN apt-get update -qy && \
apt-get install -qy --no-install-recommends \
# libpq-dev and build-essential are necessary for psycopg2, which is required for datacube
build-essential \
libpq-dev

# Find the prebuilt wheel and install its dependencies
RUN cd /home/$USERNAME/dist && \
pattern="*.whl" && \
files=( $pattern ) && \
export PIP_INSTALL_WHEEL="${files[0]}[dask-worker]" && \
pip install $PIP_INSTALL_WHEEL

# We need only the dependencies, so get rid of
RUN pip uninstall openeo-processes -y
16 changes: 11 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "openeo-processes-python",

"dockerFile": "./Dockerfile",
"dockerComposeFile": "./docker-compose.yml",

// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
"service": "workspace",

"workspaceFolder": "/openeo-processes-python",

// Set *default* container specific settings.json values on container create.
"settings": {
Expand All @@ -22,8 +23,13 @@
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
"ms-python.vscode-pylance",
"eamodio.gitlens"
],

"postCreateCommand": "poetry install"
"postCreateCommand": "poetry install --extras 'load-save vector ml'",

"remoteEnv": {
"GPG_TTY": "$(tty)`"
}
}
33 changes: 33 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: "3.1"

services:
workspace:
build:
context: ..
dockerfile: "./.devcontainer/Dockerfile"
target: devcontainer
tty: true
volumes:
- ../:/openeo-processes-python
environment:
- DASK_SCHEDULER_ADDRESS="tcp://scheduler:8786"

scheduler:
build:
context: ..
dockerfile: "./.devcontainer/Dockerfile"
target: dask-worker
hostname: scheduler
ports:
- "8786:8786"
- "8787:8787"
command: ["dask-scheduler"]

worker:
build:
context: ..
dockerfile: "./.devcontainer/Dockerfile"
target: dask-worker
command: ["dask-worker", "tcp://scheduler:8786"]
deploy:
replicas: 2
35 changes: 35 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
README.md
**/.mypy_cache
**/.pytest_cache
**/venv
**/.venv
**/.eggs
**/.github
**/.scripts
**/.idea
**/.nox
**/build
**/tests/data
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ TODO, will be installable through PyPI by the next release.
This project uses [poetry](https://github.com/python-poetry/poetry) to manage dependencies through virtual environments. The poetry CLI can be installed easily following the instructions in the [official documentation](https://python-poetry.org/docs/master/#installing-with-the-official-installer). Note that poetry is already installed and setup on the provided devcontainer.

To install this project and its dependencies into a fresh virtual environment run:
- `poetry install` to install all dependencies (core + development)
or
- `poetry install --no-dev` to install only the core dependencies
- `poetry install --extras "load-save vector ml"` to install all dependencies (core + development)
or select
- `poetry install`

Add the `--no-dev` flag to install without the dev-dependencies.

To add a dependency run `poetry add <PACKAGENAME>@<VERSION>`. Use the optional `--dev` flag to add it as a development dependency.
Note: When adding new dependencies, please do not pin to specific versions unless absolutely necessary (see discussion in #91). Usage of the caret-operator is preferred for specifying versions, this will allow versions to range up to the next major version (`^1.2.3` is equivalent to `>=1.2.3 <2.0.0`, see [poetry documentation on caret requirements](https://python-poetry.org/docs/master/dependency-specification#caret-requirements) for additional examples).
Expand Down
Loading