Skip to content

Commit

Permalink
Update branch with master
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnvanhoey committed Oct 16, 2024
2 parents 53523ac + 288b351 commit af53a0e
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 50 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/tests-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@ on:
jobs:
windows-conda-tests:
runs-on: "windows-latest"
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
environment-file:
- name: Checkout
uses: actions/checkout@v4
- name: PowerShell
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
channels: conda-forge
channel-priority: true
- name: Run unit tests
shell: powershell
run: |
conda config --add channels conda-forge
conda config --set channel_priority strict
conda install pandas=1.5.3 pyyaml rasterio fiona
pip install -e .
pip install . --no-deps
pip install -r dev-requirements.txt coverage
pytest --cov niche_vlaanderen --cov-report xml --verbose --tb=long
- name: Upload coverage
Expand All @@ -31,14 +35,15 @@ jobs:
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_PARALLEL: true

linux-pip-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
fail-fast: [false]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down
76 changes: 36 additions & 40 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Windows
=======

The recommended way of installing niche_vlaanderen on windows uses miniconda_ for installation.
The recommended version is `64 bit with Python 3.9`__.
The currently recommended version is `64 bit with Python 3.11`__.

__ https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Windows-x86_64.exe
.. _Miniconda: https://conda.io/miniconda.html
__ https://repo.anaconda.com/miniconda/Miniconda3-py311_24.7.1-0-Windows-x86_64.exe
.. _Miniconda: https://docs.anaconda.com/miniconda/

The installation can proceed without administrator rights, keep the default options. After miniconda is installed,
we will proceed installing niche_vlaanderen in its own environment.
Expand All @@ -24,42 +24,57 @@ You will probably see something as:
OR
(base) C:\Users\myusername>
Create an environment (called niche in this example) that will contain niche_vlaanderen and its dependencies:
For the remainder, we use ``(<CONDA-ENV-NAME>) C:\>`` to indicate the prompt.

.. code-block:: shell
.. Note::
If you do not use the installation of Miniconda with the default Python version of 3.11
(i.e. the python version in your ``base`` environment is not Python 3.11), you can still
create an environment with Python 3.11 by running the following command::

(C:\Users\myusername\Miniconda3) C:\Users\myusername> conda create --name niche
(base) C:\> conda create -n py311 python=3.11
(base) C:\> conda activate py311
(py311) C:\>

Activate the niche environment:
By running the commands below from ``py311`` environment instead of ``base``, you will also install niche_vlaanderen in an environment
`niche` with Python 3.11.

To install packages, conda used a dependency resolver. Make sure the ``libmamba`` solver is activated by running
the following commands in the command prompt:

.. code-block:: shell
(C:\Users\myusername\Miniconda3) C:\Users\myusername> conda activate niche
(base) C:\> conda config --show-sources
(base) C:\> conda config --set solver libmamba
You will see that `(C:\\Users\\myusername\\Miniconda3)`/`(base)` will change into `(niche)`.
Once the correct solver is set, create an environment (called ``niche``) that will contain niche_vlaanderen and its dependencies:

.. code-block:: shell
(base) C:\> conda env create -f environment.yml
Now install the niche_vlaanderen package and its dependencies within the niche environment:
Activate the niche environment:

.. code-block:: shell
(niche) C:\Users\myusername> conda install pandas pyyaml rasterio fiona
(niche) C:\Users\myusername> pip install niche_vlaanderen
(base) C:\> conda activate niche
You will see that `(C:\\Users\\myusername\\Miniconda3)`/`(base)` will change into `(niche)`.

It is strongly recommended to install also `matplotlib` (otherwise plotting
will not work) and `jupyter` notebook, which allows interactive usage from a web browser.
Now install the niche_vlaanderen package within the niche environment (with the option ``--no-deps``
to avoid installing dependencies that are already in the environment):

.. code-block:: shell
(niche) C:\Users\myusername> conda install matplotlib jupyter
(niche) C:\> pip install niche-vlaanderen --no-deps
You can verify the installation was successful by running the command line interface.
Note you must activate niche once more, because some changes were made during
installation.

.. code-block:: shell
(C:\Users\myusername\Miniconda3) C:\Users\myusername> conda activate niche
(niche) C:\Users\myusername> niche --help
(base) C:\> conda activate niche
(niche) C:\> niche --help
Usage: niche [OPTIONS] CONFIG
Command line interface to the NICHE vegetation model
Expand All @@ -77,8 +92,8 @@ from the Anaconda prompt).

.. code-block:: shell
(C:\Users\myusername\Miniconda3) C:\Users\myusername> conda activate niche
(niche) C:\Users\myusername> pip install niche_vlaanderen --upgrade
(base) C:\> conda activate niche
(niche) C:\> pip install niche_vlaanderen --upgrade --no-deps
Note you might need to update other packages.

Expand All @@ -89,24 +104,5 @@ If you want to install a specific niche_vlaanderen version, you can install usin

.. code-block:: shell
(C:\Users\myusername\Miniconda3) C:\Users\myusername> conda activate niche
(niche) C:\Users\myusername> pip install niche_vlaanderen==1.0
Alternative installation
========================
It is possible to install niche_vlaanderen without using an environment. This is currently not
the recommended installation as it requires setting an environment variable for
opening some grid files. (See :ref:`missing_gcs` for instructions).

.. code-block:: shell
conda install pandas pyyaml rasterio fiona
pip install niche_vlaanderen
Like for the normal installation, it is strongly recommended to install also `matplotlib` (otherwise plotting
will not work) and `jupyter` notebook, which allows interactive usage from a web browser.

.. code-block:: shell
conda install matplotlib jupyter
(base) C:\> conda activate niche
(niche) C:\> pip install niche_vlaanderen==1.0
15 changes: 15 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: niche
channels:
- conda-forge
- defaults
dependencies:
- geopandas
- numpy
- pandas
- pygeos
- pyyaml
- rasterio
- rasterstats>=0.17
- tqdm
- jupyter
- matplotlib

0 comments on commit af53a0e

Please sign in to comment.