Anopheles refactor part 1 - AnophelesBase#380
Conversation
| site_filters_analysis=None, | ||
| pre=False, | ||
| **kwargs, # used by simplecache, init_filesystem(url, **kwargs) | ||
| **storage_kwargs, # used by fsspec via init_filesystem(url, **kwargs) |
| gcs_url=GCS_URL, | ||
| major_version_number=MAJOR_VERSION_INT, | ||
| major_version_path=MAJOR_VERSION_GCS_STR, |
There was a problem hiding this comment.
Moving these parameters to the super-class constructor makes testing much easier.
| # test duplicates are handled | ||
| df_dup = anoph.sample_sets(release=[release, release]) | ||
| assert_frame_equal(df_sample_sets, df_dup) |
There was a problem hiding this comment.
Slight change of behaviour here, seemed more friendly just to handle and dups.
| matrix: | ||
| python-version: ['3.10'] | ||
| poetry-version: ['1.4.1'] | ||
| os: [ubuntu-latest] | ||
| runs-on: ${{ matrix.os }} |
There was a problem hiding this comment.
Taking the opportunity to simplify the action, we don't actually need a matrix here.
| python-version: ['3.8', '3.9', '3.10'] | ||
| poetry-version: ['1.4.1'] | ||
| os: [ubuntu-latest] | ||
| runs-on: ${{ matrix.os }} |
There was a problem hiding this comment.
Taking the opportunity to simplify the action, keeping only the parameters which are needed in the matrix.
| Install Python 3.8 (current recommended version for local development), e.g.: | ||
|
|
||
| ```bash | ||
| sudo add-apt-repository ppa:deadsnakes/ppa | ||
| sudo apt install python3.10 python3.10-venv | ||
| sudo apt install python3.8 python3.8-venv | ||
| ``` | ||
|
|
||
| Install pipx, e.g.: | ||
|
|
||
| ```bash | ||
| python3.10 -m pip install --user pipx | ||
| python3.10 -m pipx ensurepath | ||
| python3.8 -m pip install --user pipx | ||
| python3.8 -m pipx ensurepath | ||
| ``` | ||
|
|
||
| Install [poetry](https://python-poetry.org/docs/#installation), e.g.: | ||
|
|
||
| ```bash | ||
| pipx install poetry==1.4.1 --python=/usr/bin/python3.10 | ||
| pipx install poetry==1.4.1 --python=/usr/bin/python3.8 | ||
| ``` | ||
|
|
||
| Create development environment: | ||
|
|
||
| ```bash | ||
| cd malariagen-data-python | ||
| poetry use 3.10 | ||
| poetry use 3.8 | ||
| poetry install | ||
| ``` |
There was a problem hiding this comment.
Recommending Python 3.8 for local development, because otherwise if we use a later Python we can accidentally try to use features not supported in Python 3.8, which doesn't then crop up until CI fails. Better to fail fast locally.
| # Run a subset of tests first which run quickly to fail fast. | ||
| - name: Run fast unit tests | ||
| run: poetry run pytest -v tests/anoph |
There was a problem hiding this comment.
Pulling out a subset of tests here which are guaranteed to run fast, so we fail faster if there are any obvious bugs.
|
Keen to push ahead here so planning to merge soon if no objections, but please shout if you'd like more time to review. |
|
Thanks @leehart 🙏 |
|
Sent from my iPhoneOn 31 Mar 2023, at 17:06, Alistair Miles ***@***.***> wrote:
Keen to push ahead here so planning to merge soon if no objections, but please shout if you'd like more time to review.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because your review was requested.Message ID: ***@***.***>
|
|
Sorry was at the pub Sent from my iPhoneOn 31 Mar 2023, at 17:06, Alistair Miles ***@***.***> wrote:
Keen to push ahead here so planning to merge soon if no objections, but please shout if you'd like more time to review.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because your review was requested.Message ID: ***@***.***>
|
This PR begins the work of breaking up the
AnophelesDataResourceclass into a number of smaller classes with related and self-contained functionality, as proposed in #366.Here a new class
AnophelesBaseis created, which assumes responsibility for loading release configuration and accessing release manifests (sample sets).Note also that some new tests are added which specifically test this new class. These new tests use locally-created data which mimics the organisation and format of data in Ag3 and Af1 but is local and smaller to allow for faster test runs.
Also resolves #368 along the way.