Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into plugin-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanPB committed Feb 5, 2024
2 parents 1afa78c + f0a32c5 commit 639672b
Show file tree
Hide file tree
Showing 21 changed files with 1,124 additions and 1,028 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.dockerignore
.venv
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: 'New version'
required: true

jobs:
update-and-build:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Update pyproject.toml version
run: |
sed -i "s/^version = .*/version = \"${{ github.event.inputs.version }}\"/" pyproject.toml
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git commit -am "ci: Version bump ${{ github.event.inputs.version }}"
git push
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and push Docker Image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64 #,linux/arm64 future ;)
push: true
tags: ${{ vars.DOCKER_IMAGE_NAME }}:${{ github.event.inputs.version }}, ${{ secrets.DOCKER_IMAGE_NAME }}:latest

- name: Push version bump commit
run: |
git tag ${{ github.event.inputs.version }}
git push origin ${{ github.event.inputs.version }}
git push
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.version }}
release_name: Release ${{ github.event.inputs.version }}
draft: false
prerelease: false
1 change: 1 addition & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ docs/build
.venv
dist
*~
.python-version
62 changes: 25 additions & 37 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,27 @@
FROM dssat/dssat-csm
FROM dssat/dssat-csm:v4.8.2.0

COPY . /app/pythia
RUN ln -sf /bin/bash /bin/sh && \
# install pre-reqs for pyenv installed pythons
apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git libspatialindex-dev && \
# setup pyenv
curl https://pyenv.run | bash && \
echo 'export PATH="/root/.pyenv/bin:/root/.local/bin:$PATH"' >> ~/.bashrc && \
echo 'eval "$(pyenv init -)"' >> ~/.bashrc && \
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc && \
export PATH="/root/.pyenv/bin:/root/.local/bin:$PATH" && \
eval "$(pyenv init -)" && \
eval "$(pyenv virtualenv-init i)" && \
# install python 3.7.9
pyenv install 3.7.9 && \
pyenv rehash && \
pyenv virtualenv 3.7.9 pythia-3.7.9 && \
pyenv activate pythia-3.7.9 && \
pip install --upgrade pip && \
pip install pipenv && \
# install dependencies
cd /app/pythia && \
pipenv install && \
echo "#!/bin/bash" > /app/pythia.sh && \
echo "" >> /app/pythia.sh && \
echo 'export PATH="/root/.pyenv/bin:/root/.local/bin:$PATH"' >> /app/pythia.sh && \
echo 'export PYENV_VIRTUALENV_DISABLE_PROMPT=1' >> /app/pythia.sh && \
echo 'eval "$(pyenv init -)"' >> /app/pythia.sh && \
echo 'eval "$(pyenv virtualenv-init -)"' >> /app/pythia.sh && \
echo "pyenv activate pythia-3.7.9" >> /app/pythia.sh && \
echo "python /app/pythia/pythia.py \$@" >> /app/pythia.sh && \
echo "pyenv deactivate" && \
chmod 755 /app/pythia.sh
RUN apt-get update && apt-get install -y \
python3.11 \
python3.11-dev \
python3-pip \
python3-venv \
python3-poetry \
python3-virtualenv \
curl \
gdal-bin=3.6.2+dfsg-1+b2 \
libgdal-dev=3.6.2+dfsg-1+b2 \
&& rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["/app/pythia.sh"]
CMD ["-h"]
ENV GDAL_VERSION 3.6.2
ENV C_INCLUDE_PATH=/usr/include/python3.11/cpython
ENV CPLUS_INCLUDE_PATH=/usr/include/python3.11/cpython

WORKDIR /app/pythia

COPY pyproject.toml poetry.toml poetry.lock ./
RUN POETRY_VIRTUALENVS_CREATE=false poetry install --no-interaction --no-ansi

COPY . ./
ENV PATH="${PATH}:/app/pythia/bin"

ENTRYPOINT ["pythia"]
5 changes: 3 additions & 2 deletions bin/pythia
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env sh
#!/usr/bin/env bash

python -m pythia $@
source .venv/bin/activate
python3 -m pythia $@
2 changes: 1 addition & 1 deletion docs/about.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
What is Pythia?
===============

Pythia is a simple framework to assist users in running DSSAT over a spatial area based on grid points. Pythia can use any DSSAT v4.7 build. The inputs to the framework are:
Pythia is a simple framework to assist users in running DSSAT over a spatial area based on grid points. Pythia can use any DSSAT v4.7 build or greater. The inputs to the framework are:

- A JSON configuration file
- Shape files
Expand Down
19 changes: 9 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,23 @@

# -- Project information -----------------------------------------------------

project = 'Pythia'
copyright = '2020, DSSAT Foundation'
author = 'Christopher Villalobos'
project = "Pythia"
copyright = "2020 - 2022, DSSAT Foundation"
author = "Christopher Villalobos"

# The full version, including alpha/beta/rc tags
release = '1.0.0'
release = "1.0.0"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
]
extensions = []

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand All @@ -47,15 +46,15 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# -- RTD Settings -------------------------------------------------------------

# It seems that RTD needs to have this set in order for the build to occur.
#
master_doc = 'index'
master_doc = "index"
39 changes: 0 additions & 39 deletions guide.adoc

This file was deleted.

Loading

0 comments on commit 639672b

Please sign in to comment.