Skip to content

Commit

Permalink
Merge branch 'main' into planet
Browse files Browse the repository at this point in the history
  • Loading branch information
12rambau authored Dec 11, 2022
2 parents 875c38b + 3e9e2d3 commit 57f60a5
Show file tree
Hide file tree
Showing 76 changed files with 1,304 additions and 1,184 deletions.
45 changes: 26 additions & 19 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@ on:
- workflow_dispatch

env:
EE_DECRYPT_KEY: ${{ secrets.EE_DECRYPT_KEY }}
PLANET_API_CREDENTIALS: '${{ secrets.PLANET_API_CREDENTIALS }}'
#EE_DECRYPT_KEY: ${{ secrets.EE_DECRYPT_KEY }}
PLANET_API_CREDENTIALS: ${{ secrets.PLANET_API_CREDENTIALS }}
PLANET_API_KEY: ${{ secrets.PLANET_API_KEY }}
EARTHENGINE_TOKEN: ${{ secrets.EARTHENGINE_TOKEN }}
#SKIP: isort

jobs:

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- uses: pre-commit/[email protected]

build:
runs-on: ubuntu-latest
strategy:
Expand All @@ -18,10 +30,10 @@ jobs:
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -37,15 +49,8 @@ jobs:
- name: Install dependencies
run: pip install .[test]

- name: Test formatting
uses: psf/black@stable
with:
version: "22.3.0"

- name: PEP8 rules
uses: tonybajan/[email protected]
with:
repotoken: ${{ secrets.GITHUB_TOKEN }}
- name: Set up GEE credentials
run: ee_token

- name: build the documentation
if: matrix.python-version == '3.8'
Expand All @@ -67,23 +72,25 @@ jobs:
assert len(unexpected) == 0
- name: test with pytest
run: coverage run -m pytest --color=yes tests
run: pytest --color=yes --cov --cov-report=xml --instafail tests

- name: assess dead fixtures
if: matrix.python-version == '3.8'
run: pytest --dead-fixtures

- name: build the template panel application
if: matrix.python-version == '3.8'
run: |
pytest --nbmake sepal_ui/templates/panel_app/ui.ipynb
run: pytest --nbmake sepal_ui/templates/panel_app/ui.ipynb

- name: build the template map application
if: matrix.python-version == '3.8'
run: |
pytest --nbmake sepal_ui/templates/map_app/ui.ipynb
run: pytest --nbmake sepal_ui/templates/map_app/ui.ipynb

- name: coverage
run: coverage xml

- name: codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# custom
.coverage

ee_private_key.json
warnings.txt

Expand Down
72 changes: 46 additions & 26 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,24 @@ The tool is currently tranlated in the following languages:

English, Français, Español

You can contribute to the translation effort on our `pontoon project <https://sepal-ui-translation.herokuapp.com/projects/sepal-ui/>`__. Contributors can suggest new languages and new translation. The admin will review this modification as fast as possible. If nobody in the core team master the suggested language, we'll be force to trust you !
You can contribute to the translation effort on our `crowdin project <https://crowdin.com/project/sepal-ui/>`__. Contributors can suggest new languages and new translation. The admin will review this modification as fast as possible. If nobody in the core team master the suggested language, we'll be force to trust you !


Develop within the project
--------------------------

Since 2020-08-14, this repository follows these `development guidelines <https://nvie.com/posts/a-successful-git-branching-model/>`_. The git flow is thus the following:

.. figure:: https://nvie.com/img/[email protected]
:alt: the Git branching model
:width: 70%
.. figure:: https://raw.githubusercontent.com/12rambau/sepal_ui/links/docs/source/_image/branching_system.png
:alt: the Git branching model

The git branching model

Please consider using the :code:`--no-ff` option when merging to keep the repository consistent with PR.

In the project to adapt to :code:`JupyterLab` IntelSense, we decided to explicitly write the `return` statement for every function.
In the project to adapt to :code:`JupyterLab` IntelSense, we decided to explicitly write the ``return`` statement for every function.

As we are holding a single documentation page, we need to provide the users with version informations. When a new function or class is created please use the `Deprecated <https://pypi.org/project/Deprecated/>`__ lib to specify that the feature is new in the documentation.
When a new function or class is created please use the `Deprecated <https://pypi.org/project/Deprecated/>`__ lib to specify that the feature is new in the documentation.

.. code-block:: python
Expand Down Expand Up @@ -79,13 +78,13 @@ You can learn more about Conventional Commits following this `link <https://www.
What can I push and where
-------------------------

Our branching system embed some rules to avoid crash of the production environment. If you want to contribute to this framework, here are some basic rules that we try our best to follow :
Our branching system embed some rules to avoid crash of the production environment. If you want to contribute to this framework, here are some basic rules that we try our best to follow:

- the modification you offer is solving a critical bug in prod : **PR in hotfix**
- the modification you propose solve the following issues : test, documentation, typo, quality, refactoring, translation **PR in master**
- the modification you propose is a new feature : open an issue to discuss with the maintainers and then **PR to develop**
- the modification you offer is solving a critical bug in prod : **PR in main**
- the modification you propose solve the following issues : test, documentation, typo, quality, refactoring, translation **PR in main**
- the modification you propose is a new feature : open an issue to discuss with the maintainers and then **PR to main**

the maintainers will try their best to use PR for new features, to help the community follow the development, for other modification they will simply push to the appropriate branch
the maintainers will try their best to use PR for new features, to help the community follow the development, for other modification they will simply push to the appropriate branch.

Create a new release
--------------------
Expand All @@ -108,23 +107,22 @@ It should modify for you the version number in :code:`sepal_ui/__init__.py`, :co

It will also update the :code:`CHANGELOG.md` file with the latest commits, sorted by categories if you run the following code, using the version bumped in the previous commit.

.. code-block:: console
.. danger::

cz changelog --unreleased-version="v_x.x.x"
As long as https://github.com/commitizen-tools/commitizen/issues/463 remains open, the version names of this repository won't work with the commitizen lib and the changelog won't be updated. As a maintainer you need to clone the project and follow the instruction from https://github.com/commitizen-tools/commitizen/issues/463#issuecomment-1191653690.

Then push the current :code:`master` branch to the :code:`release` branch. You can now create a new tag with your new version number. use the same convention as the one found in :code:`.cz.yaml`: :code:`v_$minor.$major.$patch$prerelease`.
Then push the current :code:`main` branch to the :code:`release` branch. You can now create a new tag with your new version number. use the same convention as the one found in :code:`.cz.yaml`: :code:`v_$minor.$major.$patch$prerelease`.

.. warning::

The target branch of the new release is :code:`release` not :code:`master`.
The target branch of the new release is :code:`release` not :code:`main`.

The CI should take everything in control from here and execute the :code:`Upload Python Package` GitHub Action that is publishing the new version on `PyPi <https://badge.fury.io/py/sepal-ui>`_.
The CI should take everything in control from here and execute the :code:`Upload Python Package` GitHub Action that is publishing the new version on `PyPi <https://pypi.org/project/sepal-ui/>`_.

Once it's done you need to trigger the rebuild of SEPAL. modify the following `file <https://github.com/openforis/sepal/blob/master/modules/sandbox/docker/script/init_sepal_ui.sh>`_ with the latest version number and the rebuild will start automatically.


Setting ENV variables
---------------------
ENV for Planet components
-------------------------

Sometimes is useful to create enviromental variables to store some data that your workflows will receive (i.e. component testing). For example, to perform the local tests of the :code:`planetapi` sepal module, the :code:`PLANET_API_KEY` and :code:`PLANET_API_CREDENTIALS` env vars are required, even though they are also skippable.

Expand All @@ -134,17 +132,39 @@ To store a variable in your local session, just type :code:`export=` followed by
$ export PLANET_API_KEY="neverending_resourcesapi"
However, this variable will expire everytime you start a new session, to create it every session and make it live longer, go to your :code:`home` folder and save the previous line in the :code:`.bash_profile` file.
.. tip::

.. code-block:: console
In SEPAL this variable will expire everytime you start a new session, to create it every session and make it live longer, go to your :code:`home` folder and save the previous line in the :code:`.bash_profile` file.

.. code-block:: console
$ vim .bash_profile
$ vim .bash_profile
The current enviromental keys and its structure is the following:

.. note::
The current enviromental keys and its structure is the following:
- ``PLANET_API_CREDENTIALS='{"username": "[email protected]", "password": "secure"}'``
- ``PLANET_API_KEY="string_planet_api_key"``

ENV for GEE component
---------------------

- PLANET_API_CREDENTIALS: '{"username": "[email protected]", "password": "secure"}'
- PLANET_API_KEY: "string_planet_api_key"
To test/use the Google EarthEngine components, you need to run the `ìnit__ee`` script.

In a local development environment you can fully rely on your own GEE account. simply make sure to run at least once the authentification process from a terminal:

.. code-block:: console
$ earthengine authenticate
In a distant environment (such as GitHub Actions) it is compulsory to use a environment variable to link your earthengine account. First, find the Earth Engine credentials file on your computer.

.. code-block::
Windows: C:\Users\USERNAME\.config\earthengine\credentials
Linux: /home/USERNAME/.config/earthengine/credentials
MacOS: /Users/USERNAME/.config/earthengine/credentials
Open the credentials file and copy its content. On the **GitHub Actions** page, create a new **secret** with the name ``EARTHENGINE_TOKE``, and the value of the copied content.

Build the API documentation files
---------------------------------
Expand Down
11 changes: 9 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,18 @@ You can contribute to the translation effort on our `crowdin project <https://cr
:code:`sepal_ui` is a lib designed to create elegant python based dashboard in the `SEPAL environment <https://sepal.io/>`__. It is designed on top of the amazing `ipyvuetify <https://ipyvuetify.readthedocs.io/en/latest/introduction.html>`_ library and will help developer to easily create interface for their workflows.
By using this libraries, you'll ensure a robust and unified interface for your scripts and a easy and complete integration into the SEPAL dashboard of application.

The full documentation is available `here <https://sepal-ui.readthedocs.io/en/latest/>`__ and a demo app can be launched on Heroku following this link: `<https://sepal-ui.herokuapp.com>`__.
The full documentation is available `here <https://sepal-ui.readthedocs.io/en/latest/>`__ and demo apps can be launched on Heroku following these links:

- `Map style application <https://sepal-map-app.herokuapp.com>`__
- `Panel style application <https://sepal-panel-app.herokuapp.com>`__

We are happy to receive feedback and we welcome any kind of contribution.

.. image:: https://raw.githubusercontent.com/12rambau/sepal_ui/master/docs/source/_image/sepal_ui_screenshot.png
.. image:: https://raw.githubusercontent.com/12rambau/sepal_ui/links/docs/source/_image/demo-map-app.png
:width: 49%

.. image:: https://raw.githubusercontent.com/12rambau/sepal_ui/links/docs/source/_image/demo-panel-app.png
:width: 49%

Contribute
----------
Expand Down
Binary file added docs/source/_image/branching_system.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_image/demo-map-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_image/demo-panel-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/source/_image/sepal_ui_screenshot.png
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@
{
"name": "GitHub",
"url": "https://github.com/12rambau/sepal_ui",
"icon": "fab fa-github",
"icon": "fa-brands fa-github",
},
{
"name": "Pypi",
"url": "https://pypi.org/project/sepal-ui/",
"icon": "fab fa-python",
"icon": "fa-brands fa-python",
},
],
}
Expand Down
7 changes: 5 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ You can contribute to the translation effort on our `crowdin project <https://cr
:code:`sepal_ui` is a lib designed to create elegant python based dashboard in the SEPAL environment. It is designed on top of the amazing `ipyvuetify <https://ipyvuetify.readthedocs.io/en/latest/introduction.html>`_ library and will help developer to easily create interface for their workflows.
By using this libraries, you'll ensure a robust and unified interface for your scripts and a easy and complete integration into the SEPAL dashboard of application.

A demo app can be launched on Heroku following this link: `<https://sepal-ui.herokuapp.com>`__.
Demo apps can be launched on Heroku following these links:

- `Map style app <https://sepal-map-app.herokuapp.com>`__
- `Panel style app <https://sepal-panel-app.herokuapp.com>`__

We are happy to receive feedback and we welcome any kind of contribution.

.. image:: https://raw.githubusercontent.com/12rambau/sepal_ui/master/docs/source/_image/sepal_ui_demo.gif
.. image:: https://raw.githubusercontent.com/12rambau/sepal_ui/main/docs/source/_image/sepal_ui_demo.gif

Contribute
----------
Expand Down
7 changes: 5 additions & 2 deletions docs/source/start/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ Getting started
:code:`sepal_ui` is a lib designed to create elegant python based dashboard in the SEPAL environment. It is designed on top of the amazing `ipyvuetify <https://ipyvuetify.readthedocs.io/en/latest/introduction.html>`_ library and will help developer to easily create interface for their workflows.
By using this libraries, you'll ensure a robust and unified interface for your scripts and a easy and complete integration into the SEPAL dashboard of application.

The full documentation is available `here <https://sepal-ui.readthedocs.io/en/latest/>`__ and a demo app can be launched on Heroku following this link: `<https://sepal-ui.herokuapp.com>`__.
The full documentation is available `here <https://sepal-ui.readthedocs.io/en/latest/>`__ and a demo apps can be launched on Heroku following these links:

- `Map style application <https://sepal-map-app.herokuapp.com>`__
- `Panel style application <https://sepal-panel-app.herokuapp.com>`__

We are happy to receive feedback and we welcome any kind of contribution.

.. image:: https://raw.githubusercontent.com/12rambau/sepal_ui/master/docs/source/_image/sepal_ui_demo.gif
.. image:: https://raw.githubusercontent.com/12rambau/sepal_ui/main/docs/source/_image/sepal_ui_demo.gif

Table of content
----------------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorials/add-tile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ in the :code:`app_items` list, add a :code:`DrawerItem` corresponding to your ti
# [...]
sw.DrawerItem(
title = ms.app.drawer_item.aoi,
icon 'fas fa-cogs', # optional
icon 'fa-solid fa-cogs', # optional
card="my_tile"
)
]
Expand Down
8 changes: 4 additions & 4 deletions docs/source/tutorials/custom-widget.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Here we will create the object with its expected attributes
def __init__(self, label="Password", **kwargs):
# create the eye icon
self.eye = v.Icon(class_ = 'ml-1', children=['fas fa-eye'])
self.eye = v.Icon(class_ = 'ml-1', children=['fa-solid fa-eye'])
# create the texfied
self.text_field = v.TextField(
Expand Down Expand Up @@ -123,7 +123,7 @@ Toggle visibility

Now we want to add a behavior to our object. When we click on the eye, the :code:`PasswordField` should toggle its visibility:

* The eye should switch from :code:`fas fa-eye` and :code:`fas fa-eye-slash`
* The eye should switch from :code:`fa-solid fa-eye` and :code:`fa-solid fa-eye-slash`
* The text_field should switch from type :code:`password` to :code:`text`

To do so we will first add 2 class static variable (caps lock) to list the 2 types and icon and set them on the two attributes of my class. a new attribute needs to be created to remind the current state of the password.
Expand All @@ -138,7 +138,7 @@ I'll call it :code:`password_viz` as the :code:`viz` parameter is already an att
class PasswordField(sw.SepalWidget, v.Layout):
EYE_ICONS = ['fas fa-eye', 'fas fa-eye-slash'] # new icon list
EYE_ICONS = ['fa-solid fa-eye', 'fa-solid fa-eye-slash'] # new icon list
TYPES = ['password', 'text'] # new type list
def __init__(self, label="Password", **kwargs):
Expand Down Expand Up @@ -224,7 +224,7 @@ finally we obtain the following reusable widget :
class PasswordField(sw.SepalWidget, v.Layout):
EYE_ICONS = ['fas fa-eye', 'fas fa-eye-slash'] # new icon list
EYE_ICONS = ['fa-solid fa-eye', 'fa-solid fa-eye-slash'] # new icon list
TYPES = ['password', 'text'] # new type list
def __init__(self, label="Password", **kwargs):
Expand Down
10 changes: 5 additions & 5 deletions docs/source/widgets/btn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Overview
--------

:code:`Btn` is custom widget to provide easy to use button in the sepal_ui framework. it inherits from the :code:`SepalWidget` class.
Any argument from the original :code:`Btn` ipyvuetify class can be used to complement it. The button icon needs to be searched in the `fontAwesome library <https://fontawesome.com/v5.15/icons>`__ or mdi library <https://materialdesignicons.com>`_, if none is set, a :code:`fas fa-check` will be used.
Any argument from the original :code:`Btn` ipyvuetify class can be used to complement it. The button icon needs to be searched in the `fontAwesome library <https://fontawesome.com/icons>`__ or mdi library <https://materialdesignicons.com>`_, if none is set, a :code:`fa-solid fa-check` will be used.
The default color is set to "primary".

.. jupyter-execute::
Expand All @@ -20,8 +20,8 @@ The default color is set to "primary".
v.theme.dark = False

btn = sw.Btn(
text = "The One btn",
icon = "fas fa-cogs"
msg = "The One btn",
gliph = "fa-solid fa-cogs"
)
btn

Expand All @@ -42,8 +42,8 @@ Btn can be used to launch function on any Javascript event such as "click".
v.theme.dark = False

btn = sw.Btn(
text = "The One btn",
icon = "fas fa-cogs"
msg = "The One btn",
gliph = "fa-solid fa-cogs"
)
btn.on_event('click', lambda *args: print('Hello world!'))
Expand Down
Loading

0 comments on commit 57f60a5

Please sign in to comment.