Skip to content

Commit a8542fe

Browse files
authored
Merge pull request #14 from MoseleyBioinformaticsLab/Travis
2.0.0 Merge. See changes in changelog.
2 parents 274873f + 7341d2a commit a8542fe

File tree

112 files changed

+573489
-4028
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+573489
-4028
lines changed

.github/workflows/build.yml

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

.github/workflows/codecov.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@ name: codecov.io
22

33
# Controls when the workflow will run
44
on:
5-
# Triggers the workflow on push or pull request events but only for the master branch
6-
push:
7-
branches: [ master ]
8-
pull_request:
9-
branches: [ master ]
10-
11-
# Allows you to run this workflow manually from the Actions tab
12-
workflow_dispatch:
5+
workflow_call:
136

147
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
158
jobs:
@@ -21,22 +14,23 @@ jobs:
2114
# Steps represent a sequence of tasks that will be executed as part of the job
2215
steps:
2316
- name: Checkout
24-
uses: actions/checkout@v2
17+
uses: actions/checkout@v5
2518

26-
- name: Set up Python 3.9
27-
uses: actions/setup-python@v2
19+
- name: Set up Python
20+
uses: actions/setup-python@v6
2821
with:
29-
python-version: 3.9
22+
python-version: '3.x'
3023

3124
- name: Install dependencies
3225
run: |
3326
pip install -r requirements.txt
3427
pip install pytest-cov
35-
python setup.py install
28+
pip install pytest-mock
29+
pip install .
3630
3731
- name: Run tests and collect coverage
3832
run: pytest --cov=./mwtab --cov-report=xml
3933

4034
# codecov
4135
- name: "Upload coverage to Codecov"
42-
uses: codecov/codecov-action@v2
36+
uses: codecov/codecov-action@v5
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish Documentation
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
publish-documentation:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v5
11+
- uses: actions/setup-python@v6
12+
with:
13+
python-version: '3.x'
14+
- name: Upgrade pip, install package, install requirements, build docs
15+
run: |
16+
pip install --upgrade pip
17+
pip install .
18+
if [ -f ./docs/requirements.txt ]; then pip install -r ./docs/requirements.txt; fi
19+
pip install sphinx
20+
sphinx-build docs ./docs/_build/html/
21+
# Create an artifact of the html output.
22+
- uses: actions/upload-artifact@v4
23+
with:
24+
name: DocumentationHTML
25+
path: docs/_build/html/
26+
# Publish built docs to gh-pages branch.
27+
# ===============================
28+
- name: Commit documentation changes
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
run: |
32+
git config --global user.name "${GITHUB_ACTOR}"
33+
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
34+
git clone "https://token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" --branch gh-pages --single-branch gh-pages
35+
cp -r docs/_build/html/* gh-pages/
36+
cd gh-pages
37+
touch .nojekyll
38+
git add .
39+
git commit -m "Update documentation." -a || true
40+
# The above command will fail if no changes were present, so we ignore
41+
# that.
42+
- name: Push changes
43+
uses: ad-m/github-push-action@master
44+
with:
45+
branch: gh-pages
46+
directory: gh-pages
47+
github_token: ${{ secrets.GITHUB_TOKEN }}
48+
# ===============================
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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 mwtab==${{ 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 mwtab==${{ needs.release-version.outputs.version }}"
42+
publish-documentation:
43+
needs: test-pypi
44+
uses: ./.github/workflows/documentation.yml
45+
upload-coverage:
46+
needs: test-pypi
47+
uses: ./.github/workflows/codecov.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", "3.13", "3.14"]
16+
os: [ ubuntu-latest, windows-latest, macOS-latest ]
17+
runs-on: ${{matrix.os}}
18+
steps:
19+
- uses: actions/checkout@v5
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v6
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: pytest
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: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,14 @@ venv/*
44
data/*
55
.DS_Store
66
.ipynb_checkpoints
7-
.idea
7+
.idea
8+
/build
9+
.coverage
10+
/*.json
11+
/htmlcov
12+
/mwtab.egg-info
13+
/src/mwtab.egg-info
14+
src/mwtab/_version.py
15+
/scratch
16+
docs/standard_column_names.json
17+
/docs/_contents

CHANGELOG.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
Release History
22
===============
33

4+
2.0.0
5+
~~~~~
6+
-Can now read duplicate keys in "Additional sample data" and reproduce it in write, will validate it as an error.
7+
-Writing out now ensures correct key ordering for JSON.
8+
-Validation now validates the main sections not just the internals of them.
9+
-Validate now checks that metabolites in the Data section are in the Metabolites section and vice versa.
10+
-Batch processing from the command line is more fault tolerant and won't stop the batch for 1 bad file.
11+
-Improved tokenizer so more files can be read in without error.
12+
-Changed schema validation to use jsonschema instead of schema.
13+
-Added validations for METABOLITES columns that try to give warnings for bad values, for example 'kegg_id' column should all be something like C00000.
14+
-Expanded the standard column name functionality to look for many more column names than in the previous version and do it in a much more robust way.
15+
-Changed validation error messages to be aware of whether the input file is JSON or mwTab and print accordingly.
16+
-Reduced many spurious validation messages.
17+
-Added a validation for when certain columns are found in METABOLITES, to look for the implied pair and warn if it isn't there. For example, retention_index and retention_index_type.
18+
-Added validations on some values, such as gender.
19+
-Many more various minor validations were added.
20+
421

522
1.2.5.post1 (2022-05-11)
623
~~~~~~~~~~~~~~~~~~~~~~~~

LICENSE

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
The Clear BSD License
22

3-
Copyright (c) 2020, Christian D. Powell, Andrey Smelter, Hunter N.B. Moseley
3+
Copyright (c) 2025, P. Travis Thompson, Christian D. Powell, Andrey Smelter, Hunter N.B. Moseley
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without
77
modification, are permitted (subject to the limitations in the disclaimer
88
below) provided that the following conditions are met:
99

1010
* Redistributions of source code must retain the above copyright notice,
11-
this list of conditions and the following disclaimer.
11+
this list of conditions and the following disclaimer.
1212

1313
* Redistributions in binary form must reproduce the above copyright
14-
notice, this list of conditions and the following disclaimer in the
15-
documentation and/or other materials provided with the distribution.
14+
notice, this list of conditions and the following disclaimer in the
15+
documentation and/or other materials provided with the distribution.
1616

1717
* Neither the name of the copyright holder nor the names of its
18-
contributors may be used to endorse or promote products derived from this
19-
software without specific prior written permission.
18+
contributors may be used to endorse or promote products derived from this
19+
software without specific prior written permission.
2020

2121
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
2222
THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND

0 commit comments

Comments
 (0)