Skip to content

Commit 62564c4

Browse files
authored
Merge pull request #223 from MoseleyBioinformaticsLab/toml
Incorporates pyproject.toml
2 parents 7b918eb + a4a1f4c commit 62564c4

9 files changed

Lines changed: 186 additions & 89 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
1-
name: Build Documentation
1+
name: Publish Documentation
22

33
on:
4-
push:
5-
branches:
6-
- main
4+
workflow_call:
75

86
jobs:
9-
build:
10-
7+
publish-documentation:
118
runs-on: ubuntu-latest
12-
139
steps:
14-
- uses: actions/checkout@v3
15-
- name: Set up Python 3.11
16-
uses: actions/setup-python@v4
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-python@v5
1712
with:
18-
python-version: '3.11'
13+
python-version: '3.x'
1914
- name: Upgrade pip, install package, install requirements, build docs
2015
run: |
2116
pip install --upgrade pip
22-
pip install -r ./docs/requirements.txt
17+
pip install .
18+
if [ -f ./docs/requirements.txt ]; then pip install -r ./docs/requirements.txt; fi
19+
pip install sphinx
2320
sphinx-build docs ./docs/_build/html/
2421
# Create an artifact of the html output.
25-
- uses: actions/upload-artifact@v3
22+
- uses: actions/upload-artifact@v4
2623
with:
2724
name: DocumentationHTML
2825
path: docs/_build/html/
@@ -35,9 +32,8 @@ jobs:
3532
git config --global user.name "${GITHUB_ACTOR}"
3633
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
3734
git clone "https://token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" --branch gh-pages --single-branch gh-pages
38-
cd gh-pages/
39-
git rm -r .
40-
cp -r ../docs/_build/html/* .
35+
cp -r docs/_build/html/* gh-pages/
36+
cd gh-pages
4137
touch .nojekyll
4238
git add .
4339
git commit -m "Update documentation." -a || true
@@ -49,4 +45,4 @@ jobs:
4945
branch: gh-pages
5046
directory: gh-pages
5147
github_token: ${{ secrets.GITHUB_TOKEN }}
52-
# ===============================
48+
# ===============================

.github/workflows/main.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Package and Documentation Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
release-version:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- id: parse-version
12+
name: Parse release version
13+
run: |
14+
echo "version=${RELEASE_VERSION/v/}" >> "$GITHUB_OUTPUT"
15+
env:
16+
RELEASE_VERSION: ${{ github.event.release.tag_name }}
17+
outputs:
18+
version: ${{ steps.parse-version.outputs.version }}
19+
publish-test-pypi:
20+
uses: ./.github/workflows/pypi.yml
21+
with:
22+
repository_url: https://test.pypi.org/legacy/
23+
secrets:
24+
API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
25+
test-test-pypi:
26+
needs: [release-version, publish-test-pypi]
27+
uses: ./.github/workflows/tests.yml
28+
with:
29+
install_command: "python3 -m pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple kegg-pull==${{ needs.release-version.outputs.version }}"
30+
publish-pypi:
31+
needs: test-test-pypi
32+
uses: ./.github/workflows/pypi.yml
33+
with:
34+
repository_url: https://upload.pypi.org/legacy/
35+
secrets:
36+
API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
37+
test-pypi:
38+
needs: [release-version, publish-pypi]
39+
uses: ./.github/workflows/tests.yml
40+
with:
41+
install_command: "python3 -m pip install kegg-pull==${{ needs.release-version.outputs.version }}"
42+
publish-documentation:
43+
needs: test-pypi
44+
uses: ./.github/workflows/documentation.yml

.github/workflows/pull_request.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Pull request
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
pull-request:
14+
uses: ./.github/workflows/tests.yml
15+
with:
16+
install_command: "python3 -m pip install -e ."

.github/workflows/pypi.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish package
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
repository_url:
7+
description: The URL of the PyPi distribution
8+
required: true
9+
type: string
10+
secrets:
11+
API_TOKEN:
12+
required: true
13+
14+
jobs:
15+
publish-package:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.x'
22+
- name: Install dependencies
23+
run: |
24+
python3 -m pip install --upgrade pip
25+
python3 -m pip install build
26+
- name: Build package
27+
run: python3 -m build
28+
- name: Publish package to a PyPi distribution
29+
uses: pypa/gh-action-pypi-publish@release/v1
30+
with:
31+
password: ${{ secrets.API_TOKEN }}
32+
repository-url: ${{ inputs.repository_url }}

.github/workflows/tests.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Run Tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
install_command:
7+
description: The command for installing the package to test.
8+
required: true
9+
type: string
10+
11+
jobs:
12+
run-tests:
13+
strategy:
14+
matrix:
15+
python-version: ["3.10", "3.11", "3.12"]
16+
os: [ ubuntu-latest, windows-latest, macOS-latest ]
17+
runs-on: ${{matrix.os}}
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install testing environment
25+
run: |
26+
python3 -m pip install --upgrade pip
27+
python3 -m pip install pytest pytest-mock pytest-cov deepdiff
28+
- name: Install package
29+
uses: Wandalen/wretry.action@master
30+
with:
31+
command: ${{ inputs.install_command }}
32+
attempt_limit: 10
33+
attempt_delay: 10000
34+
- name: Run tests on package
35+
run: python3 -m pytest dev --cov --cov-branch --cov-report=term-missing -x
36+
- name: Debug with tmate on failure
37+
if: ${{ failure() }}
38+
uses: mxschmitt/action-tmate@v3
39+
with:
40+
limit-access-to-actor: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ docs/_build
88
docs/notebook/.ipynb_checkpoints/
99
docs/notebook/tutorial.ipynb
1010
dist/
11+
src/kegg_pull/_version.py

pyproject.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel", "setuptools_scm[toml]>=6.2"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "kegg-pull"
7+
description = "Pulls any and all entries from any and all KEGG databases, pulls KEGG entry IDs, and wraps all the KEGG REST API operations in both Python API and the command line."
8+
readme = "README.rst"
9+
requires-python = ">=3.10"
10+
keywords = ["kegg", "rest", "sdk", "api", "cli"]
11+
license = {file = "LICENSE"}
12+
classifiers = [
13+
'Environment :: Console',
14+
'Intended Audience :: Developers',
15+
'License :: OSI Approved :: BSD License',
16+
'Operating System :: OS Independent',
17+
'Programming Language :: Python :: 3.10',
18+
'Topic :: Software Development :: Libraries :: Python Modules',
19+
'Topic :: Scientific/Engineering :: Medical Science Apps',
20+
'Topic :: Scientific/Engineering :: Chemistry',
21+
'Topic :: Scientific/Engineering :: Bio-Informatics',
22+
'Typing :: Typed'
23+
24+
]
25+
dynamic = ["version", "dependencies"]
26+
27+
[project.urls]
28+
"Homepage" = "https://github.com/MoseleyBioinformaticsLab/kegg_pull"
29+
"Documentation" = "https://moseleybioinformaticslab.github.io/kegg_pull/"
30+
"GitHub" = "https://github.com/MoseleyBioinformaticsLab/kegg_pull"
31+
"Issues" = "https://github.com/MoseleyBioinformaticsLab/kegg_pull/issues"
32+
33+
[tool.setuptools.dynamic]
34+
dependencies = {file = "requirements.txt"}
35+
36+
[tool.setuptools_scm]
37+
write_to = "src/kegg_pull/_version.py"
38+
39+
[project.scripts]
40+
kegg_pull = "kegg_pull.__main__:main"

setup.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)