Skip to content

Commit

Permalink
Merge pull request #32 from SwamyDev/master
Browse files Browse the repository at this point in the history
Removes pyscaffold and updates readme with new development environment instructions and examples
  • Loading branch information
bbauerma committed Aug 8, 2023
2 parents 0d84b8c + 641ec95 commit 52baa83
Show file tree
Hide file tree
Showing 26 changed files with 423 additions and 399 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/snippets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Formatting and Snippets
on:
push:
jobs:
format_and_snippets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run MarkdownSnippets
run: |
dotnet tool install --global MarkdownSnippets.Tool
mdsnippets ${GITHUB_WORKSPACE}
shell: bash
- name: Git Commit and Push
uses: github-actions-x/commit@v2.9
with:
github-token: "${secrets.GITHUB_TOKEN}"
commit-message: "d updated markdown snippets"
rebase: 'true'
push-branch: 'master'
name: github actions
email: actions@github.com
19 changes: 6 additions & 13 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest"]
python-version: ['3.8', '3.9']
python-version: ['3.8', '3.9', '3.10']
ymlfile: ['environment.yml']
name: Py${{ matrix.python-version }} @ ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -27,7 +27,7 @@ jobs:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
environment-file: ${{ matrix.ymlfile }}
activate-environment: equi7grid_env
activate-environment: equi7grid
auto-activate-base: false
- name: Print infos
shell: bash -l {0}
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Install package and test
shell: bash -l {0}
run: |
pip install -e .
pip install -e .[testing]
pytest --cache-clear
- name: Upload Coverage
shell: bash -l {0}
Expand All @@ -64,16 +64,9 @@ jobs:
shell: bash -l {0}
run: |
git status
pip install setuptools_scm
if [ ${{ matrix.os }} == "windows-latest" ]
then
# build whls on windows
pip install wheel
python setup.py bdist_wheel --dist-dir .artifacts/dist
else
# build dist on linux
python setup.py sdist --dist-dir .artifacts/dist
fi
make dist
# build dist on linux
python setup.py sdist --dist-dir .artifacts/dist
ls .artifacts/dist
- name: Upload Artifacts
uses: actions/upload-artifact@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upload_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Build and Upload to pypi
run: |
python setup.py sdist bdist_wheel
make dist
python -m twine upload dist/*
env:
TWINE_USERNAME: __token__
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ on:
- cron: '0 0 * * *' # daily

env:
GDAL_DATA: C:\Miniconda3\envs\equi7grid_env\Library\share\gdal
PROJ_LIB: C:\Miniconda3\envs\equi7grid_env\Library\share\proj
GDAL_DRIVER_PATH: C:\Miniconda3\envs\equi7grid_env\Library\bin
PROJ_LIB: C:\Miniconda3\envs\equi7grid\Library\share\proj
USE_PATH_FOR_GDAL_PYTHON: YES

jobs:
build:
strategy:
matrix:
os: ["windows-latest"]
python-version: ['3.8', '3.9']
ymlfile: ['environment.yml']
python-version: ['3.8', '3.9', '3.10']
ymlfile: ['environment_win.yml']
name: Py${{ matrix.python-version }} @ ${{ matrix.os }}
runs-on: ${{ matrix.os }}

Expand All @@ -31,8 +30,8 @@ jobs:
miniconda-version: "latest"
auto-update-conda: true
python-version: ${{ matrix.python-version }}
environment-file: environment.yml
activate-environment: equi7grid_env
environment-file: environment_win.yml
activate-environment: equi7grid
auto-activate-base: false
- name: Print infos
shell: bash -l {0}
Expand All @@ -43,8 +42,9 @@ jobs:
pip list
which pip
which python
which gdalwarp
- name: Install package and test
shell: bash -l {0}
run: |
pip install -e .
pip install -e .[testing]
pytest --cache-clear
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ cover/*
MANIFEST
/Equi7Grid.egg-info/
/equi7grid/Equi7Grid_old.py

venv/
63 changes: 63 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
.ONESHELL:
SHELL = /bin/bash

.PHONY: help clean environment install test version dist

CONDA_ENV_DIR = $(shell conda info --base)/envs/equi7grid
CONDA_ACTIVATE = source $$(conda info --base)/etc/profile.d/conda.sh ; conda activate ; conda activate
TEST_ENV =

help:
@echo "make clean"
@echo " clean all python build/compilation files and directories"
@echo "make venv"
@echo " create the base virtualenv environment for the project"
@echo "make conda"
@echo " create the base conda environment for the project"
@echo "make test"
@echo " run test with coverage"
@echo "make version"
@echo " update _version.py with current version tag"
@echo "make dist"
@echo " build the package ready for distribution and update the version tag"

clean:
find . -name '*.pyc' -exec rm --force {} +
find . -name '*.pyo' -exec rm --force {} +
find . -name '*~' -exec rm --force {} +
rm --force .coverage
rm --force --recursive .pytest_cache
rm --force --recursive build/
rm --force --recursive dist/
rm --force --recursive *.egg-info

$(CONDA_ENV_DIR):
@echo "creating new base equi7grid conda environment..."
conda create -y -c conda-forge -n equi7grid python=3.10 pip mamba
$(CONDA_ACTIVATE) equi7grid
mamba install -y -c conda-forge gdal numpy scipy
if [ $(TEST_ENV) ]; then pip install -e .[testing]; else pip install -e .; fi
@echo "... finished."

conda: $(CONDA_ENV_DIR)
@echo -e "conda environment is ready. To activate use:\n\tconda activate equi7grid"

venv/bin/activate:
@echo "creating new base equi7grid virtualenv environment..."
python3 -m venv venv
source venv/bin/activate; pip install pygdal=="$(shell gdal-config --version).*"; if [ $(TEST_ENV) ]; then pip install -e .[testing]; else pip install -e .; fi
@echo "... finished."

venv: venv/bin/activate
@echo -e "virtualenv environment is ready. To activate use:\n\tsource venv/bin/activate"

test:
pytest -rsx --verbose --color=yes --cov=equi7grid --cov-report term-missing

version:
echo -e "__version__ = \"$(shell git describe --always --tags --abbrev=0)\"\n__commit__ = \"$(shell git rev-parse --short HEAD)\"" > src/equi7grid/_version.py

dist: version
pip3 install build twine
python3 -m build

0 comments on commit 52baa83

Please sign in to comment.