From 0d1099e47957e4ec70b310c5cfe6b7d2d68eb7c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sara=20Monz=C3=B3n?= Date: Thu, 2 Jan 2025 11:04:24 +0100 Subject: [PATCH] deleted setup.py, added pip publish workflow to github actions --- .github/pypi_publish.yml | 49 ++++++++++++++ setup.py | 37 ---------- test/test.sh | 141 --------------------------------------- 3 files changed, 49 insertions(+), 178 deletions(-) create mode 100644 .github/pypi_publish.yml delete mode 100644 setup.py delete mode 100755 test/test.sh diff --git a/.github/pypi_publish.yml b/.github/pypi_publish.yml new file mode 100644 index 0000000..ceec80a --- /dev/null +++ b/.github/pypi_publish.yml @@ -0,0 +1,49 @@ +name: Publish package python distribution to Pypi + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.12.7 + - name: Install pypi/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: Publish dist to PyPI + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/buisciii-tools + permissions: + id-token: write + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 5f6c85e..0000000 --- a/setup.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env python - -from setuptools import setup, find_packages - -version = "3.0.0" - -with open("README.md") as f: - readme = f.read() - -with open("requirements.txt") as f: - required = f.read().splitlines() - -setup( - name="taranys", - version=version, - description="Tools for gene-by-gene allele calling analysis", - long_description=readme, - long_description_content_type="text/markdown", - keywords=[ - "buisciii", - "bioinformatics", - "pipeline", - "sequencing", - "NGS", - "next generation sequencing", - ], - author="Sara Monzon", - author_email="smonzon@isciii.es", - url="https://github.com/BU-ISCIII/taranys", - license="GNU GENERAL PUBLIC LICENSE v.3", - entry_points={"console_scripts": ["taranys=taranys.__main__:run_taranys"]}, - python_requires=">=3.9, <4", - install_requires=required, - packages=find_packages(exclude=("docs")), - include_package_data=True, - zip_safe=False, -) diff --git a/test/test.sh b/test/test.sh deleted file mode 100755 index a6e573c..0000000 --- a/test/test.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash --login - -# Exit immediately if a pipeline, which may consist of a single simple command, a list, -#or a compound command returns a non-zero status: If errors are not handled by user -set -e -# Treat unset variables and parameters other than the special parameters ‘@’ or ‘*’ as an error when performing parameter expansion. - -#Print everything as if it were executed, after substitution and expansion is applied: Debug|log option -#set -x - -#============================================================= -# HEADER -#============================================================= - -#INSTITUTION:ISCIII -#CENTRE:BU-ISCIII -# -#ACKNOLEDGE: longops2getops.sh: https://gist.github.com/adamhotep/895cebf290e95e613c006afbffef09d7 -# -#DESCRIPTION: test.sh uses test data for testing taranys installation. -# -# -#================================================================ -# END_OF_HEADER -#================================================================ - -#SHORT USAGE RULES -#LONG USAGE FUNCTION -usage() { - cat << EOF - -plasmidID is a computational pipeline tha reconstruct and annotate the most likely plasmids present in one sample - -usage : $0 - - -v | --version version - -h | --help display usage message - -example: ./test.sh - -EOF -} - -#================================================================ -# OPTION_PROCESSING -#================================================================ -# Error handling -error(){ - local parent_lineno="$1" - local script="$2" - local message="$3" - local code="${4:-1}" - - RED='\033[0;31m' - NC='\033[0m' - - if [[ -n "$message" ]] ; then - echo -e "\n---------------------------------------\n" - echo -e "${RED}ERROR${NC} in Script $script on or near line ${parent_lineno}; exiting with status ${code}" - echo -e "MESSAGE:\n" - echo -e "$message" - echo -e "\n---------------------------------------\n" - else - echo -e "\n---------------------------------------\n" - echo -e "${RED}ERROR${NC} in Script $script on or near line ${parent_lineno}; exiting with status ${code}" - echo -e "\n---------------------------------------\n" - fi - - exit "${code}" -} - -# translate long options to short -reset=true -for arg in "$@" -do - if [ -n "$reset" ]; then - unset reset - set -- # this resets the "$@" array so we can rebuild it - fi - case "$arg" in - --help) set -- "$@" -h ;; - --version) set -- "$@" -v ;; - # pass through anything else - *) set -- "$@" "$arg" ;; - esac -done - -#DECLARE FLAGS AND VARIABLES -script_dir=$(dirname $(readlink -f $0)) -assemblies="./samples_listeria/" -schema="./MLST_listeria/" -profile="./profile_MLST_listeria/profiles_csv.csv" -refgenome="./reference_listeria/GCF_002213505.1_ASM221350v1_genomic.fna" - -#PARSE VARIABLE ARGUMENTS WITH getops -#common example with letters, for long options check longopts2getopts.sh -options=":1:2:d:s:g:c:a:i:o:C:S:f:l:L:T:M:X:y:Y:RVtvh" -while getopts $options opt; do - case $opt in - h ) - usage - exit 1 - ;; - v ) - echo $VERSION - exit 1 - ;; - \?) - echo "Invalid Option: -$OPTARG" 1>&2 - usage - exit 1 - ;; - : ) - echo "Option -$OPTARG requires an argument." >&2 - exit 1 - ;; - * ) - echo "Unimplemented option: -$OPTARG" >&2; - exit 1 - ;; - - esac -done -shift $((OPTIND-1)) - -## Execute plasmidID with test data. -echo "Executing:../taranys.py allele_calling -coregenedir $schema -inputdir $assemblies -refgenome $refgenome -outputdir allele_calling_test -percentlength 20 -refalleles $refallele -profile $profile" -echo "Assemblies: $assemblies" -echo "Schema: $schema" -echo "$PWD" -cd -echo "Executing taranys analyze_schema" -$script_dir/../taranys.py analyze_schema -i $script_dir/MLST_listeria -o analyze_schema_test --output-allele-annot --cpus 1 - -# $script_dir/../taranys.py reference_alleles -coregenedir $script_dir/MLST_listeria -outputdir reference_alleles_test - -# $script_dir/../taranys.py allele_calling -coregenedir $script_dir/$schema -inputdir $script_dir/$assemblies -refgenome $script_dir/$refgenome -outputdir allele_calling_test -percentlength 20 -refalleles reference_alleles_test -profile $script_dir/$profile - -# $script_dir/../taranys.py distance_matrix -alleles_matrix allele_calling_test/result.tsv -outputdir distance_matrix_test - -echo "ALL DONE. TEST COMPLETED SUCCESSFULLY."