Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade nanopub to v2.0.0 #201

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .coveragerc

This file was deleted.

10 changes: 0 additions & 10 deletions .flake8

This file was deleted.

35 changes: 19 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application

name: Run tests

on: [push, pull_request]

jobs:
build:

tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, '3.10']

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_dev.txt
sudo apt-get install -y graphviz
- name: Create RSA key for nanopubs
pip install ".[test,dev]"

- name: Setup nanopub profile (including RSA keys)
run: |
printf '\n' | setup_nanopub_profile --orcid_id 'https://orcid.org/0000-0000-0000-0000' --no-publish --name 'test'
np setup --orcid-id https://orcid.org/0000-0000-0000-0000 --no-publish --name test --newkeys

- name: Lint with flake8
run: |
Expand All @@ -34,16 +34,19 @@ jobs:
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Test with pytest
run: |
pip install pytest
pytest --cov

- name: Publish coverage to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
if: ${{ env.COVERALLS_REPO_TOKEN }}
run: |
coverage xml
coveralls

- name: Build Sphinx docs
run: |
cd docs
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish
name: Publish to PyPI

on:
release:
Expand All @@ -8,18 +8,20 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
python setup.py bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@master
python-version: "3.7"

- name: Install build dependencies
run: pip install build

- name: Build distribution
run: python -m build

- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_FAIRWORKFLOWS_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ docs/apidocs

env/
venv/
.venv/

sample_output/
.coveralls.yml
Expand Down
48 changes: 48 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-added-large-files
name: 🐘 Check for added large files
- id: check-toml
name: ✔️ Check TOML
- id: check-yaml
name: ✔️ Check YAML
args:
- --unsafe
- id: end-of-file-fixer
name: 🪚 Fix end of files
- id: trailing-whitespace
name: ✂️ Trim trailing whitespaces
- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
hooks:
- id: pyupgrade
name: ⏫ Running pyupgrade
args:
- --py3-plus
- --keep-runtime-typing
- repo: https://github.com/myint/autoflake
rev: v1.5.3
hooks:
- id: autoflake
name: ❄️ Running autoflake
args:
- --recursive
- --in-place
- --remove-all-unused-imports
- --remove-unused-variables
- --expand-star-imports
- --exclude
- __init__.py
- --remove-duplicate-keys
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: 🔄 Formatting imports with isort (python)
ci:
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
autoupdate_commit_msg: ⬆ [pre-commit.ci] pre-commit autoupdate
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.0] - 2022-12-15

### Added

* Migrate to use `pyproject.toml` with a `hatch` build backend
* Add pre-commit and a `.pre-commit-config.yaml` to make sure the files are properly formatted (similar to the nanopub package setup).

### Modified

* Update the `nanopub` dependency to 2.0.0 (no need for java anymore) and make the changes required.
* Update rdflib dependency to v6+

### Removed

* Configuration files in the root folder of the repository have been removed, their configuration being now moved in the pyproject.toml: `setup.py`, ` MANIFEST.in `, `pytest.ini `, `requirements.txt`, `requirements_dev.txt`, `.flake8`, `.coveragerc`

## [0.3.0] - 2021-06-25

### Added
Expand Down
50 changes: 43 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,54 @@ The sections below outline the steps in each case.
1. (**important**) announce your plan to the rest of the community _before you start working_. This announcement should be in the form of a (new) issue;
1. (**important**) wait until some kind of consensus is reached about your idea being a good idea;
1. if needed, fork the repository to your own Github profile and create your own feature branch off of the latest master commit. While working on your feature branch, make sure to stay up to date with the master branch by pulling in changes, possibly from the 'upstream' repository (follow the instructions [here](https://help.github.com/articles/configuring-a-remote-for-a-fork/) and [here](https://help.github.com/articles/syncing-a-fork/));
1. install the dependencies required to run `fairworkflows` in development:

```bash
pip install -r requirements.txt
```

1. install dependencies (see instructions below)
1. make your changes
1. make sure the existing tests still work by running ``pytest``. Note that any pull requests to the fairworkflows repository on github will automatically trigger running of the test suite;
1. check that the code is in accordance with the PEP8 style guide, by running ``flake8 . --count --show-source --statistics``,
configuration is in `tox.ini`.
configuration is in `tox.ini`.
1. add your own tests (if necessary);
1. update or expand the documentation;
1. [push](http://rogerdudler.github.io/git-guide/) your feature branch to (your fork of) the fairworkflows repository on GitHub;
1. create the pull request, e.g. following the instructions [here](https://help.github.com/articles/creating-a-pull-request/).

In case you feel like you've made a valuable contribution, but you don't know how to write or run tests for it, or how to generate the documentation: don't let this discourage you from making the pull request; we can help you! Just go ahead and submit the pull request, but keep in mind that you might be asked to append additional commits to your pull request.

### Install dependencies

Install [Hatch](https://hatch.pypa.io), this will automatically handle virtual environments and make sure all dependencies are installed when you run a script in the project:

```bash
pip install hatch
```

Install the depencies in a virtual environment:

```bash
hatch -v env create
```

### Development workflow

Run example workflow defined in `examples/basic_workflow.py` (feel free to change this file if needed to try things in development):

```bash
hatch run example
```

Make sure the existing tests still work by running ``pytest``. Note that any pull requests to the fairworkflows repository on github will automatically trigger running of the test suite;

```bash
hatch run test
```

The code will be automatically formatted when you commit your changes using `pre-commit`. But you can also run the script to format the code yourself:

```
hatch run format
```

Check the code for errors, and if it is in accordance with the PEP8 style guide, by running `flake8` and `mypy`:

```
hatch run check
```
6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Build Status](https://github.com/fair-workflows/fairworkflows/workflows/Python%20application/badge.svg)
[![Build Status](https://github.com/fair-workflows/fairworkflows/actions/workflows/build.yml/badge.svg)](https://github.com/fair-workflows/fairworkflows/actions/workflows/build.yml)
[![Documentation Status](https://readthedocs.org/projects/fairworkflows/badge/?version=latest)](https://fairworkflows.readthedocs.io/en/latest/?badge=latest)
[![Coverage Status](https://coveralls.io/repos/github/fair-workflows/fairworkflows/badge.svg?branch=main)](https://coveralls.io/github/fair-workflows/fairworkflows?branch=main)
[![PyPI version](https://badge.fury.io/py/fairworkflows.svg)](https://badge.fury.io/py/fairworkflows)
Expand All @@ -9,12 +9,12 @@

# ```fairworkflows``` python library
`fairworkflows` is a high-level, user-friendly python library that supports the construction,
manipulation and publishing of FAIR scientific workflows using semantic technologies.
manipulation and publishing of FAIR scientific workflows using semantic technologies.

## Background
`fairworkflows` is developed as a component of the FAIR Workbench, as part of the FAIR is FAIR project.
`fairworkflows` is developed as a component of the FAIR Workbench, as part of the FAIR is FAIR project.

The focus is on description of workflows consisting of manual and computational steps using semantic technology,
The focus is on description of workflows consisting of manual and computational steps using semantic technology,
such as the ontology described in the publication:

_Celebi, R., Moreira, J. R., Hassan, A. A., Ayyar, S., Ridder, L., Kuhn, T., & Dumontier, M. (2019). Towards FAIR protocols and workflows: The OpenPREDICT case study._ [_arXiv:1911.09531._](https://arxiv.org/abs/1911.09531)
Expand All @@ -34,14 +34,15 @@ Checkout the [user documentation](https://fairworkflows.readthedocs.io/).

The most recent release can be installed from the python package index using ```pip```:

```
```bash
pip install fairworkflows
```

To publish workflows to the nanopub server you need to setup your nanopub profile. This
allows the nanopub server to identify you. Run the following in the terminal after installation:
```
setup_nanopub_profile

```bash
np setup
```
This will add and store RSA keys to sign your nanopublications, publish a
nanopublication with your name and ORCID iD to declare that you are
Expand All @@ -60,7 +61,7 @@ from fairworkflows import is_fairworkflow, is_fairstep, FairWorkflow

### Define a step for your workflow
Mark a function as a FAIR step using the `is_fairstep` decorator.
Use keyword arguments to semantically annotate the step.
Use keyword arguments to semantically annotate the step.
In this example to provide a label and describe that this is a script task.
```python
@is_fairstep(label='Addition', is_script_task=True)
Expand All @@ -69,7 +70,7 @@ def add(x: float, y: float) -> float:
return x + y
```
### Define your workflow
Define your workflow by calling previously defined step functions.
Define your workflow by calling previously defined step functions.
Mark the function as a workflow using the `is_fairworkflow` decorator.
```python
@is_fairworkflow(label='My Workflow')
Expand Down Expand Up @@ -107,3 +108,7 @@ It is expected that the library will soon interact with FAIR Data Points as well

## Relation to existing workflow formats/engines (e.g. CWL, WDL, Snakemake etc)
This library is not intended to replace or compete with the hundreds of existing computational workflow formats, but rather to aid in RDF description and comparison of workflows in the most general sense of the term (including manual experiemental steps, notebooks, and so on). Steps in a FAIRWorkflow may very well be 'run this CWL workflow' or 'run this script', so such workflows are expected to sit more on a meta-level, describing the before-and-after of running one of these fully automated computational workflows as well.

## Contribute

If you would like to know how contribute, or learn how to run the project in development, feel free to check the documentation at [CONTRIBUTING.md](https://github.com/fair-workflows/fairworkflows/blob/main/CONTRIBUTING.md)
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ following in the terminal after installation:

::

setup_nanopub_profile
np setup

This will add and store RSA keys to sign your nanopublications, publish
a nanopublication with your name and ORCID iD to declare that you are
Expand Down
Loading