Skip to content

Commit

Permalink
Merge pull request #464 from d33bs/bump-minimum-python
Browse files Browse the repository at this point in the history
build(python): bump minimum Python version to 3.9
  • Loading branch information
kenibrewer authored Oct 30, 2024
2 parents e8880bc + 09b9cef commit 63f728a
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
os:
- macos-13
- ubuntu-22.04
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11"]
runs-on: ${{ matrix.os }}
env:
OS: ${{ matrix.os }}
Expand Down
61 changes: 6 additions & 55 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pycytominer/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Aggregate profiles based on given grouping variables.
"""

from typing import Any, Dict, List, Optional, Union
from typing import Any, Optional, Union

import numpy as np
import pandas as pd
Expand All @@ -16,15 +16,15 @@

def aggregate(
population_df: pd.DataFrame,
strata: List[str] = ["Metadata_Plate", "Metadata_Well"],
features: Union[List[str], str] = "infer",
strata: list[str] = ["Metadata_Plate", "Metadata_Well"],
features: Union[list[str], str] = "infer",
operation: str = "median",
output_file: Optional[str] = None,
output_type: Optional[str] = "csv",
compute_object_count: bool = False,
object_feature: str = "Metadata_ObjectNumber",
subset_data_df: Optional[pd.DataFrame] = None,
compression_options: Optional[Union[str, Dict[str, Any]]] = None,
compression_options: Optional[Union[str, dict[str, Any]]] = None,
float_format: Optional[str] = None,
) -> Optional[pd.DataFrame]:
"""Combine population dataframe variables by strata groups using given operation.
Expand Down
16 changes: 8 additions & 8 deletions pycytominer/cyto_utils/cells.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, Union, Optional
from typing import Union, Optional

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -40,7 +40,7 @@ class SingleCells:
output_file : str, default None
If specified, the location to write the file.
compartments : list of str, default ["cells", "cytoplasm", "nuclei"]
List of compartments to process.
list of compartments to process.
compartment_linking_cols : dict, default noted below
Dictionary identifying how to merge columns across tables.
merge_cols : list of str, default ["TableNumber", "ImageNumber"]
Expand All @@ -50,9 +50,9 @@ class SingleCells:
add_image_features: bool, default False
Whether to add image features to the profiles.
image_feature_categories : list of str, optional
List of categories of features from the image table to add to the profiles.
list of categories of features from the image table to add to the profiles.
features: str or list of str, default "infer"
List of features that should be loaded or aggregated.
list of features that should be loaded or aggregated.
load_image_data : bool, default True
Whether or not the image data should be loaded into memory.
image_table_name : str, default "image"
Expand All @@ -64,7 +64,7 @@ class SingleCells:
subsampling_random_state : str or int, default None
The random state to init subsample.
fields_of_view : list of int, str, default "all"
List of fields of view to aggregate.
list of fields of view to aggregate.
fields_of_view_feature : str, default "Metadata_Site"
Name of the fields of view feature.
object_feature : str, default "Metadata_ObjectNumber"
Expand Down Expand Up @@ -683,7 +683,7 @@ def merge_single_cells(
compression_options: Optional[str] = None,
float_format: Optional[str] = None,
single_cell_normalize: bool = False,
normalize_args: Optional[Dict] = None,
normalize_args: Optional[dict] = None,
platemap: Optional[Union[str, pd.DataFrame]] = None,
**kwargs,
):
Expand Down Expand Up @@ -907,7 +907,7 @@ def _sqlite_strata_conditions(df, dtypes, n=1):
df : pandas.core.frame.DataFrame
A dataframe where columns are merge_cols and rows represent
unique aggregation strata of the compartment table
dtypes : Dict[str, str]
dtypes : dict[str, str]
Dictionary to look up SQLite datatype based on column name
n : int
Number of rows of the input df to combine in each output
Expand All @@ -918,7 +918,7 @@ def _sqlite_strata_conditions(df, dtypes, n=1):
Returns
-------
grouped_conditions : List[str]
grouped_conditions : list[str]
A list of strings, each string being a valid SQLite conditional
Examples
Expand Down
6 changes: 3 additions & 3 deletions pycytominer/cyto_utils/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import os
import pandas as pd
from typing import Union, List
from typing import Union

blocklist_file = os.path.join(
os.path.dirname(__file__), "..", "data", "blocklist_features.txt"
Expand Down Expand Up @@ -194,8 +194,8 @@ def drop_outlier_features(


def convert_compartment_format_to_list(
compartments: Union[List[str], str],
) -> List[str]:
compartments: Union[list[str], str],
) -> list[str]:
"""Converts compartment to a list.
Parameters
Expand Down
6 changes: 3 additions & 3 deletions pycytominer/cyto_utils/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Utility function to compress output data
"""

from typing import Dict, Union, Optional, Any
from typing import Union, Optional, Any

import pandas as pd

Expand All @@ -15,7 +15,7 @@ def output(
output_type: Optional[str] = "csv",
sep: str = ",",
float_format: Optional[str] = None,
compression_options: Optional[Union[str, Dict[str, Any]]] = {
compression_options: Optional[Union[str, dict[str, Any]]] = {
"method": "gzip",
"mtime": 1,
},
Expand Down Expand Up @@ -105,7 +105,7 @@ def output(
return output_filename


def set_compression_method(compression: Optional[Union[str, Dict]]) -> Dict[str, Any]:
def set_compression_method(compression: Optional[Union[str, dict]]) -> dict[str, Any]:
"""Set the compression options
Parameters
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ repository = "https://github.com/cytomining/pycytominer"
include = [ { path = "poetry.lock", format = "sdist" } ]

[tool.poetry.dependencies]
python = ">=3.8,<3.12"
python = ">=3.9,<3.12"
numpy = ">=1.16.5"
scipy = ">=1.5"
pandas = ">=1.2.0"
Expand Down Expand Up @@ -117,7 +117,7 @@ files = [ "pycytominer/__about__.py" ]
root = "."

[tool.ruff]
target-version = "py38"
target-version = "py39"
line-length = 88
fix = true

Expand Down
10 changes: 4 additions & 6 deletions tests/test_cyto_utils/test_cell_locations.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""This tests the output from CellLocation class"""

from typing import List, Type

import pandas as pd
import pytest
from _pytest.fixtures import FixtureRequest
Expand Down Expand Up @@ -38,8 +36,8 @@ def get_metadata_input_dataframe(cell_loc: CellLocation) -> pd.DataFrame:
],
)
def test_output_shape_and_required_columns(
cell_loc_param: List[str],
request: Type[FixtureRequest],
cell_loc_param: list[str],
request: type[FixtureRequest],
):
"""
This tests the shape of the output from CellLocation class and verifies that the required columns are present
Expand Down Expand Up @@ -71,8 +69,8 @@ def test_output_shape_and_required_columns(
],
)
def test_output_value_correctness(
cell_loc_param: List[str],
request: Type[FixtureRequest],
cell_loc_param: list[str],
request: type[FixtureRequest],
):
"""
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
Expand Down

0 comments on commit 63f728a

Please sign in to comment.