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 # C extensions
*.so *.so
# nc files
**/*.nc
# Packages # Packages
*.egg *.egg
*.egg-info *.egg-info
...@@ -17,61 +18,9 @@ lib64 ...@@ -17,61 +18,9 @@ lib64
__pycache__ __pycache__
MANIFEST MANIFEST
# Installer logs
pip-log.txt
# Unit test / coverage reports # Unit test / coverage reports
.coverage .coverage
.tox .tox
nosetests.xml 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 @@ ...@@ -3,14 +3,14 @@
# --------------------------------------------------------------- # ---------------------------------------------------------------
# default image # default image
image: python:latest image: continuumio/miniconda3:latest
# stages (main steps of pipeline) # stages (main steps of pipeline)
stages: stages:
- Quality - Quality
- Tests - Tests
- Sonarqube - Sonarqube
#- Documentation - Documentation
- Deploy - Deploy
# --------------------------------------------------------------- # ---------------------------------------------------------------
...@@ -25,23 +25,55 @@ stages: ...@@ -25,23 +25,55 @@ stages:
- .gitlab-ci.yml - .gitlab-ci.yml
- pyproject.toml - pyproject.toml
.install-deps-template: &install-deps .install-deps-conda-template-37: &install-conda-deps-37
before_script: 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 - pip install poetry poetry-dynamic-versioning poetry2conda
- poetry config virtualenvs.in-project false - poetry config virtualenvs.in-project false
- poetry install -vv - 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 .quality-template: &quality
<<: *install-deps <<: *install-conda-deps-38
<<: *code-changes <<: *code-changes
stage: Quality stage: Quality
allow_failure: true allow_failure: true
except: except:
- tags - tags
.test-template: &test .test-template-37: &test_37
<<: *install-deps <<: *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 <<: *code-changes
stage: Tests stage: Tests
script: script:
...@@ -71,23 +103,26 @@ pylint: ...@@ -71,23 +103,26 @@ pylint:
# Test jobs # Test jobs
# --------------------------------------------------------------- # ---------------------------------------------------------------
python3.7: python3.7:
<<: *test <<: *test_37
image: python:3.7 image: continuumio/miniconda3
allow_failure: true
script: script:
- poetry run pytest tests/ - poetry run pytest tests/
python3.8: python3.8:
<<: *test <<: *test_38
image: python:3.8 image: continuumio/miniconda3
allow_failure: true
script: script:
- poetry run pytest tests/ - poetry run pytest tests/
python3.9: python3.9:
<<: *install-deps <<: *install-conda-deps-39
<<: *code-changes <<: *code-changes
stage: Tests stage: Tests
image: python:3.9 image: continuumio/miniconda3
coverage: '/^TOTAL\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+\%)/' coverage: '/^TOTAL\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+\%)/'
allow_failure: true
script: script:
- poetry run pytest --cov=${CI_PROJECT_NAME} --cov-branch --cov-report=term tests/ - 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/ - poetry run pytest -ra -q --cov=${CI_PROJECT_NAME} --cov-branch --cov-report xml:coverage.xml tests/
...@@ -103,7 +138,7 @@ python3.9: ...@@ -103,7 +138,7 @@ python3.9:
# --------------------------------------------------------------- # ---------------------------------------------------------------
sonarqube: sonarqube:
stage: Sonarqube stage: Sonarqube
tags: [cerbere] tags: [cerbere-runner]
image: image:
name: sonarsource/sonar-scanner-cli:latest name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""] entrypoint: [""]
...@@ -125,30 +160,31 @@ sonarqube: ...@@ -125,30 +160,31 @@ sonarqube:
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Documentation job # Documentation job
# --------------------------------------------------------------- # ---------------------------------------------------------------
#pages: pages:
# <<: *install-deps <<: *install-conda-deps-38
# image: python:3.8 # does not work with python 3.9 image: continuumio/miniconda3 # does not work with python 3.9
# stage: Documentation stage: Documentation
# script: #allow_failure: true
# - poetry run mkdocs build -f docs/mkdocs.yml -v script:
# - mv docs/site public - poetry run mkdocs build -f docs/mkdocs.yml -v
# only: - mv docs/site public
# refs: only:
# - master refs:
# changes: - master
# - docs/**/* changes:
# - .gitlab-ci.yml - docs/**/*
# artifacts: - .gitlab-ci.yml
# paths: artifacts:
# - public paths:
# except: - public
# - tags except:
- tags
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Release job # Release job
# --------------------------------------------------------------- # ---------------------------------------------------------------
nexus: nexus:
<<: *install-deps <<: *install-conda-deps-38
stage: Deploy stage: Deploy
script: script:
- poetry build --format wheel - poetry build --format wheel
......
...@@ -4,6 +4,12 @@ See online documentation at: http://cerbere.readthedocs.org ...@@ -4,6 +4,12 @@ See online documentation at: http://cerbere.readthedocs.org
## Development ## Development
### Create conda env
```bash
conda creaate -n cerbere -c conda-forge python=3.7 pygrib netcdf4 pyproj xarray
```
### Install poetry ### Install poetry
```bash ```bash
...@@ -15,25 +21,28 @@ poetry config repositories.nexus-public-release https://nexus-test.ifremer.fr/re ...@@ -15,25 +21,28 @@ poetry config repositories.nexus-public-release https://nexus-test.ifremer.fr/re
### retrieve and install project ### retrieve and install project
```bash ```bash
git clone https://gitlab.ifremer.fr/ifremer-commons/python/ifr_lib.git
git clone https://gitlab.ifremer.fr/cerbere/cerbere.git git clone https://gitlab.ifremer.fr/cerbere/cerbere.git
poetry install -v --no-root poetry install -v --no-root
``` ```
### Install pygrib with conda before installing cerbere
```bash
conda install -c conda-forge pygrib
```
### List dependencies ### List dependencies
```bash ```bash
poetry show --tree poetry show --tree
``` ```
# build and publish wheel # build
## wheel
```bash ```bash
poetry build --format wheel poetry build --format wheel
poetry publish -r nexus-public-release -u nexus-ci -p w2bH2NjgFmQnzVk3 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 = [ ...@@ -73,9 +73,6 @@ extensions = [
"sphinx.ext.napoleon", "sphinx.ext.napoleon",
] ]
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ['_templates']
......
...@@ -30,23 +30,18 @@ vcs = "git" ...@@ -30,23 +30,18 @@ vcs = "git"
style = "semver" style = "semver"
pattern = "^v?(?P<base>\\d+\\.\\d+\\.\\d+)(-?((?P<stage>[a-zA-Z]+)\\.?(?P<revision>\\d+)?))?$" pattern = "^v?(?P<base>\\d+\\.\\d+\\.\\d+)(-?((?P<stage>[a-zA-Z]+)\\.?(?P<revision>\\d+)?))?$"
[[tool.poetry.source]] # [[tool.poetry.source]]
name = "nexus-isi" # name = "nexus-isi"
url = "https://nexus-test.ifremer.fr/repository/pypi-public-release/simple" # url = "https://nexus-test.ifremer.fr/repository/pypi-public-release/simple"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.7" 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" 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] [tool.poetry.dev-dependencies]
# static analysis # static analysis
...@@ -60,7 +55,9 @@ pytest-cov = "^2" ...@@ -60,7 +55,9 @@ pytest-cov = "^2"
testfixtures = "^6" testfixtures = "^6"
# documentation # documentation
sphinx = "!=1.6.6,!=1.6.7,>=1.6.5"
sphinx_autodoc_typehints = "^1.11.0" sphinx_autodoc_typehints = "^1.11.0"
sphinx-rtd-theme = "^0.5.0"
[tool.poetry.plugins."cerbere.plugins"] [tool.poetry.plugins."cerbere.plugins"]
Dataset = "cerbere.dataset.dataset:Dataset" 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