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

Speed up (using mamba) and fix the CI; better installation documentation #69

Merged
merged 11 commits into from
Sep 14, 2023
43 changes: 20 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Based roughly on the main.yml and standalone.yml workflows in
# https://github.com/biocore/empress/blob/master/.github/workflows/,
# and on https://docs.github.com/en/actions/quickstart
# https://docs.github.com/en/actions/quickstart, and
# https://github.com/fedarko/wotplot/blob/ce702b63bf790c41d02b0493e3a7eebda6fcec70/.github/workflows/main.yml
# (which i based off of this file originally, so it's an ouroboros of me
# copying code from myself because i can never remember how yaml works)
name: strainFlye CI
on: [push, pull_request]
jobs:
Expand All @@ -22,35 +25,29 @@ jobs:
- name: Check out code
uses: actions/checkout@v3

# https://github.com/conda-incubator/setup-miniconda#example-3-other-options
- name: Install conda dependencies
uses: conda-incubator/setup-miniconda@v2
# https://github.com/mamba-org/setup-micromamba
- name: Install conda dependencies with mamba
uses: mamba-org/setup-micromamba@v1
with:
activate-environment: strainflye
environment-file: environment.yml
python-version: ${{ matrix.python-version }}

# We need to keep saying "run this command from within the 'strainflye'
# conda environment", and we can do this easily by prefixing commands
# with "conda run -n" (as done in EMPress' main.yml file, linked above).
# I don't know of a more elegant way to do this; I do know that
# installing everything into the "base" environment (as done in, e.g.,
# https://autobencoder.com/2020-08-24-conda-actions) would remove the
# need to keep re-activating the strainflye environment, but it'd have
# the effect of polluting the base environment (which is not ideal
# practice, according to
# https://github.com/marketplace/actions/setup-miniconda#environment-activation).
create-args: python=${{ matrix.python-version }}
init-shell: bash

- name: Install strainFlye (and pip dependencies)
run: conda run -n strainflye pip install -e .[dev]
run: pip install -e .[dev]
shell: bash -el {0}

- name: Lint and stylecheck
run: make stylecheck
shell: bash -el {0}

- name: Run tests
run: conda run -n strainflye make test
run: make test
shell: bash -el {0}

- name: Check that the strainFlye CLI seems good
run: conda run -n strainflye strainFlye

- name: Lint and stylecheck
run: conda run -n strainflye make stylecheck
run: strainFlye
shell: bash -el {0}

- name: Upload code coverage information to Codecov
uses: codecov/codecov-action@v2
14 changes: 12 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,19 @@ conda activate strainflye
pip install -e .[dev]
```

### Sidenote: using mamba instead of conda

You may prefer to create the environment using
[mamba](https://mamba.readthedocs.io) instead of conda, since mamba can be much
faster. As of writing, probably the easiest way to do this is to create an
empty environment and then
[update it based on `environment.yml`](https://github.com/mamba-org/mamba/issues/633#issuecomment-812272143).

### Sidenote: installing LJA in order to use `strainFlye smooth assemble`

If you want to work on `strainFlye smooth assemble` then you may also want to
install [LJA](https://github.com/AntonBankevich/LJA), as discussed in the
strainFlye README. (That said, as of writing strainFlye's tests do not rely on
install [LJA](https://github.com/AntonBankevich/LJA), as is discussed in the
strainFlye README. (That said: as of writing strainFlye's tests do not rely on
LJA being installed, so this step is optional.)

## Development commands
Expand Down
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,26 @@ supporting Python 3.6 and 3.7). strainFlye depends on a few non-Python tools
### Installation using conda (recommended)

The simplest way to install strainFlye is by using
[conda](https://conda.io/). strainFlye is available through the
[bioconda](https://bioconda.github.io/) channel:
[conda](https://conda.io/) (or [mamba](https://mamba.readthedocs.io)).
strainFlye is available through the [bioconda](https://bioconda.github.io/)
channel:

```bash
conda install -c bioconda strainflye
```

(If you run into dependency conflicts when installing strainFlye into an
existing conda environment, you may want to just create a new conda environment
and install strainFlye into that.)
#### Sidenote: troubleshooting installation problems

- If you run into dependency conflicts when installing strainFlye into an
existing conda environment, you may want to just create a new conda environment
and install strainFlye into that. (See the "workaround solution" given in
[this issue](https://github.com/fedarko/strainFlye/issues/70) for an
example.)

- If that still doesn't work, you can try installing from source -- see below.

- And if _that_ doesn't work, no worries -- installing this stuff can be finicky.
Feel free to open an issue and I'll try to help out.

### Installation from source

Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: strainflye
channels:
- conda-forge
- bioconda
- defaults
- nodefaults
dependencies:
# HACK to accommodate pysam / pysamstats for now -- see
# https://github.com/fedarko/strainFlye/issues/8
- python >= 3.6, <= 3.7
- python >= 3.6, < 3.8

# Based on what pysam and pysamstats use currently -- see
# https://github.com/pysam-developers/pysam/blob/master/requirements.txt
Expand Down
Loading