Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creates new GitHub Action for standalone testing #499

Merged
merged 8 commits into from
Mar 19, 2021

Conversation

gibsramen
Copy link
Collaborator

Closes #496

New workflow "Empress Standalone CI" that creates a non-QIIME2 environment and runs tests that do not require and QIIME2 dependencies. test_cli updated to not use the Artifact API.

Copy link
Collaborator

@fedarko fedarko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much @gibsramen! This is super helpful.

Comment on lines 17 to 20
# we can add more versions of node.js in the future
strategy:
matrix:
node-version: [14.x]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are just running Python tests here I think we can avoid setting up the JS stuff -- this'll save time and energy. However, it might be nice to test multiple python versions with the standalone tests if this is possible. Here's an attempt at that. (Not sure if this will work as intended -- if this change breaks things we can add it in a later PR.)

Suggested change
# we can add more versions of node.js in the future
strategy:
matrix:
node-version: [14.x]
strategy:
matrix:
# based roughly on https://github.com/conda-incubator/setup-miniconda#example-1-basic-usage
python-version: ["3.6", "3.7", "3.8", "3.9"]

Comment on lines 33 to 37

- name: Set up Node.js enviroment
uses: actions/setup-node@v1
with:
node-version: 14
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Set up Node.js enviroment
uses: actions/setup-node@v1
with:
node-version: 14

- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: empress
python-version: 3.6
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the suggestion about testing multiple python versions I made above.

Suggested change
python-version: 3.6
# https://github.com/conda-incubator/setup-miniconda#example-1-basic-usage
python-version: ${{ matrix.python-version }}

run: pip install -e .[all]

# tests that don't import qiime2 dependencies
- name: Run Python tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Run Python tests
- name: Run (non-QIIME 2) Python tests

Figure we might as well be explicit about it :)

.github/workflows/standalone.yml Show resolved Hide resolved
PREFIX_DIR = os.path.join("docs", "moving-pictures")


def extracted_artifact_path(dir_name, artifact_loc, file_name):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things:

  1. Could you add a docstring for this function? Doesn't have to be anything fancy or long, just at least a brief description of what this does and what the params do.

  2. Unless I'm misinterpreting things, it might make sense to rename this function to extract_q2_artifact_to_path() or something more direct than the current name -- the use of extracted_ makes it seem like this function is just finding a path that already exists, when from what I can tell it's actually creating a path.

"taxonomy.tsv")
fmd = pd.read_csv(tax_loc, sep="\t", index_col=0)
md = pd.read_csv(md_loc, sep="\t", index_col=0, skiprows=[1])
pass
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pass

Comment on lines 23 to 37

Returns
-------
(tree, table, md, fmd, ordination)
tree: Artifact with semantic type Phylogeny[Rooted]
Phylogenetic tree.
table: Artifact with semantic type FeatureTable[Frequency]
Feature table.
md: Metadata
Sample metadata.
fmd: Metadata
Feature metadata. (Although this is stored in the repository as a
FeatureData[Taxonomy] artifact, we transform it to Metadata.)
pcoa: Artifact with semantic type PCoAResults
Ordination.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Returns
-------
(tree, table, md, fmd, ordination)
tree: Artifact with semantic type Phylogeny[Rooted]
Phylogenetic tree.
table: Artifact with semantic type FeatureTable[Frequency]
Feature table.
md: Metadata
Sample metadata.
fmd: Metadata
Feature metadata. (Although this is stored in the repository as a
FeatureData[Taxonomy] artifact, we transform it to Metadata.)
pcoa: Artifact with semantic type PCoAResults
Ordination.
Parameters
----------
use_artifact_api: bool, optional (default True)
If True, this will load the artifacts using the QIIME 2 Artifact API,
and the returned objects will have types corresponding to the first
listed types (before the | characters) shown below.
If False, this will instead load the artifacts without using QIIME 2's
APIs; in this case, the returned objects will have types corresponding
to the second listed types (after the | characters) shown below.
Returns
-------
(tree, table, md, fmd, ordination)
tree: qiime2.Artifact | skbio.tree.TreeNode
Phylogenetic tree.
table: qiime2.Artifact | biom.Table
Feature table.
md: qiime2.Metadata | pandas.DataFrame
Sample metadata.
fmd: qiime2.Metadata | pandas.DataFrame
Feature metadata. (Although this is stored in the repository as a
FeatureData[Taxonomy] artifact, we transform it to Metadata if
use_artifact_api is True.)
pcoa: qiime2.Artifact | skbio.OrdinationResults
Ordination.

There may be a more official way to structure this docstring, but I think this makes it pretty clear

tests/python/test_cli.py Show resolved Hide resolved
fm.to_csv(cls.fm_loc, index=True, sep="\t")
pcoa.write(cls.pcoa_loc)
# extract Artifacts to temporary filesystem
# glob used because Artifacts unzip to UUIDs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# glob used because Artifacts unzip to UUIDs

(I think this comment should still be kept around in the codebase, but it should be moved down to the util.extract...() function's docstring)

@emperor-helper
Copy link

The following artifacts were built for this PR: empire-biplot.qzv, empire.qzv, empress-tree.qzv, just-fm.qzv, plain.qzv

Copy link
Collaborator

@fedarko fedarko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good to me, thanks so much @gibsramen!!!

@fedarko fedarko merged commit 33ade9c into biocore:master Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Explicitly test standalone installation / tests in the CI
3 participants