Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dfguerrerom committed Nov 9, 2021
0 parents commit 72a185a
Show file tree
Hide file tree
Showing 26 changed files with 726 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.ipynb filter=jupyternotebook
3 changes: 3 additions & 0 deletions .gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[filter "jupyternotebook"]
clean = jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace %f
required
129 changes: 129 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# 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/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# 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/

# 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
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.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

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__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/
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
default_language_version:
python: python3

repos:
- repo: https://github.com/psf/black
rev: 8a59528c2d8ae1ef5f366039c728614aaf1a470b
hooks:
- id: black
- id: black-jupyter
- repo: https://github.com/kynan/nbstripout
rev: 0.5.0
hooks:
- id: nbstripout
30 changes: 30 additions & 0 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SEPAL_UI_TEMPLATE

First off, thank you for considering contributing to the development of this module. It's people like you that make SEPAL a living platform. If it's your first time contributing on a github project take a look at this [link](http://makeapullrequest.com/) to better understand what a PR is.

Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue, assessing changes, and helping you finalize your pull requests.

This module is an open source project and we love to receive contributions from our community — you! There are many ways to contribute, from writing tutorials in google Classroom, improving the documentation, submitting bug reports and feature requests or writing code which can be incorporated into the module itself.

## set up your environment

SEPAL modules are of course meant to work on the sepal plateform so you should use the same [requirements](https://github.com/openforis/sepal/blob/master/modules/geospatial-toolkit/docker/config/requirements.txt) as we use on the prod platform if you work locally. But of course the easyest way is to work directly from [SEPAL](https://sepal.io) !

> don't forget to use the `earthengine authenticate` command to connect to your GEE account.
To develop in this project first fork the module in your own github repositories and clone the repository with a terminal:

```
$ git clone https://github.com/12rambau/sepal_ui_template.git
```

## how to work with the issue tracker

If you find yourself wishing for a feature that doesn't exist in this module, you are probably not alone. There should be others out there with similar needs. Many of the features that the module provide today have been added because our users saw the need. Open an issue on our issues list on GitHub which describes the feature you would like to see, why you need it, and how it should work.

As a contributor you can also send PR (pull request) to solve issues tagged as "help wanted" or small correction (typo, documentation improvement, examples). For bigger contributions or new fonctionnalities please open an issue and discuss with our team before sending PR.

## code guidelines

We try our best to follow the [PEP 8](https://www.python.org/dev/peps/pep-0008/) rules for python coding.
This module is develop within the framework of the `sepal-ui` lib, check out its [documentation](https://sepal-ui.readthedocs.io/en/latest/) to better understand the design guidelines.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Food and Agriculture Organization of the United Nations (FAO)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
![sepal_ui template](https://raw.githubusercontent.com/openforis/sepal-doc/master/docs/source/img/sepal_header.png)

# sepal_ui template app

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/12rambau/sepal_ui_template/blob/no_default/LICENSE)
[![Black badge](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

## About

Fake application using the `sepal_ui` framework to create an interactive **Voila** dashboard.
Go to the [sepal_ui repository](https://github.com/12rambau/sepal_ui) for more information about the components used in this template.

![full_app](./doc/img/full_app.png)

## Usage

This template is bound to the `module_factory` from the [sepal_ui](https://github.com/12rambau/sepal_ui) lib but it can also be used as a stand-alone app.

to install it simply use :
```
$ earthengine authenticate
$ git clone https://github.com/12rambau/sepal_ui_template.git
$ cd sepal_ui_template
$ git config --local include.path ../.gitconfig
77 changes: 77 additions & 0 deletions about_ui.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from sepal_ui import sepalwidgets as sw"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# create the Html body of your about section\n",
"about_tile = sw.TileAbout(\"utils/ABOUT.md\") # relative path to your markdown file"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# create the html body of the FAO disclaimer\n",
"# its mother class is sw.Tile so you can still replace it with another message if you want (discouraged)\n",
"disclaimer_tile = sw.TileDisclaimer()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# this tile will only be displayed if this very notebook is launched\n",
"# usefull for debugging\n",
"about_tile"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# this tile will only be displayed if this very notebook is launched\n",
"# usefull for debugging\n",
"disclaimer_tile"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
19 changes: 19 additions & 0 deletions component/message/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os
from pathlib import Path

from sepal_ui.translator import Translator

# the sepal_ui allows you to create a translation interface
# at the moment this variable is not yet available but it's a good practice to build your app translatio-ready

# first select the language env variable to load the destination locale
# it will default to en
lang = "en"
if "CUSTOM_LANGUAGE" in os.environ:
lang = os.environ["CUSTOM_LANGUAGE"]

# create a ms object that will be used to translate all the messages
# the base language is english and every untranslated messages will be fallback to the english key
# complete the json file the add keys in the app
# avoid hard written messages at all cost
cm = Translator(Path(__file__).parent, lang)
10 changes: 10 additions & 0 deletions component/message/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"not_translated": "this message only exist in the en dict",
"app": {
"title": "My Fake module",
"footer": "The sky is the limit \u00A9 {}",
"drawer_item": {
"about": "About"
}
}
}
9 changes: 9 additions & 0 deletions component/message/fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"app": {
"title": "Mon faux module",
"footer": "vers l'infini et au-delà \u00A9 {}",
"drawer_item": {
"about": "A propos"
}
}
}
Loading

0 comments on commit 72a185a

Please sign in to comment.