Skip to content
Snippets Groups Projects
Commit d3170468 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Refactor/edit documentation

parent 863b5d41
No related branches found
No related tags found
No related merge requests found
<img src="docs/illustrations/vipslogo_512.png" alt="VIPS Logo" height="250"/> <img src="docs/illustrations/vipslogo_512.png" alt="VIPS Logo" height="250"/>
# VIPSCore-Python-Common # VIPSCore-Python-Common
## User guide
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: 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:
``` bash ``` bash
...@@ -23,16 +23,18 @@ from vipscore_common.data_utils import * ...@@ -23,16 +23,18 @@ from vipscore_common.data_utils import *
Read more about [implementing a VIPS Model using Python](/docs/VIPSModel.md) Read more about [implementing a VIPS Model using Python](/docs/VIPSModel.md)
## Developer guide ## Developer guide
Developing and testing this package requires that you set up a virtualenv:
### Unit tests
The tests are located in the `tests` folder, and we're using [Pytest](https://docs.pytest.org/)
Prerequisite: To test, use a venv, install this package in it by running:
``` bash ``` bash
$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ python -m pip install -e . (venv) $ python -m pip install -e .
``` ```
To run the unit tests, move to the root folder of the project, and execute: ### Unit tests
The tests are located in the `tests` folder, and we're using [Pytest](https://docs.pytest.org/)
To run the unit tests, make sure you've activated this project's virtualen (see "Developer guide") move to the root folder of the project, and execute:
``` bash ``` bash
pytest -v pytest -v
...@@ -55,43 +57,3 @@ bumpver update --major ...@@ -55,43 +57,3 @@ bumpver update --major
### References ### References
We used this excellent guide for packaging: https://realpython.com/pypi-publish-python-package/ We used this excellent guide for packaging: https://realpython.com/pypi-publish-python-package/
### Deployment
Whenever changes are pushed to the repository, the pipeline defined in `.gitlab-ci.yml` is triggered. Here, there are three jobs: build, test and deploy.
The final job will only be performed for the `main` branch. Please note that publishing a package to the package repository will fail (= red deploy job)
if the version of the package has not been bumped since the previous deploy.
Follow these steps for running build, test + deploy on your laptop:
1. Create [Personal access token](https://gitlab.nibio.no/-/profile/personal_access_tokens) with name=`gitlab-pypi` and scope=`Api`.
2. 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>
```
3. Clone project, build, test 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 .
$ pip install build pytest twine
$ python3 -m build
-> Successfully built vipscore_common-0.2.0.tar.gz and vipscore_common-0.1.6-py3-none-any.whl
$ pytest
-> [100%] ======================= 2 passed in 0.27s ==========================
$ python3 -m twine upload --repository gitlab dist/* --verbose
-> Uploading vipscore_common-0.2.0-py3-none-any.whl
-> 201 Created
-> Uploading vipscore_common-0.2.0.tar.gz
-> 201 Created
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment