Skip to content

Commit

Permalink
Merge pull request #77 from fccoelho/remove_demography
Browse files Browse the repository at this point in the history
Remove demography
  • Loading branch information
fccoelho authored Jul 13, 2022
2 parents 3af7296 + 0c3e942 commit c2060ed
Show file tree
Hide file tree
Showing 26 changed files with 416 additions and 4,959 deletions.
38 changes: 16 additions & 22 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: tests

name: Python package

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
python-version: ["3.9"]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v2

- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
mamba-version: "*"
environment-file: environment.yaml
channels: conda-forge
environment-file: conda/environment.yaml
channels: conda-forge,nodefaults
activate-environment: env-pysus
use-mamba: true
miniforge-variant: Mambaforge
Expand All @@ -37,17 +36,12 @@ jobs:
- name: Lint with flake8
run: |
make lint
make check-codestyle
- name: build and deploy jupyterlab
run: |
make run_jupyter_pysus
make run-jupyter-pysus
- name: run tests for notebooks on container
- name: Test with pytest
run: |
make test_jupyter_pysus
# - name: Test with pytest
# shell: bash -l {0}
# run: |
# make test
make test
69 changes: 42 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,54 @@ help:
DOCKER = docker-compose -p pysus -f docker/docker-compose.yaml
SERVICE :=

# Docker basic
run_jupyter_pysus: ## build and deploy all containers

#* Installation
.PHONY: install
install: clean ## install the package to the active Python's site-packages
python setup.py install

.PHONY: pre-commit-install
develop-install: clean ## install the package in development mode
pip install -e '.[dev]'
pre-commit install

#* Linting
.PHONY: check-codestyle
check-codestyle: ## check style with flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

#* Docker basic
.PHONY: run-jupyter-pysus
run-jupyter-pysus: ## build and deploy all containers
$(DOCKER) up -d --build

down_jupyter_pysus: ## stop and remove containers for all services
.PHONY: down-jupyter-pysus
down-jupyter-pysus: ## stop and remove containers for all services
$(DOCKER) down -v --remove-orphans

test_jupyter_pysus: ## run pytest for notebooks inside jupyter container
#* Tests
.PHONY: test-jupyter-pysus
test-jupyter-pysus: ## run pytest for notebooks inside jupyter container
$(DOCKER) exec -T jupyter bash /test_notebooks.sh

.PHONY: test
test: ## run tests quickly with the default Python
py.test

coverage: ## check code coverage quickly with the default Python
coverage run --source pysus/tests/ -m pytest
coverage report -m
coverage html
$(BROWSER) htmlcov/index.html

# Cleaning
.PHONY: clean
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts

.PHONY: clean-build
clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
Expand All @@ -44,37 +80,16 @@ clean-build: ## remove build artifacts
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +


.PHONY: clean-pyc
clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

.PHONY: clean-test
clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache

lint: ## check style with flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

install: clean ## install the package to the active Python's site-packages
python setup.py install

develop: clean ## install the package in development mode
pip install -e '.[dev]'
pre-commit install

test: ## run tests quickly with the default Python
py.test

coverage: ## check code coverage quickly with the default Python
coverage run --source pysus/tests/ -m pytest
coverage report -m
coverage html
$(BROWSER) htmlcov/index.html
9 changes: 1 addition & 8 deletions environment.yaml → conda/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@ channels:
- conda-forge
- nodefaults
dependencies:
- docker-compose
- jupyterlab
- nodejs
- cffi>=1.0.0
- dbfread
- geocoder
- requests
- folium
- fastparquet
- geopandas
- dask
- wget
- colorcet
- datashader
- xarray
- georasters
- elasticsearch
- pyarrow
# dev
Expand All @@ -32,6 +27,4 @@ dependencies:
- numba
- pip:
- nbmake
- geobr
- facets-overview
- pysus
2 changes: 0 additions & 2 deletions condarecipe/pysus/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ requirements:
- pip
- python
- requests
- georasters
run:
- cffi >=1.0.0
- dbfread
Expand All @@ -33,7 +32,6 @@ requirements:
- pyarrow
- python
- requests
- georasters
- elasticsearch

test:
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ENV HOME /home/developer
ENV APP_TMP_DATA=/tmp

# Copy environment file to tmp/
COPY environment.yaml ${APP_TMP_DATA}/environment.yaml
COPY conda/environment.yaml ${APP_TMP_DATA}/environment.yaml
# Executable in a container to be owned by the root user
COPY docker/test_notebooks.sh /test_notebooks.sh
COPY docker/entrypoint.sh /entrypoint.sh
Expand Down
Loading

0 comments on commit c2060ed

Please sign in to comment.