Skip to content

Commit

Permalink
Merge branch 'dev' into 'master'
Browse files Browse the repository at this point in the history
Chores like formatting and packaging

See merge request ebi-biows/taxonomy-resolver!1
  • Loading branch information
biomadeira committed Sep 20, 2024
2 parents 51bea5a + ddb1ed9 commit 728bf14
Show file tree
Hide file tree
Showing 21 changed files with 1,284 additions and 344 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/package_and_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Publishing to PyPI
on:
push:
tags:
- "v*.*.*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
58 changes: 58 additions & 0 deletions .github/workflows/setup_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Python package
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install project
run: poetry install --no-interaction
#----------------------------------------------
# run test suite
#----------------------------------------------
- name: Test with pytest
run: |
source .venv/bin/activate
pytest tests/test_*.py
#----------------------------------------------
# packaging with poetry
#----------------------------------------------
- name: Build packages with Poetry
run: poetry build
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,10 @@ dmypy.json
# Pyre type checker
.pyre/

# IDE
.vscode/*
!.vscode/settings.json
.idea
.history

testdata/tree*
24 changes: 15 additions & 9 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
# Author: Fábio Madeira <[email protected]>, 2020
# test/run locally with
# gitlab-runner exec docker test_pytest

image: python:3.9
---
default:
image: python:3.11
tags:
- k8s-agent-runner

before_script:
- pip install --no-cache-dir -r requirements.txt
- pip install poetry

stages:
# Unit tests
- test_pytest
# Install Module
- setup_install
- poetry_install
- poetry_build

test_pytest:
stage: test_pytest
script: pytest

setup_install:
stage: setup_install
script: python setup.py install
poetry_install:
stage: poetry_install
script: poetry install --no-interaction --no-root

poetry_build:
stage: poetry_build
script: poetry build
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnType": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports.ruff": "explicit"
}
},
}
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

4 changes: 2 additions & 2 deletions __main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"""
Taxonomy Resolver
:copyright: (c) 2020-2021.
:copyright: (c) 2020-2024.
:license: Apache 2.0, see LICENSE for more details.
"""

from taxonresolver.cli import cli

if __name__ == '__main__':
if __name__ == "__main__":
cli()
513 changes: 513 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[tool.poetry]
name = "taxonomy-resolver"
version = "0.2.1"
description = "Taxonomy Resolver builds NCBI Taxonomy Trees and lists of Taxonomy Identifiers (TaxIDs) based on the NCBI Taxonomy Database"
authors = ["Fábio Madeira <[email protected]>"]
readme = "README.rst"
include = ["CHANGELOG.rst"]
license = "Apache-2.0"
packages = [{include = "taxonresolver"}]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: Apache Software License",
]

[tool.poetry.dependencies]
python = "^3.9"
click = ">=8.1.7"
requests = ">=2.32.2"
pytest = ">=8.2.1"
pandas = ">=2.2.2"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
testpaths = ["tests"]
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
click
requests
pytest
pandas
click>=8.1.7
requests>=2.32.2
pytest>=8.2.1
pandas>=2.2.2
71 changes: 0 additions & 71 deletions setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions taxonomy-resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"""
Taxonomy Resolver
:copyright: (c) 2020-2021.
:copyright: (c) 2020-2024.
:license: Apache 2.0, see LICENSE for more details.
"""

from taxonresolver.cli import cli

if __name__ == '__main__':
if __name__ == "__main__":
cli()
10 changes: 5 additions & 5 deletions taxonresolver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"""
Taxonomy Resolver
:copyright: (c) 2020-2021.
:copyright: (c) 2020-2024.
:license: Apache 2.0, see LICENSE for more details.
"""

__author__ = 'Fábio Madeira'
__email__ = '[email protected]'
__version__ = '0.2.1'
__contributors__ = [u'Fábio Madeira', u'Adrian Tivey']
__author__ = "Fábio Madeira"
__email__ = "[email protected]"
__version__ = "0.2.1"
__contributors__ = ["Fábio Madeira"]

from taxonresolver.tree import TaxonResolver
Loading

0 comments on commit 728bf14

Please sign in to comment.