Commit 80aea612 authored by BODERE's avatar BODERE
Browse files

add conda support

parent 3d289e74
Pipeline #3117 passed with stages
in 9 minutes and 58 seconds
*.py[cod]
# C extensions
*.so
# nc files
**/*.nc
# Packages
*.egg
*.egg-info
......@@ -17,61 +18,9 @@ lib64
__pycache__
MANIFEST
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
*.pyc
*.pyo
DS_Store
*.sqlite3
VERSION.txt
migrations
*/migrations/*.py
src/datamodel/test/data/GW_L2P_ALT_ENVI_GDR_20110101_061209_20110101_070215_098_078.nc
src/datamodel/test/data/polarfront_2008-09-09T050025_2008-10-17T114909_HiWASE_2008_FORE.nc
src/datamodel/test/data/QS_S2B54289.20093261508
src/datamodel/test/data/WMO51101_20110101T0050_20110131T2350_Lat_24.32N_Lon_162.06W.nc
src/datamodel/test/data/20120109000000-OSISAF-L3C_GHRSST-SSTsubskin-SEVIRI_SST-ssteqc_meteosat09_20120109_000000-v02.0-fv01.0.nc
src/datamodel/test/data/20120323-ATS_NR_2P-UPA-L2P-ATS_NR__2PNPDK20120323_185109_000062203113_00042_52642_2614-v01.nc
src/20130404-NCDC-L4LRblend-GLOB-v01-fv02_0-AVHRR_OI.nc
src/20130516-IFR-L4_GHRSST-SSTfnd-ODYSSEA-GLOB_010-v2.0-fv1.0.nc
src/datamodel/fastregrid.c
src/dmi.nc
src/hrdds1.nc
src/hrdds2.nc
src/test.py
cerbere/20130404-NCDC-L4LRblend-GLOB-v01-fv02_0-AVHRR_OI.nc
cerbere/20130516-IFR-L4_GHRSST-SSTfnd-ODYSSEA-GLOB_010-v2.0-fv1.0.nc
cerbere/datamodel/fastregrid.c
cerbere/datamodel/test/data/20120109000000-OSISAF-L3C_GHRSST-SSTsubskin-SEVIRI_SST-ssteqc_meteosat09_20120109_000000-v02.0-fv01.0.nc
cerbere/datamodel/test/data/20120323-ATS_NR_2P-UPA-L2P-ATS_NR__2PNPDK20120323_185109_000062203113_00042_52642_2614-v01.nc
cerbere/datamodel/test/data/GW_L2P_ALT_ENVI_GDR_20110101_061209_20110101_070215_098_078.nc
cerbere/datamodel/test/data/QS_S2B54289.20093261508
cerbere/datamodel/test/data/WMO51101_20110101T0050_20110131T2350_Lat_24.32N_Lon_162.06W.nc
cerbere/datamodel/test/data/polarfront_2008-09-09T050025_2008-10-17T114909_HiWASE_2008_FORE.nc
cerbere/dmi.nc
cerbere/hrdds1.nc
cerbere/hrdds2.nc
tests/data/20120109000000-OSISAF-L3C_GHRSST-SSTsubskin-SEVIRI_SST-ssteqc_meteosat09_20120109_000000-v02.0-fv01.0.nc
tests/data/20120323-ATS_NR_2P-UPA-L2P-ATS_NR__2PNPDK20120323_185109_000062203113_00042_52642_2614-v01.nc
tests/data/GW_L2P_ALT_ENVI_GDR_20110101_061209_20110101_070215_098_078.nc
tests/data/QS_S2B54289.20093261508
tests/data/WMO51101_20110101T0050_20110131T2350_Lat_24.32N_Lon_162.06W.nc
tests/data/polarfront_2008-09-09T050025_2008-10-17T114909_HiWASE_2008_FORE.nc
......@@ -3,14 +3,14 @@
# ---------------------------------------------------------------
# default image
image: python:latest
image: continuumio/miniconda3:latest
# stages (main steps of pipeline)
stages:
- Quality
- Tests
- Sonarqube
#- Documentation
- Documentation
- Deploy
# ---------------------------------------------------------------
......@@ -25,23 +25,55 @@ stages:
- .gitlab-ci.yml
- pyproject.toml
.install-deps-template: &install-deps
.install-deps-conda-template-37: &install-conda-deps-37
before_script:
- conda create -n cerbere python=3.7
- source activate cerbere
- conda install -c conda-forge pygrib
- pip install poetry poetry-dynamic-versioning poetry2conda
- poetry config virtualenvs.in-project false
- poetry install -vv
tags: [cerbere]
tags: [cerbere-runner]
.install-deps-conda-template-38: &install-conda-deps-38
before_script:
- conda create -n cerbere python=3.8
- source activate cerbere
- conda install -c conda-forge pygrib
- pip install poetry poetry-dynamic-versioning poetry2conda
- poetry config virtualenvs.in-project false
- poetry install -vv
tags: [cerbere-runner]
.install-deps-conda-template-39: &install-conda-deps-39
before_script:
- conda create -n cerbere python=3.9
- source activate cerbere
- conda install -c conda-forge pygrib
- pip install poetry poetry-dynamic-versioning poetry2conda
- poetry config virtualenvs.in-project false
- poetry install -vv
tags: [cerbere-runner]
.quality-template: &quality
<<: *install-deps
<<: *install-conda-deps-38
<<: *code-changes
stage: Quality
allow_failure: true
except:
- tags
.test-template: &test
<<: *install-deps
.test-template-37: &test_37
<<: *install-conda-deps-37
<<: *code-changes
stage: Tests
script:
- poetry run pytest tests/
except:
- tags
.test-template-38: &test_38
<<: *install-conda-deps-38
<<: *code-changes
stage: Tests
script:
......@@ -71,23 +103,26 @@ pylint:
# Test jobs
# ---------------------------------------------------------------
python3.7:
<<: *test
image: python:3.7
<<: *test_37
image: continuumio/miniconda3
allow_failure: true
script:
- poetry run pytest tests/
python3.8:
<<: *test
image: python:3.8
<<: *test_38
image: continuumio/miniconda3
allow_failure: true
script:
- poetry run pytest tests/
python3.9:
<<: *install-deps
<<: *install-conda-deps-39
<<: *code-changes
stage: Tests
image: python:3.9
image: continuumio/miniconda3
coverage: '/^TOTAL\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+\%)/'
allow_failure: true
script:
- poetry run pytest --cov=${CI_PROJECT_NAME} --cov-branch --cov-report=term tests/
- poetry run pytest -ra -q --cov=${CI_PROJECT_NAME} --cov-branch --cov-report xml:coverage.xml tests/
......@@ -103,7 +138,7 @@ python3.9:
# ---------------------------------------------------------------
sonarqube:
stage: Sonarqube
tags: [cerbere]
tags: [cerbere-runner]
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
......@@ -125,30 +160,31 @@ sonarqube:
# ---------------------------------------------------------------
# Documentation job
# ---------------------------------------------------------------
#pages:
# <<: *install-deps
# image: python:3.8 # does not work with python 3.9
# stage: Documentation
# script:
# - poetry run mkdocs build -f docs/mkdocs.yml -v
# - mv docs/site public
# only:
# refs:
# - master
# changes:
# - docs/**/*
# - .gitlab-ci.yml
# artifacts:
# paths:
# - public
# except:
# - tags
pages:
<<: *install-conda-deps-38
image: continuumio/miniconda3 # does not work with python 3.9
stage: Documentation
#allow_failure: true
script:
- poetry run mkdocs build -f docs/mkdocs.yml -v
- mv docs/site public
only:
refs:
- master
changes:
- docs/**/*
- .gitlab-ci.yml
artifacts:
paths:
- public
except:
- tags
# ---------------------------------------------------------------
# Release job
# ---------------------------------------------------------------
nexus:
<<: *install-deps
<<: *install-conda-deps-38
stage: Deploy
script:
- poetry build --format wheel
......
......@@ -4,6 +4,12 @@ See online documentation at: http://cerbere.readthedocs.org
## Development
### Create conda env
```bash
conda creaate -n cerbere -c conda-forge python=3.7 pygrib netcdf4 pyproj xarray
```
### Install poetry
```bash
......@@ -15,25 +21,28 @@ poetry config repositories.nexus-public-release https://nexus-test.ifremer.fr/re
### retrieve and install project
```bash
git clone https://gitlab.ifremer.fr/ifremer-commons/python/ifr_lib.git
git clone https://gitlab.ifremer.fr/cerbere/cerbere.git
poetry install -v --no-root
```
### Install pygrib with conda before installing cerbere
```bash
conda install -c conda-forge pygrib
```
### List dependencies
```bash
poetry show --tree
```
# build and publish wheel
# build
## wheel
```bash
poetry build --format wheel
poetry publish -r nexus-public-release -u nexus-ci -p w2bH2NjgFmQnzVk3
```
## conda
```bash
mkdir -p dist/conda
conda build assets/conda -c conda-forge --output-folder dist/conda
```
\ No newline at end of file
# -----------------------------------------------------------
# Package metadata
# -----------------------------------------------------------
package:
name: cerbere
version: 0.1.0
about:
home: https://gitlab.ifremer.fr/cerbere/cerbere
license: GPLv3
license_file: LICENSE.md
# -----------------------------------------------------------
# Package build
# -----------------------------------------------------------
# extra conda channels
channel:
- conda-forge
# path to root package
source:
path: ../../
# command to install package (here from wheel)
build:
#script: pip install ./dist/cerbere-*.whl
script: "poetry install --no-dev"
requirements:
# to build package
build:
- python
- pip
- wheel
# to be used at runtime
run:
- python #
- pyyaml # pypi : PyYAML
- netcdf4 # pypi : netCDF4
- scipy # pypi : scipy
- shapely # pypi : shapely
- xarray # pypi : xarray
#test:
# imports:
# - cerbere
"%PYTHON%" setup.py install
if errorlevel 1 exit 1
$PYTHON setup.py install # Python command to install the script.
package:
name: cerbere
version: "develop"
source:
git_rev: develop
# git_url: https://git.cersat.fr/cerbere/cerbere.git
git_url: ..
requirements:
build:
- python
- setuptools
- numpy
run:
- python
- numpy
- netcdf4
- pyproj
- pygrib
- dateutil
test:
imports:
- cerbere
about:
home: https://git.cersat.fr/cerbere/cerbere
license: GPLv3
license_file: LICENSE.txt
......@@ -73,9 +73,6 @@ extensions = [
"sphinx.ext.napoleon",
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
......
......@@ -30,23 +30,18 @@ vcs = "git"
style = "semver"
pattern = "^v?(?P<base>\\d+\\.\\d+\\.\\d+)(-?((?P<stage>[a-zA-Z]+)\\.?(?P<revision>\\d+)?))?$"
[[tool.poetry.source]]
name = "nexus-isi"
url = "https://nexus-test.ifremer.fr/repository/pypi-public-release/simple"
# [[tool.poetry.source]]
# name = "nexus-isi"
# url = "https://nexus-test.ifremer.fr/repository/pypi-public-release/simple"
[tool.poetry.dependencies]
python = "^3.7"
numpy = "^1.19.1"
pandas = "^1.1.1"
PyYAML = "^5.3"
netCDF4 = "^1.5"
scipy = '1.5.4'
shapely = "^1.7"
xarray = "^0.16"
shapely = "^1.2.18"
python-dateutil = "^2.1"
cftime = "^1.2.1"
netCDF4 = "^1.5.4"
scipy = "^1.5.2"
pyyaml = "^5.3.1"
pyproj = "^2.6.1"
pygrib = "^2.0.5"
[tool.poetry.dev-dependencies]
# static analysis
......@@ -60,7 +55,9 @@ pytest-cov = "^2"
testfixtures = "^6"
# documentation
sphinx = "!=1.6.6,!=1.6.7,>=1.6.5"
sphinx_autodoc_typehints = "^1.11.0"
sphinx-rtd-theme = "^0.5.0"
[tool.poetry.plugins."cerbere.plugins"]
Dataset = "cerbere.dataset.dataset:Dataset"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment