Skip to content

Commit

Permalink
ci(PythonSemanticRelease): update python semantic release to v8; mino…
Browse files Browse the repository at this point in the history
…r change to README; added support for py3.11; updated dependencies
  • Loading branch information
Oli4 committed Sep 26, 2023
1 parent 2b53a33 commit d4e65a8
Show file tree
Hide file tree
Showing 8 changed files with 1,803 additions and 1,364 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/_quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: pre-commit/action@v3.0.0
- uses: pre-commit-ci/lite-action@v1.0.0
if: always()
Expand All @@ -20,7 +22,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: [ "3.8" , "3.9", "3.10"]
python-version: ["3.8" , "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand All @@ -36,25 +38,25 @@ jobs:
with:
path: |
~/.local
key: poetry-1.3.2
key: poetry-1.6.1
restore-keys: |
poetry-1.3.2
poetry-1.6.1
- name: Cache virtualenv
uses: actions/cache@v3
id: virtualenv-cache
with:
path: |
~/.cache
key: virtualenv-${{ hashFiles('**/poetry.lock') }}
key: virtualenv-Python${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
virtualenv-${{ hashFiles('**/poetry.lock') }}
virtualenv-Python${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install and configure Poetry
if: steps.poetry-cache.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1.3
uses: snok/install-poetry@v1
with:
version: 1.3.2
version: 1.6.1
virtualenvs-create: true
virtualenvs-in-project: false
installer-parallel: true
Expand Down
37 changes: 25 additions & 12 deletions .github/workflows/_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,36 @@ name: Semantic Release

on:
workflow_call:
secrets:
PYPI_PASSWORD:
required: true

jobs:
release:
runs-on: ubuntu-latest
concurrency: release
permissions:
id-token: write
contents: write

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Python Semantic Release
uses: relekang/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
repository_username: __token__
repository_password: ${{ secrets.PYPI_PASSWORD }}
# This action uses Python Semantic Release v8
- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@v8.1.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
# See https://github.com/actions/runner/issues/1173
if: steps.release.outputs.released == 'true'

- name: Publish package to GitHub Release
uses: python-semantic-release/upload-to-gh-release@main
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}
2 changes: 0 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jobs:
Release:
needs: Quality
uses: MedVisBonn/eyepy/.github/workflows/_release.yaml@master
secrets:
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

Documentation:
needs: Release
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Use Python to import, analyse and visualize retinal imaging data.
![header_gif](https://user-images.githubusercontent.com/5720058/228815448-4b561246-dac9-4f8f-abde-e0dd5457a72b.gif)

[![Documentation](https://img.shields.io/badge/docs-eyepy-blue)](https://MedVisBonn.github.io/eyepy)
[![PyPI version](https://badge.fury.io/py/eyepie.svg)](https://badge.fury.io/py/eyepie)
[![PyPI version](https://badge.fury.io/py/eyepy.svg)](https://badge.fury.io/py/eyepy)
[![DOI](https://zenodo.org/badge/292547201.svg)](https://zenodo.org/badge/latestdoi/292547201)


Expand Down Expand Up @@ -53,6 +53,7 @@ ev = ep.import_retouch("path/to/volume_folder")

# Related Projects:

+ [eyeseg](https://github.com/MedVisBonn/eyeseg): A python package for segmentation of retinal layers and drusen in OCT data.
+ [OCT-Converter](https://github.com/marksgraham/OCT-Converter): Extract raw optical coherence tomography (OCT) and fundus data from proprietary file formats. (.fds/.fda/.e2e/.img/.oct/.dcm)
+ [eyelab](https://github.com/MedVisBonn/eyelab): A GUI for annotation of OCT data based on eyepy
+ Projects by the [Translational Neuroimaging Laboratory](https://github.com/neurodial)
Expand Down
59 changes: 59 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
If you want to contribute to eyepy this is a guide on how to do it. We are happy to accept contributions from everyone. If you have any questions, please open an issue or contact us via email.

## Project setup
In the following the setup of the eyepy project is described, mainly for internal documentation purposes, but feel free to use it as a guide for your own projects.

### Depdency management and packaging
We use [poetry](https://python-poetry.org/docs/) for dependency management and packaging. Hence when you want to contribute to eyepy you need to install poetry first. Do so as described in the [documentation](https://python-poetry.org/docs/#installation).

You will use Poetry to install the project's dependencies in a virtual environment or run the project's scripts and tests.

Running the tests in the projects virtual environment is as simple as running

```bash
poetry run pytest
```

Internally poetry is also used to build the package and deploy it to [PyPI](https://pypi.org/project/eyepie/). This is done via [GitHub Actions] triggered by a push to the master branch.

### Code formatting and linting
Do not spend your time on code formatting. We use yapf and isort to format the code automatically. You can run them via pre-commit hooks. See the section on [pre-commit hooks](#pre-commit-hooks) for more information.

+ Automatic code formatting with [pre-commit] check-yaml, end-of-file-fixer, trailing-whitespace, isort, yapf[google], commitizen

+ Quality checks - run pre-commit hooks and pytest via [GitHub Actions] for every pull request and push to master

Deployment for every push to master
+ Use Semantic release for Github releases and PyPI deployment via [GitHub Actions]
+ Build documentation with mkdocs and deploy it to [GitHub Pages] via [GitHub Actions]

### Semantic commit messages
+ Only allow commits with [semantic commit messages] via [commitizen]
+ Automatic increase of version number based on [semantic commit messages] via [commitizen]


## Setting up your development environment

### Forking the repository

First, you need to fork the repository. This will create a copy of the repository under your own account. You can do this by clicking on the "Fork" button in the top right corner of the repository page.
After that, you need to clone your fork to your local machine. You can do this by running the following command in your terminal:

```bash
git clone https://github.com/[YOUR_USERNAME]/eyepy.git
```

### Setting up the development environment
We use poetry for dependency management and building

### Commiting changes

#### Run the tests

#### Run the pre-commit hooks

#### Commitizen for semantic commit messages

### Push to your repository

### Create a pull request
11 changes: 11 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import nox # type: ignore - nox is not a project dependency. This module is used by the global nox command, not this project


@nox.session(python=['3.8', '3.9', '3.10', '3.11'])
def tests(session):
# Install the project dependencies
session.install('poetry')
session.run('poetry', 'install')

# Run the tests
session.run('pytest', *session.posargs)
Loading

0 comments on commit d4e65a8

Please sign in to comment.