Skip to content

Commit 14702e9

Browse files
authored
Black vs. Click fix + test, (dev)docs, etc. (#325)
* DEV/DEP: update note about black + q2 vsns * BLD: test on two additional Q2 versions And document supported versions better in the CI. * REL: update changelog * DEV/BLD: Document and catch Q2 CLI breaking thing ha -- so it doesn't impact the tests but it does impact the CLI (i shoulda documented this clearer when i first saw it), and now this will be reflected in the build. This build should now fail. * DEV: fix up dev docs re: q2 vsn * DOC: update redsea screenshot * DEP: fix black --> click --> qiime2 conflict * STY: Re-format python using black 21.12b0 Since we pinned it in this PR. Shoulda done this with the previous commit, whoops * DEV: note about dev environment * DEP: Omit Black from dev deps; update dev docs+CI I think this is one of the more painless solutions to this problem. Eesh. * REL: note black vs. click issue in chglog * DEV: update makefile (forgor) * DOC: update README & CHANGELOG re: requirements * REL: changelog tense, etc.
1 parent 6e4f502 commit 14702e9

File tree

8 files changed

+101
-42
lines changed

8 files changed

+101
-42
lines changed

.github/workflows/qiime2.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,19 @@ jobs:
1212
matrix:
1313
# Test on multiple QIIME 2 versions. This is a nice way of making sure
1414
# that Qurro works on all of the QIIME 2 versions it actually, you
15-
# know, supports.
15+
# know, supports. As of writing, this includes QIIME 2 versions
16+
#
17+
# 1. 2020.11
18+
# 2. 2021.2
19+
# 3. 2021.4
20+
# 4. 2021.8
21+
# 5. 2021.11
22+
# 6. 2022.2
23+
# 7. 2022.8
24+
#
25+
# We currently test just a subset of these versions, because each of
26+
# these builds takes a while (and testing each of these would probs be
27+
# overkill).
1628
#
1729
# We could use a matrix of just QIIME 2 version strings (e.g.
1830
# "2020.11", ...), but other stuff about the URLs change across QIIME 2
@@ -25,6 +37,8 @@ jobs:
2537
# for the heads up about this :)
2638
q2-yaml: [
2739
"https://raw.githubusercontent.com/qiime2/environment-files/master/2020.11/release/qiime2-2020.11-py36-linux-conda.yml",
40+
"https://raw.githubusercontent.com/qiime2/environment-files/master/2021.8/release/qiime2-2021.8-py38-linux-conda.yml",
41+
"https://raw.githubusercontent.com/qiime2/environment-files/master/2022.2/release/qiime2-2022.2-py38-linux-conda.yml",
2842
"https://raw.githubusercontent.com/qiime2/environment-files/master/latest/staging/qiime2-latest-py38-linux-conda.yml"
2943
]
3044

@@ -57,8 +71,16 @@ jobs:
5771
- name: Run tests
5872
run: conda run -n qiime2-dev make test
5973

60-
- name: Lint and stylecheck
61-
run: conda run -n qiime2-dev make stylecheck
74+
- name: Lint and stylecheck (not using Black to check Python code)
75+
run: conda run -n qiime2-dev make stylecheck_not_black
76+
77+
# It's possible to install packages that break QIIME 2's CLI (e.g.
78+
# installing Click >= 8 into a Q2 2022.2 environment seems to break it --
79+
# this is discussed in the developer documentation, CONTRIBUTING.md).
80+
# Verify that, by installing Qurro, we have not "broken" QIIME 2 in this
81+
# way.
82+
- name: Test that QIIME 2's CLI works
83+
run: conda run -n qiime2-dev qiime info
6284

6385
- name: Upload code coverage information to Codecov
6486
uses: codecov/codecov-action@v2

.github/workflows/standalone.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,24 @@ jobs:
2626

2727
- name: Install Qurro (and its pip dependencies)
2828
run: pip install -e .[dev]
29+
30+
- name: Install Black, also (no QIIME 2 to worry about conflicts with)
31+
run: pip install "black >= 22.3.0"
2932

3033
- name: Set up Node.js
3134
uses: actions/setup-node@v1
3235

3336
- name: Install Qurro's Node.js development dependencies
3437
run: npm install -g mocha-headless-chrome nyc prettier@2.0.5 jshint
3538

36-
# Just run the tests; don't bother running stylechecking / linting, since
37-
# that's already done in the QIIME 2 CI.
3839
- name: Run tests
3940
run: |
4041
make pytest_standalone
4142
make jstest
4243
44+
- name: Lint and stylecheck (including using Black to check Python code)
45+
run: make stylecheck
46+
4347
# NOTE: For now, we only submit coverage reports from the QIIME 2 CI,
4448
# since the tests that that CI runs are a superset of those ran by this
4549
# "standalone" CI. (Also, Codecov wasn't merging them, which caused

CHANGELOG.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Qurro changelog
22

3-
## Qurro 0.8.0 (date TBD)
3+
## Qurro 0.8.0 (October 19, 2022)
44
### Features added
5-
- Add an option to Qurro's visualization interface to exclude metadata columns
6-
from the "sample plot data" output TSV
5+
- Added an option to Qurro's visualization interface to exclude metadata
6+
columns from the "sample plot data" output TSV
77
([#306](https://github.com/biocore/qurro/issues/306),
88
[#313](https://github.com/biocore/qurro/pull/313)).
99
- This should make it easier to merge the sample log-ratios exported from
@@ -12,34 +12,45 @@
1212
[Gemelli](https://github.com/biocore/gemelli)'s tutorials.)
1313
### Backward-incompatible changes
1414
- Switched the required pandas version from `>= 0.24.0, <1` to `>= 1`.
15-
This makes Qurro now compatible with QIIME 2 versions `>= 2020.11`!
15+
**This makes Qurro now compatible with QIIME 2 versions `>= 2020.11`!**
1616
- However, this change removes support for older QIIME 2 versions. (It may be
1717
possible to get this version of Qurro installed into an older QIIME 2
18-
environment, but we do not explicitly support this.)
18+
environment, but we do not explicitly support this.) If you need to use
19+
Qurro in older QIIME 2 environments, you can install an older version of
20+
Qurro (e.g. `pip install "qurro==0.7.1"`).
1921
- Notably, Songbird has not yet made the shift to pandas `>= 1`, so Songbird
2022
and Qurro will need to be installed into separate environments; the "Red
2123
Sea" example notebook details this process.
24+
- Updated a few other dependency versions to fix various problems (e.g.
25+
explicitly requiring SciPy and pinning it to `scipy < 1.9.0` to fix
26+
[this scikit-bio issue](https://github.com/biocore/scikit-bio/issues/1818),
27+
removing Black from the development dependencies for reasons discussed in
28+
[`CONTRIBUTING.md`](https://github.com/biocore/qurro/blob/master/CONTRIBUTING.md)).
2229
### Bug fixes
2330
### Performance enhancements
2431
### Miscellaneous
25-
- Improve various parts of Qurro's code to remove various warnings (for
32+
- Updated various parts of Qurro's code to remove various warnings (for
2633
example, about certain things being deprecated).
27-
- Update Qurro's example notebooks:
34+
- Updated Qurro's example notebooks:
2835
- Updated the "Red Sea" notebook to explain how to use
2936
Songbird and Qurro in different conda environments.
3037
- Updated the "ALDEx2" notebook to explain how we recommend installing ALDEx2
3138
nowadays.
3239
- Updated the documentation to refer to the published version of the Mackerel
3340
data's paper ([Minich et al. 2020](https://journals.asm.org/doi/full/10.1128/mSphere.00401-20)).
41+
- Fixed various broken links in the documentation
42+
([#318](https://github.com/biocore/qurro/pull/318),
43+
[#320](https://github.com/biocore/qurro/pull/320)).
3444
- Ported Qurro's continuous integration from Travis CI to GitHub Actions
3545
([#316](https://github.com/biocore/qurro/issues/316)).
3646
- Improved Qurro's continuous integration in multiple ways:
3747
- Test on multiple QIIME 2 versions.
3848
- Test the standalone Qurro functionality on multiple Python versions.
3949
- Test the standalone Qurro functionality in a non-QIIME-2 environment
4050
(similar to EMPress' "standalone" CI).
41-
- Updated the development documentation regarding the minimum QIIME 2 version,
42-
incompatibilities between `black` and `click`, etc.
51+
- Updated the development documentation
52+
([`CONTRIBUTING.md`](https://github.com/biocore/qurro/blob/master/CONTRIBUTING.md))
53+
regarding the minimum QIIME 2 version, dependency version issues, etc.
4354

4455
## Qurro 0.7.1 (May 22, 2020)
4556
### Features added

CONTRIBUTING.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,25 @@ in this repository or email the Qurro development team
1010

1111
## Setting up a development environment
1212

13+
We'll use a QIIME 2 environment as the basis for creating our "development
14+
environment" -- this is convenient because some of Qurro's tests rely on QIIME
15+
2 being installed. (You could also create a development environment that does
16+
not use QIIME 2, some of Qurro's tests would not be able to be run in such an
17+
environment.)
18+
1319
1. Fork Qurro.
1420
1. Clone your fork of Qurro's source code to your computer.
1521
2. Create a development conda environment for Qurro:
1622
1. Install the latest version of QIIME 2 natively,
17-
[as you would normally](https://docs.qiime2.org/2022.2/install/native/).
18-
_You'll need to install a QIIME 2 version of at least 2020.11._
23+
[as you would normally](https://docs.qiime2.org/2022.8/install/native/).
24+
_You'll need to install a QIIME 2 version of at least 2022.8._
1925
2. In a terminal, navigate to the folder to which you cloned your fork of
2026
Qurro's source code above. Run `pip install -e .[dev]` inside this folder to
2127
install Qurro along with its normal and development Python dependencies.
22-
3. Install the various Node.js requirements for testing Qurro's JavaScript
28+
3. Install Black: `pip install "black >= 22.3.0"`. We don't include this in
29+
the development dependencies for reasons that are explained later in
30+
this document.
31+
4. Install the various Node.js requirements for testing Qurro's JavaScript
2332
code. This can be done by running
2433
`npm install -g mocha-headless-chrome jshint prettier@2.0.5 nyc`. Note that
2534
this will install these programs globally on your system.
@@ -53,22 +62,24 @@ generated by Qurro's Python tests, and is used to populate some of the
5362
JavaScript tests. Long story short, you'll just need to run `make test` (or
5463
just `make pytest`) before running `make jstest`.
5564

56-
### When running QIIME 2, Qurro, etc. I get `TypeError: __init__() got multiple values for argument 'obj'`
65+
### When running `qiime`, `qiime qurro`, etc. from the CLI I get `TypeError: __init__() got multiple values for argument 'obj'`
5766

58-
This happens due to a [Click](https://click.palletsprojects.com/en/8.1.x/)
67+
This happens due to a [Click](https://click.palletsprojects.com/)
5968
version being installed that is unsupported by
6069
QIIME 2. See [this q2cli issue](https://github.com/qiime2/q2cli/issues/259) for
6170
context. This can come up in development because one of Qurro's development
62-
dependencies is
63-
[Black](https://github.com/psf/black), and later versions of Black can rely
64-
on Click 8 (and as of writing QIIME 2 doesn't seem to support Click 8 yet).
65-
66-
If you run into this error, you can probably get around it by installing an
67-
older version of Black, although earlier versions of Click might disagree with
68-
the later versions that we use in the CI. There isn't a great solution for this
69-
yet that I know of (short of pinning Black to an earlier version and
70-
reformatting all the Python code accordingly...), but hopefully when QIIME 2
71-
supports Click 8 the problem will vanish.
71+
dependencies (used for auto-formatting and format-checking the Python code) is
72+
[Black](https://github.com/psf/black), and later versions of Black rely
73+
on Click 8 (and versions of QIIME 2 before 2022.8 do not support Click 8).
74+
75+
Pinning to an older version of Black causes another problem, because -- in this
76+
case -- the newer version of Click used in QIIME 2 2022.8 environments will
77+
break Black (with [this error](https://github.com/psf/black/issues/2964)).
78+
79+
So, we get around this issue by removing Black from our development
80+
dependencies completely. If you installed a version of QIIME 2 of at least
81+
2022.8, then installing Black (in the directions above) should not cause
82+
problems (or at least it should not cause these particular problems).
7283

7384
## Acknowledgements
7485

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ jstest:
3232
nyc instrument qurro/support_files/js/ qurro/tests/web_tests/instrumented_js/
3333
mocha-headless-chrome -f qurro/tests/web_tests/index.html -c js_coverage.json
3434

35+
stylecheck: stylecheck_not_black stylecheck_black
36+
37+
stylecheck_black:
38+
black --check -l 79 qurro/ setup.py
39+
3540
# Assumes this is being run from the root directory of the qurro repo
3641
# (since that's where the .jshintrc is located).
37-
stylecheck:
42+
stylecheck_not_black:
3843
flake8 --ignore=E203,W503 qurro/ setup.py
39-
black --check -l 79 qurro/ setup.py
4044
jshint $(JSLOCS)
4145
prettier --check --tab-width 4 $(JSLOCS) $(HTMLCSSLOCS)
4246

README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ Qurro can be used standalone (as a Python 3 script that generates a
5858
folder containing a HTML/JS/CSS visualization) or as a
5959
[QIIME 2](https://qiime2.org/) plugin (that generates a QZV file that can be
6060
visualized at [view.qiime2.org](https://view.qiime2.org/) or by using
61-
`qiime tools view`). *Starting with Qurro v0.8.0, Qurro requires a QIIME 2
62-
version of at least 2020.11.*
63-
64-
Qurro should work with most modern web browsers. Firefox or Chrome are
65-
recommended.
61+
`qiime tools view`).
6662

6763
Qurro is still being developed, so backwards-incompatible changes might
6864
occur. If you have any bug reports, feature requests, questions, or if you just
@@ -85,7 +81,18 @@ can be viewed online [here](https://biocore.github.io/qurro/demos/red_sea/index.
8581

8682
## Installation and Usage
8783

88-
You can install Qurro using [pip](https://pip.pypa.io/en/stable/) or [conda](https://docs.conda.io/en/latest/). In either case, a python version of at least 3.6 and less than 3.10 is required to use Qurro.
84+
You can install Qurro using [pip](https://pip.pypa.io/en/stable/)
85+
or [conda](https://docs.conda.io/en/latest/).
86+
87+
### System requirements
88+
**If you're using Qurro within QIIME 2,** you will need a QIIME 2 version of at
89+
least 2020.11.
90+
91+
**If you're using Qurro outside of QIIME 2,** you will need a Python version of
92+
at least 3.6 and less than 3.10.
93+
94+
In either case, Qurro should work with most modern web browsers; Firefox or Chrome are
95+
recommended.
8996

9097
### Installing with `pip`
9198
```bash
@@ -203,8 +210,11 @@ For python testing/style checking, Qurro uses
203210
[pytest-cov](https://github.com/pytest-dev/pytest-cov),
204211
[flake8](http://flake8.pycqa.org/en/latest/), and
205212
[black](https://github.com/ambv/black). You'll also need to have QIIME 2
206-
installed to run most of the python tests (your QIIME 2 version should be at
207-
least 2020.11; this is the version which switched to pandas >= 1).
213+
installed to run most of the python tests (note that, due to click vs. black
214+
vs. QIIME 2 dependency issues, you should use a QIIME 2 environment of at least
215+
2022.8; see
216+
[`CONTRIBUTING.md`](https://github.com/biocore/qurro/blob/master/CONTRIBUTING.md)
217+
for details).
208218

209219
For JavaScript testing/style checking, Qurro uses
210220
[Mocha](https://mochajs.org/), [Chai](https://www.chaijs.com/),

screenshots/redsea_data.png

18.2 KB
Loading

setup.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@
100100
"pytest >= 4.2",
101101
"pytest-cov >= 2.0",
102102
"flake8",
103-
# If we don't pin black to being at least 22.3.0, then it and click
104-
# will conflict w/ an error: https://github.com/psf/black/pull/2966
105-
"black >= 22.3.0",
106103
"nbconvert",
107104
]
108105
},

0 commit comments

Comments
 (0)