Skip to content

Commit 6ccb466

Browse files
authored
Merge pull request #68 from biocommons/andreasprlic-patch-1
Update python-package.yml
2 parents 453c1f1 + 8d7ed77 commit 6ccb466

File tree

6 files changed

+107
-72
lines changed

6 files changed

+107
-72
lines changed
Lines changed: 85 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,48 @@
1+
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
12
name: Python package
23

34
on:
45
push:
6+
tags:
7+
- '[0-9]+.[0-9]+.[0-9]+' # release
8+
- '[0-9]+.[0-9]+.[0-9]+a[0-9]+' # alpha
9+
- '[0-9]+.[0-9]+.[0-9]+b[0-9]+' # beta
10+
- '[0-9]+.[0-9]+.[0-9]+rc[0-9]+' # release candidate
11+
- '[0-9]+.[0-9]+.[0-9]+.dev[0-9]+' # dev (not semver compliant)
12+
- '[0-9]+.[0-9]+.[0-9]+.post[0-9]+' # post (not semver compliant)
513
pull_request:
614

715
jobs:
816
cqa:
917
runs-on: ubuntu-latest
1018

1119
steps:
12-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
21+
22+
- uses: awalsh128/cache-apt-pkgs-action@latest
23+
with:
24+
packages: zsh
25+
version: 1.0
1326

1427
- name: Set up Python
15-
uses: actions/setup-python@v4
28+
uses: actions/setup-python@v5
1629
with:
17-
python-version: "3.10"
30+
python-version: "3.12"
1831
cache: pip
19-
cache-dependency-path: '**/setup.cfg'
32+
cache-dependency-path: '**/pyproject.yaml'
2033

2134
- name: Install test dependencies
2235
run: |
2336
python -m pip install --upgrade pip
24-
pip install --use-deprecated=legacy-resolver -e .[dev]
37+
pip install --use-deprecated=legacy-resolver -e .[dev,test]
2538
26-
- name: Lint with flake8
39+
- name: Lint with Ruff
2740
run: |
28-
# stop the build if there are Python syntax errors or undefined names
29-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
30-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
31-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
32-
33-
- name: Format check with isort
34-
run: |
35-
isort --check src
41+
ruff check .
3642
3743
- name: Format check with Ruff
3844
run: |
39-
ruff format --check src
40-
41-
# Disable bandit until issues are resolved
42-
# - name: Security check with bandit
43-
# run: |
44-
# bandit -ll -r src
45+
ruff format --check .
4546
4647
test:
4748
runs-on: ubuntu-latest
@@ -52,10 +53,15 @@ jobs:
5253
python-version: ["3.10", "3.11", "3.12"]
5354

5455
steps:
55-
- uses: actions/checkout@v3
56+
- uses: actions/checkout@v4
57+
58+
- uses: awalsh128/cache-apt-pkgs-action@latest
59+
with:
60+
packages: zsh
61+
version: 1.0
5662

5763
- name: Set up Python ${{ matrix.python-version }}
58-
uses: actions/setup-python@v4
64+
uses: actions/setup-python@v5
5965
with:
6066
python-version: ${{ matrix.python-version }}
6167
cache: pip
@@ -64,46 +70,70 @@ jobs:
6470
- name: Install dependencies
6571
run: |
6672
python -m pip install --upgrade pip
67-
pip install --use-deprecated=legacy-resolver -e .[test]
73+
make develop
6874
6975
- name: Test with pytest
7076
run: |
7177
make test
7278
73-
deploy:
79+
- name: Upload coverage data to Codecov
80+
run: |
81+
# Verify integrity of codecov download
82+
curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
83+
curl -Os https://uploader.codecov.io/latest/linux/codecov
84+
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
85+
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
86+
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
87+
shasum -a 256 -c codecov.SHA256SUM
88+
# Upload coverage report
89+
chmod +x codecov
90+
./codecov
91+
92+
build:
93+
name: Build distribution
94+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
95+
runs-on: ubuntu-latest
7496
needs:
7597
- cqa
7698
- test
99+
steps:
100+
- uses: actions/checkout@v4
101+
- name: Set up Python
102+
uses: actions/setup-python@v5
103+
with:
104+
python-version: "3.12"
105+
cache: pip
106+
cache-dependency-path: '**/setup.cfg'
107+
- name: Install pypa/build
108+
run: >-
109+
python3 -m
110+
pip install
111+
build
112+
--user
113+
- name: Build a binary wheel and a source tarball
114+
run: python3 -m build
115+
- name: Store the distribution packages
116+
uses: actions/upload-artifact@v4
117+
with:
118+
name: python-package-distributions
119+
path: dist/
120+
121+
publish-to-pypi:
122+
name: >-
123+
Publish Python distribution to PyPI
124+
needs:
125+
- build
77126
runs-on: ubuntu-latest
78-
127+
environment:
128+
name: pypi
129+
url: https://pypi.org/p/bioutils
130+
permissions:
131+
id-token: write # IMPORTANT: mandatory for trusted publishing
79132
steps:
80-
- name: hello world
81-
run: |
82-
echo "::group::Environment info"
83-
echo github.event_name = ${{ github.event_name }}
84-
echo refs = ${{ github.ref }}
85-
echo tags = ${{ startsWith(github.ref, 'refs/tags') }}
86-
echo "::endgroup::"
87-
88-
- uses: actions/checkout@v3
89-
90-
- name: Set up Python
91-
uses: actions/setup-python@v4
92-
with:
93-
python-version: "3.10"
94-
cache: pip
95-
cache-dependency-path: '**/setup.cfg'
96-
97-
- name: Install dependencies
98-
run: |
99-
python -m pip install --upgrade pip
100-
pip install build
101-
102-
- name: Build package
103-
run: python -m build --wheel
104-
105-
- name: Publish package
106-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
107-
uses: pypa/gh-action-pypi-publish@release/v1
108-
with:
109-
password: ${{ secrets.PYPI_API_TOKEN }}
133+
- name: Download all the dists
134+
uses: actions/download-artifact@v4
135+
with:
136+
name: python-package-distributions
137+
path: dist/
138+
- name: Publish distribution to PyPI
139+
uses: pypa/gh-action-pypi-publish@release/v1

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SHELL:=/bin/bash -e -o pipefail
99
SELF:=$(firstword $(MAKEFILE_LIST))
1010

1111
PY_VERSION:=$(shell python3 --version | cut -d" " -f2 | cut -d. -f1-2)
12-
VE_DIR:=venv/${PY_VERSION}
12+
VE_DIR=venv
1313

1414
$(info Using Python ${PY_VERSION})
1515

@@ -46,10 +46,10 @@ ${VE_DIR}: venv/%:
4646
pip install --upgrade pip setuptools wheel
4747

4848
#=> develop: install package in develop mode
49-
.PHONY: develop install
49+
#=> develop: install package in develop mode
50+
.PHONY: develop
5051
develop:
51-
@if [ -z "$${VIRTUAL_ENV}" ]; then echo "Not in a virtual environment; see README.md" 1>&2; exit 1; fi
52-
pip install -e .[dev,test]
52+
pip install -e ".[dev, test]"
5353

5454
#=> install: install package
5555
install:

docs/source/conf.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,31 @@
66

77
# -- Project information -----------------------------------------------------
88

9-
project = 'bioutils'
10-
copyright = '2019, bioutils Contributors'
11-
author = 'bioutils Contributors'
9+
project = "bioutils"
10+
copyright = "2019, bioutils Contributors"
11+
author = "bioutils Contributors"
1212

1313

1414
# -- General configuration ---------------------------------------------------
1515

1616
# Add any Sphinx extension module names here, as strings. They can be
1717
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
1818
# ones.
19-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo',
20-
'sphinx.ext.autosummary', 'sphinx.ext.viewcode', 'sphinx.ext.coverage',
21-
'sphinx.ext.doctest', 'sphinx.ext.ifconfig', 'sphinx.ext.mathjax',
22-
'sphinx.ext.napoleon']
19+
extensions = [
20+
"sphinx.ext.autodoc",
21+
"sphinx.ext.intersphinx",
22+
"sphinx.ext.todo",
23+
"sphinx.ext.autosummary",
24+
"sphinx.ext.viewcode",
25+
"sphinx.ext.coverage",
26+
"sphinx.ext.doctest",
27+
"sphinx.ext.ifconfig",
28+
"sphinx.ext.mathjax",
29+
"sphinx.ext.napoleon",
30+
]
2331

2432
# Add any paths that contain templates here, relative to this directory.
25-
templates_path = ['_templates']
33+
templates_path = ["_templates"]
2634

2735
# List of patterns, relative to source directory, that match files and
2836
# directories to ignore when looking for source files.
@@ -35,9 +43,9 @@
3543
# The theme to use for HTML and HTML Help pages. See the documentation for
3644
# a list of builtin themes.
3745
#
38-
html_theme = 'alabaster'
46+
html_theme = "alabaster"
3947

4048
# Add any paths that contain custom static files (such as style sheets) here,
4149
# relative to this directory. They are copied after the builtin static files,
4250
# so a file named "default.css" will overwrite the builtin "default.css".
43-
html_static_path = ['_static']
51+
html_static_path = ["_static"]

src/bioutils/normalize.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# -*- coding: utf-8 -*-
22
"""Provides functionality for normalizing alleles, ensuring comparable representations."""
33

4-
import copy
54
import enum
65
import logging
76
import math

tests/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import logging
22
import os
33

4-
import pytest
54
import vcr
65

76
# set vcr logging level

tests/test_seqfetcher.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
from bioutils.seqfetcher import (
88
_add_eutils_api_key,
9-
_fetch_seq_ensembl,
109
_fetch_seq_ncbi,
1110
fetch_seq,
1211
)

0 commit comments

Comments
 (0)