Skip to content

Commit

Permalink
Merge pull request #11 from Robaina/Robaina/issue10
Browse files Browse the repository at this point in the history
Package Refactoring + CI
  • Loading branch information
Robaina authored Sep 13, 2023
2 parents 09a266a + a6be0bc commit 78bc4bf
Show file tree
Hide file tree
Showing 36 changed files with 723 additions and 300 deletions.
File renamed without changes.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CI
on: push
jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff black
# Include `--format=github` to enable automatic inline annotations.
# - name: Check linters
# run: ruff --format=github . # ruff does not allow trailing white space in logo (cli.py)
- name: Check format
run: black --check .
58 changes: 58 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish Docker image

on:
release:
types: [published]

push:
branches:
- main

jobs:
push_to_registries:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.API_GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: |
robaina/brendapyrser
ghcr.io/${{ github.repository }}
- name: Build and push Docker images
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
21 changes: 21 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: docs
on:
push:
branches: [ main ]
paths:
- 'docs/**'
- 'mkdocs.yml'

jobs:

build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v2
- run: pip install --upgrade pip && pip install mkdocs mkdocs-gen-files pymdown-extensions mkdocs-jupyter mkdocstrings[python]
- run: git config user.name 'github-actions[bot]' && git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Publish docs
run: mkdocs gh-deploy
7 changes: 4 additions & 3 deletions .github/workflows/draft-pdf.yml → .github/workflows/joss.yml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: joss
on: [push]

jobs:
Expand All @@ -6,18 +7,18 @@ jobs:
name: Paper Draft
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Open Journals PDF Generator
uses: openjournals/openjournals-draft-action@master
with:
journal: joss
# This should be the path to the paper within your repo.
paper-path: paper/paper.md
paper-path: ms/paper.md
- name: Upload
uses: actions/upload-artifact@v1
with:
name: paper
# This is the output path where Pandoc will write the compiled
# PDF. Note, this should be the same directory as the input
# paper.md
path: paper/paper.pdf
path: ms/paper.pdf
56 changes: 56 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: tests
on:
push:
paths-ignore:
- '**.md'
- '**.ipynb'
- '**.bib'
- 'ms/*'
pull_request:
types: [opened, reopened, edited]
paths-ignore:
- '**.md'
- '**.ipynb'
- '**.bib'
- 'ms/*'

jobs:

create-env:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]

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

- name: create environment
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.8
# mamba-version: "*"
channels: conda-forge,bioconda,defaults
auto-activate-base: false
activate-environment: tests_brendapyrser
environment-file: envs/brendapyrser-dev.yml

- name: Build & Install BRENDApyrser
run: poetry build && pip install dist/brendapyrser*.whl

- name: Run tests and collect coverage
run: coverage run -m unittest discover tests && coverage xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
version: "v0.1.15"
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified CITATION.cff
100644 → 100755
Empty file.
80 changes: 80 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Contributing to BRENDApyrser

First of all, thanks for taking the time to contribute! :tada::+1:

Here you will find a set of guidelines for contributing to BRENDApyrser. Feel free to propose changes to this document in a pull request.

## Code of conduct

This project and everyone participating in it is governed by the [Contributor Covenant, v2.0](.github/CODE_OF_CONDUCT.md) code of conduct. By participating, you are expected to uphold this code.

## I have a question!

If you only have a question about all things related to BRENDApyrser, the best course of actions for you is to open a new [discussion](https://github.com/Robaina/BRENDApyrser/discussions).

## How can I contribute?

### 1. Reporting bugs

We all make mistakes, and the developers behind BRENDApyrser are no exception... So, if you find a bug in the source code, please open an [issue](https://github.com/Robaina/BRENDApyrser/issues) and report it. Please, first search for similar issues that are currrently open.

### 2. Suggesting enhancements

Are you missing some feature that would like BRENDApyrser to have? No problem! You can contribute by suggesting an enhancement, just open a new issue and tag it with the [```enhancement```](https://github.com/Robaina/BRENDApyrser/labels/enhancement) label. Please, first search for similar issues that are currrently open.

### 3. Improving the documentation

Help is always needed at improving the [documentation](https://robaina.github.io/BRENDApyrser/). Either adding more detailed docstrings, usage explanations or new examples.

## First contribution

Unsure where to begin contributing to BRENDApyrser? You can start by looking for issues with the label [```good first issue```](https://github.com/Robaina/BRENDApyrser/labels/good%20first%20issue). If you are unsure about how to set a developer environment for BRENDApyrser, do take a look at the section below. Thanks!

## Setting up a local developer environment

To setup up a developer environment for BRENDApyrser:

1. Fork and download repo, cd to downloaded directory. You should create a new branch to work on your issue.

2. Create conda environment with required dependencies:

The file `envs/BRENDApyrser-dev.yml` contains all dependencies required to use BRENDApyrser. Conda is very slow solving the environment. It is recommended to use [mamba](https://github.com/mamba-org/mamba) instead:

```bash
mamba env create -n BRENDApyrser-dev -f envs/BRENDApyrser-dev.yml
conda activate BRENDApyrser-dev
```

3. Build package

```bash
(BRENDApyrser-dev) poetry build
```

4. Install BRENDApyrser

```bash
(BRENDApyrser-dev) pip install dist/BRENDApyrser*.whl
```

5. Run tests

```bash
(BRENDApyrser-dev) python -m unittest discover tests
```

## Building the documentation

The documentation is formed by a series of markdown files located in directory [docs](https://github.com/Robaina/BRENDApyrser/tree/main/docs). This repo uses [mkdocs](https://www.mkdocs.org/) to automatically generate documentation pages from markdown files. Also, [MathJax](https://github.com/mathjax/MathJax) syntax is allowed!

This means that, to modify the [API reference](https://robaina.github.io/BRENDApyrser/references/api/), all you need to do is to modify the docstring directly in the source file where the definion/class is located. And, to update the documentation pages, you just have to update the corresponding markdown file in the [docs](https://github.com/Robaina/BRENDApyrser/tree/main/docs) directory. Note that, if you need to change the documentation structure (e.g., add or new pages),you would need to tell mkdocs about this change through its [configuration file](https://github.com/Robaina/BRENDApyrser/blob/main/mkdocs.yml). Or just open an issue and ask for help!

When all the changes are ready to deploy, just open a pull request. After reviewing and merging the changes, the documentation will be automatically deployed.

Run the documentation locally with:

> mkdocs serve
## Tests on push and pull request to main

BRENDApyrser's repo contains a [GitHub Action](https://github.com/features/actions) to perform build and integration tests which is triggered automatically on push and pull request events to the main brach. Currently the tests include building and installing BRENDApyrser in Ubuntu and MacOS and running the [test](tests) suit.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified MANIFEST.in
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
![logo](assets/logo.png)
## a Python package to parse and manipulate the BRENDA database

[![tests](https://github.com/Robaina/BRENDApyrser/actions/workflows/tests.yml/badge.svg)](https://github.com/Robaina/BRENDApyrser/actions/workflows/tests.yml)
![PyPI](https://img.shields.io/pypi/v/brendapyrser)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/Robaina/Brendapyrser)
[![GitHub license](https://img.shields.io/github/license/Robaina/BRENDApyrser)](https://github.com/Robaina/BRENDApyrser/blob/master/LICENSE)
Expand All @@ -25,7 +26,7 @@ or

Due to BRENDA's license, BRENDA's database cannot be downloaded directly by the parser, instead, the user is asked to download the database as a text file after accepting usage conditions [here](https://www.brenda-enzymes.org/download.php).

You can find a jupyter notebook with usage examples [here](examples/examples.ipynb).
You can find a jupyter notebook with usage examples [here](docs/examples.ipynb).

## Contribute

Expand Down
Binary file removed README_files/output_13_0.png
Binary file not shown.
Binary file removed README_files/output_14_0.png
Binary file not shown.
Binary file removed README_files/output_16_0.png
Binary file not shown.
Binary file removed README_files/output_18_0.png
Binary file not shown.
Binary file removed README_files/output_5_0.png
Binary file not shown.
Binary file removed README_files/output_6_0.png
Binary file not shown.
Binary file removed README_files/output_7_0.png
Binary file not shown.
Binary file removed README_files/output_9_0.png
Binary file not shown.
Empty file modified assets/logo.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/social_logo_cut.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions brendapyrser/__init__.py

This file was deleted.

Loading

0 comments on commit 78bc4bf

Please sign in to comment.