Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions .github/workflows/test-ml.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Test ML pipeline

on:
Expand All @@ -17,16 +14,23 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Set up Python 3.10
uses: actions/setup-python@main # Need latest version to use pyproject.toml instead of requirements.txt
with:
python-version: "3.10"
cache: "pip"
run: uv python install 3.10

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
run: uv sync --no-default-groups

- name: Cache ML models
uses: actions/cache@v4
with:
path: ~/.config/AMI/models
key: ml-models-v1

- name: Run ML tests
run: |
ami test pipeline
uv run ami test pipeline
37 changes: 11 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,25 @@ jobs:
test:
name: Run Python Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: |
poetry.lock
pyproject.toml

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached Poetry virtualenv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction
run: uv sync

- name: Run tests
run: |
# Clean any cached Python files before running tests
find . -type d -name "__pycache__" -exec rm -r {} +
find . -type f -name "*.pyc" -delete
poetry run pytest --import-mode=importlib
uv run pytest --import-mode=importlib
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

23 changes: 8 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Desktop app for analyzing images from autonomous insect monitoring stations usin

## Dependencies

- Requires Python 3.10. Use [Anaconda](https://www.anaconda.com/) (or [miniconda](https://docs.conda.io/en/latest/miniconda.html)) if you need to maintain multiple versions of Python or are unfamiliar with using Python and scientific packages, it is especially helpful on Windows. [PyEnv](https://github.com/pyenv/pyenv) is also a popular tool for managing multiple versions of python if you are familiar with the command line.
- Requires Python >=3.10, <3.13 (tested on 3.10 and 3.12). Use [uv](https://docs.astral.sh/uv/) (recommended), [Anaconda](https://www.anaconda.com/), or [PyEnv](https://github.com/pyenv/pyenv) to manage Python versions.

## Installation (for non-developers)

Expand All @@ -36,37 +36,30 @@ ami test pipeline

## Installation (for developers)

Create an environment just for AMI and the data companion using conda (or virtualenv)

```sh
conda create -n ami python=3.10 anaconda
```

Clone the repository using the command line or the GitHub desktop app.
Install [uv](https://docs.astral.sh/uv/getting-started/installation/) then clone and sync:

```sh
git clone git@github.com:RolnickLab/ami-data-companion.git
cd ami-data-companion
uv sync
```

Install as an editable package. This will install the dependencies and install the `trapdata` console command
To include the desktop GUI dependencies:

```sh
cd ami-data-companion
pip install -e .
uv sync --extra gui
```

Test the whole backend pipeline without the GUI using this command

```sh
python trapdata/tests/test_pipeline.py
# or
ami test pipeline
uv run ami test pipeline
```

Run all other tests with:

```sh
ami test all
uv run ami test all
```

## GUI Usage
Expand Down
Loading