Skip to content

Commit 2cd5ad5

Browse files
d33bsgwaybioshntnu
authored
bump: version 1.0.1 → 1.1.0 (#374)
* bump: version 1.0.1 → 1.1.0 * Apply suggestions from code review Co-authored-by: Gregory Way <[email protected]> * linting * update changelog template capitalization * add poetry context for cz commands * fix(tests): update CellLoc s3 JUMP paths and tests Co-Authored-By: Shantanu Singh <[email protected]> --------- Co-authored-by: Gregory Way <[email protected]> Co-authored-by: Shantanu Singh <[email protected]>
1 parent 4e84a04 commit 2cd5ad5

File tree

7 files changed

+107
-44
lines changed

7 files changed

+107
-44
lines changed

CHANGELOG.md

+48
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,51 @@
1+
## v1.1.0 (2024-03-05)
2+
3+
[Detailed release notes](https://github.com/cytomining/pycytominer/releases/tag/v1.1.0)
4+
5+
### Fix
6+
7+
- **build**: fix build versioning
8+
- simplify Spherize transform – epsilon to regularize instead of clip, add additional checks (see #320)
9+
10+
### Refactor
11+
12+
- **docs**: apply flake8-builtins checks
13+
- **dev**: apply pyflakes checks
14+
- **dev**: apply flake8-simplify checks
15+
16+
### Test
17+
18+
- add flake8-bandit ignores
19+
- add clarifying comments for cell_loc test
20+
- update cell_loc s3 paths and testing
21+
22+
### Docs
23+
24+
- update Readme with Citation section
25+
- **template**: PR template attribution to comment
26+
- **changelog**: add commitizen template
27+
- add description of ruff linting/formatting
28+
- reorganize style guide
29+
30+
### CI
31+
32+
- add versioned artifact build action
33+
- **integration-test**: add explicit artifact retention time
34+
- add pygrep-hooks and flake8-20202 checks
35+
36+
### Style
37+
38+
- swap out black for ruff-format
39+
- apply pyupgrade checks
40+
- **devcontainer**: add ruff extension
41+
- apply ruff native checks
42+
- apply pycodestyle checks
43+
- add flake8-comprehensions checks
44+
45+
### Build
46+
47+
- **poetry**: make dev dep group optional
48+
149
## v1.0.1 (2023-11-07)
250

351
[Detailed Release Notes](https://github.com/cytomining/pycytominer/releases/tag/v1.0.1)

CITATION.cff

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ authors:
8585
orcid: https://orcid.org/0000-0002-0503-9348
8686
title: "Reproducible image-based profiling with Pycytominer"
8787
# This version is updated using `cz bump` command
88-
version: "1.0.1"
88+
version: "1.1.0"
8989
license: BSD 3-Clause License
9090
repository-code: "https://github.com/cytomining/pycytominer"
9191
doi: 10.48550/arXiv.2311.13417

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ Creating a new release includes the following steps:
179179
1. Create a new branch from `main` for the release (e.g. `release-v1.0.0`)
180180
2. Review the [commit history](https://github.com/cytomining/pycytominer/compare) from the last release and check whether it includes commits that don't follow the [conventional commit standard](https://www.conventionalcommits.org/en/v1.0.0/#summary).
181181
If all changes follow conventional commits, skip to step 5.
182-
3. Run the command `cz bump --files-only` to update the version number in `CITATION.cff` and `pyproject.toml:tool.commitizen` and generate the draft changelog.
182+
3. Run the command `poetry run cz bump --files-only` to update the version number in `CITATION.cff` and `pyproject.toml:tool.commitizen` and generate the draft changelog.
183183
4. Review the changes to `CHANGELOG.md`. If necessary, add descriptions of missing changes and modify descriptions to match conventional commits standard.
184-
5. `git add` any manual changes and run `cz bump` to create the release commit.
184+
5. `git add` any manual changes and run `poetry run cz bump` to create the release commit.
185185
Push the changes to the release branch.
186186
6. Create a pull request for the release branch into `main`.
187187
7. Request a review from another maintainer.

dev_tools/commitizen/CHANGELOG.md.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## {{ entry.version }}{% if entry.date %} ({{ entry.date }}){% endif %}
55

66
{# Add link to the detailed GitHub release notes #}
7-
[Detailed Release Notes](https://github.com/cytomining/pycytominer/releases/tag/{{ entry.version }})
7+
[Detailed release notes](https://github.com/cytomining/pycytominer/releases/tag/{{ entry.version }})
88

99
{% for change_key, changes in entry.changes.items() %}
1010

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ files = ["pycytominer/__about__.py"]
101101

102102
[tool.commitizen]
103103
# This version is used for changelog tracking and is updated using `cz bump`
104-
version = "1.0.1"
104+
version = "1.1.0"
105105
name = "cz_conventional_commits"
106106
tag_format = "v$version"
107107
version_scheme = "pep440"

tests/test_cyto_utils/conftest.py

+2-26
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ def fixture_metadata_input_file_s3() -> str:
4444
"""
4545
Provide a metadata input file for cell_locations test data
4646
"""
47-
return "s3://cellpainting-gallery/test-cpg0016-jump/source_4/workspace/load_data_csv/2021_08_23_Batch12/BR00126114/test_BR00126114_load_data_with_illum.parquet"
47+
return "s3://cellpainting-gallery/cpg0016-jump/source_4/workspace/load_data_csv/2021_08_23_Batch12/BR00126114/load_data_with_illum.parquet"
4848

4949

5050
@pytest.fixture(name="single_cell_input_file_s3")
5151
def fixture_single_cell_input_file_s3() -> str:
5252
"""
5353
Provide a single cell input file for cell_locations test data
5454
"""
55-
return "s3://cellpainting-gallery/test-cpg0016-jump/source_4/workspace/backend/2021_08_23_Batch12/BR00126114/test_BR00126114.sqlite"
55+
return "s3://cellpainting-gallery/cpg0016-jump/source_4/workspace/backend/2021_08_23_Batch12/BR00126114/BR00126114.sqlite"
5656

5757

5858
@pytest.fixture(name="metadata_input_dataframe")
@@ -113,27 +113,3 @@ def fixture_cell_loc_obj3(
113113
metadata_input=metadata_input_file_s3,
114114
single_cell_input=single_cell_input_file_s3,
115115
)
116-
117-
118-
@pytest.fixture(name="cell_loc1")
119-
def fixture_cell_loc1(cell_loc_obj1: CellLocation) -> pd.DataFrame:
120-
"""
121-
Provide the output of running CellLocation.add_cell_location
122-
"""
123-
return cell_loc_obj1.add_cell_location()
124-
125-
126-
@pytest.fixture(name="cell_loc2")
127-
def fixture_cell_loc2(cell_loc_obj2: CellLocation) -> pd.DataFrame:
128-
"""
129-
Provide the output of running CellLocation.add_cell_location
130-
"""
131-
return cell_loc_obj2.add_cell_location()
132-
133-
134-
@pytest.fixture(name="cell_loc3")
135-
def fixture_cell_loc3(cell_loc_obj3: CellLocation) -> pd.DataFrame:
136-
"""
137-
Provide the output of running CellLocation.add_cell_location
138-
"""
139-
return cell_loc_obj3.add_cell_location()

tests/test_cyto_utils/test_cell_locations.py

+52-13
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,50 @@
22

33
import pandas as pd
44
import pytest
5-
import sqlalchemy
6-
from typing import Type
5+
from typing import Type, List
6+
from pycytominer.cyto_utils.cell_locations import CellLocation
77
from _pytest.fixtures import FixtureRequest
88

99

10-
@pytest.mark.parametrize("cell_loc", ["cell_loc1", "cell_loc2", "cell_loc3"])
10+
def get_metadata_input_dataframe(cell_loc: CellLocation) -> pd.DataFrame:
11+
"""
12+
Gathers the metadata input dataframe given various conditions
13+
from a CellLocation object.
14+
"""
15+
16+
return (
17+
pd.read_parquet(
18+
cell_loc.metadata_input,
19+
# set storage options if we have an s3 path
20+
storage_options={"anon": True}
21+
if isinstance(cell_loc.metadata_input, str)
22+
and cell_loc.metadata_input.startswith("s3://")
23+
else None,
24+
)
25+
if isinstance(cell_loc.metadata_input, str)
26+
else cell_loc.metadata_input
27+
)
28+
29+
30+
@pytest.mark.parametrize(
31+
"cell_loc_param",
32+
[
33+
"cell_loc_obj1",
34+
"cell_loc_obj2",
35+
"cell_loc_obj3",
36+
],
37+
)
1138
def test_output_shape_and_required_columns(
12-
cell_loc: str,
13-
metadata_input_dataframe: pd.DataFrame,
39+
cell_loc_param: List[str],
1440
request: Type[FixtureRequest],
1541
):
1642
"""
1743
This tests the shape of the output from CellLocation class and verifies that the required columns are present
1844
"""
1945

20-
cell_loc = request.getfixturevalue(cell_loc)
46+
cls_cell_loc = request.getfixturevalue(cell_loc_param)
47+
cell_loc = cls_cell_loc.add_cell_location()
48+
metadata_input_dataframe = get_metadata_input_dataframe(cell_loc=cls_cell_loc)
2149

2250
# check the shape of the data
2351
assert cell_loc.shape == (
@@ -31,17 +59,25 @@ def test_output_shape_and_required_columns(
3159
assert "Nuclei_Location_Center_Y" in cell_loc["CellCenters"][0][0]
3260

3361

34-
@pytest.mark.parametrize("cell_loc", ["cell_loc1", "cell_loc2", "cell_loc3"])
62+
@pytest.mark.parametrize(
63+
"cell_loc_param",
64+
[
65+
"cell_loc_obj1",
66+
"cell_loc_obj2",
67+
"cell_loc_obj3",
68+
],
69+
)
3570
def test_output_value_correctness(
36-
cell_loc: str,
37-
metadata_input_dataframe: pd.DataFrame,
38-
single_cell_input_file: str,
71+
cell_loc_param: List[str],
3972
request: Type[FixtureRequest],
4073
):
4174
"""
4275
This tests the correctness of the values in the output from CellLocation class by comparing the values in the output to the values in the input
4376
"""
44-
cell_loc = request.getfixturevalue(cell_loc)
77+
78+
cls_cell_loc = request.getfixturevalue(cell_loc_param)
79+
cell_loc = cls_cell_loc.add_cell_location()
80+
metadata_input_dataframe = get_metadata_input_dataframe(cell_loc=cls_cell_loc)
4581

4682
# if we restrict the columns of cell_loc to the ones in metadata_input_dataframe, we should get the same dataframe
4783
assert (
@@ -50,7 +86,8 @@ def test_output_value_correctness(
5086
.equals(metadata_input_dataframe.reset_index(drop=True))
5187
)
5288

53-
engine = sqlalchemy.create_engine(f"sqlite:///{single_cell_input_file}")
89+
# gather an engine from the cell_loc class
90+
_, engine = cls_cell_loc._get_single_cell_engine()
5491

5592
nuclei_query = "SELECT ImageNumber, ObjectNumber, Nuclei_Location_Center_X, Nuclei_Location_Center_Y FROM Nuclei;"
5693

@@ -59,7 +96,9 @@ def test_output_value_correctness(
5996
# get the values in the Nuclear_Location_Center_X and Nuclear_Location_Center_Y columns
6097
# for the rows in nuclei_df that have ImageNumber == 1
6198

62-
nuclei_df_row1 = nuclei_df[nuclei_df["ImageNumber"] == "1"]
99+
# note: we cast to "int64" type to ensure all cell_loc_obj's are treated the same
100+
# (some include ImageNumber's of type obj, others are int64)
101+
nuclei_df_row1 = nuclei_df[nuclei_df["ImageNumber"].astype("int64") == 1]
63102

64103
observed_x = [x["Nuclei_Location_Center_X"] for x in cell_loc.CellCenters[0]]
65104
observed_y = [x["Nuclei_Location_Center_Y"] for x in cell_loc.CellCenters[0]]

0 commit comments

Comments
 (0)