
VIPSCore-Python-Common
This is the source code for the module that contains the common data models and utilities for the Python implementation(s) of VIPS. It can be installed with pip like this:
# From local path, if you've cloned the Git repo
pip3 install /home/foo/vipscore-python-common/
# From GitLab
pip3 install git+https://gitlab.nibio.no/VIPS/vipscore-python-common.git@v0.1.6
...where the version is specified after the @
If you're implementing a VIPS model, typical imports would be
from vipscore_common.vips_model import VIPSModel
from vipscore_common.entities import Result, ModelConfiguration, WeatherObservation
from vipscore_common.data_utils import *
Developer guide
Unit tests
The tests are located in the tests
folder, and we're using Pytest
To run the unit tests, move to the root folder of the project, and execute:
pytest -v
Using bumpver
For developers: When you want to publish a new version, use
# Increment the PATCH version when you make backwards compatible bug fixes.
bumpver update --patch
# Increment the MINOR version when you add functionality in a backwards compatible manner.
bumpver update --minor
# Increment the MAJOR version when you make incompatible API changes.
bumpver update --major
References
We used this excellent guide for packaging: https://realpython.com/pypi-publish-python-package/
Manual deployment
Temporary notes of steps required for building and uploading package
Create Personal access token with name=gitlab-pypi
and scope=Api
.
Create file ~/.pypirc
with the following content:
[distutils]
index-servers =
gitlab
[gitlab]
repository = https://gitlab.nibio.no/api/v4/projects/401/packages/pypi
username = gitlab-pypi
password = <personal access token>
Clone project, build and deploy package
$ git clone git@gitlab.nibio.no:VIPS/vipscore-python-common.git
$ cd vipscore-python-common
$ python3 -m venv venv
$ . venv/bin/activate
$ pip install -e .
$ python3 -m build
-> Successfully built vipscore_common-0.1.6.tar.gz and vipscore_common-0.1.6-py3-none-any.whl
$ python3 -m twine upload --repository gitlab dist/* --verbose
-> Uploading vipscore_common-0.1.6-py3-none-any.whl
-> 201 Created
-> Uploading vipscore_common-0.1.6.tar.gz
-> 201 Created
Pipeline deployment
See pipeline configuration in .gitlab-ci.yml
.