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

Migrate to poetry and pyproject.toml, adopt ruff and pre-commit, reorganize tests and CI, and update docs #57

Merged
merged 3 commits into from
Sep 13, 2024
Merged
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
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

124 changes: 0 additions & 124 deletions .github/workflows/ci.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: lint

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.12"

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

- name: Install dependencies
run: poetry install --no-root --no-interaction --only dev

- name: Run linting
run: poetry run make lint
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: test
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master

workflow_dispatch:

jobs:
test:
strategy:
matrix:
# TODO: Consider testing on macOS and Windows.
os: [ubuntu-latest] #, macos-latest, windows-latest]
# TODO: Consider testing on Python 3.9 - 3.12.
python-version: ["3.12"]
poetry-version: ["1.8.3"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Setup a local virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v3
name: Cache dependencies
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install project dependencies
run: poetry install --no-interaction
- name: Run tests
run: poetry run pytest
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ readlif.egg-info
#Ignore all compiled python files (e.g. from running the unit tests):
*.pyc
*.pyo
*.py{}
*.py-e

#Ignore testing files
ignore.py
Expand All @@ -29,4 +27,4 @@ ignore.py
htmlcov

#Ignore testing files that I don't have permission to share
tests/private/*
tests/private/*
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
exclude: (/ignore/|/dist/)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-yaml
- id: check-toml
- id: check-json
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: debug-statements
- id: trailing-whitespace
- id: mixed-line-ending
- id: end-of-file-fixer

- repo: local
hooks:
- id: format
name: Format
entry: make format
language: system
pass_filenames: false

- id: lint
name: Lint
entry: make lint
language: system
pass_filenames: false
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ formats: all
python:
version: 3.7
install:
- requirements: docs/requirements.txt
- requirements: docs/requirements.txt
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.formatOnSave": false
}
71 changes: 71 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@

## Changelog

#### 0.6.5
- Added a new attribute `settings` to `LifImage` which contains useful capture settings (Thanks to PR from @tmtenbrink).

#### 0.6.4
- Fixed bug and incompatibility in 0.6.3.
- Added preliminary fix for images captured with stage navigator.

#### 0.6.3
- Added support for updated LasX with additional data in the LIF file.
- Changed the way file names are assigned, now includes folder path. This fix is intended to clarify imaging sets with many duplicate names.

#### 0.6.2
- Fixed bug where the time and image scale were calculated incorrectly.
- Clarified scaling documentation.

#### 0.6.1
- Update readme.

#### 0.6.0
- Added support for non-XY images with `get_plane()`. See docs for usage. Note: Reading arbitrary planes (i.e. an XZ plane of an XY image) is not yet supported.

#### 0.5.2
- Bugfix: Fix error in mosaic parsing. `PosX` metadata was incorrectly read from `PosY`.

#### 0.5.1
- Bugfix: switch from `io.BufferedIOBase` to `io.IOBase`.

#### 0.5.0
- Added support for loading files from buffers (thanks to PR from @JacksonMaxfield).

#### 0.4.1
- Fixed critical documentaiton error: `LifImage.scale` is in px/µm, not px/nm for X and Y dimensions.

#### 0.4.0
- Added support for tiled images:
- `m` was added as a new dimension (for tiled images).
- `LifImage` changes:
- New `get_iter_m()` function.
- New `mosaic_position` attribute with `(FieldX, FieldY, PosX, PosY)`.
- Under the hood changes:
- `LifImage.dims` is now a named tuple for clearer code.
- Other changes:
- Prettier outputs for `repr()`.
- Switch to github CI.

#### 0.3.1
- Added error message for tiled images, pending feature addition.

#### 0.3.0
- Added support for 16-bit images, increased minimum Pillow version to 7.2.0.
- New `LifImage` attribute `bit_depth` is a tuple of intigers descibing the bit depth for each channel in the image.
- Thanks to @DirkRemmers for providing the example file.
- Changed type from `str` to `int` for `dims` and `channels` in the `info` dictionary.
- Added python 3.9 to build testing.

#### 0.2.1
- Fixed `ZeroDivisionError` when the Z-dimension is defined, but has a length of 0.
- Clarified an error message.
- Added fix for truncated files.

#### 0.2.0
- `LifImage.scale` now returns px/nm conversions.

#### 0.1.1
- Style changes.

#### 0.1.0
- Initial release.
Loading
Loading