Skip to content

Commit

Permalink
Adding support to Python 3.12 (#2027)
Browse files Browse the repository at this point in the history
* updating versioneer and add python 3.12 to setup files

* add python 3.12 to CI

* fix: python 3.12 flake8 linting error

* removing backslash sequences that raise SyntaxWarning in python 3.12+ when using sphinx-gallery to convert reST to markdown

* add python 3.12 support to docs

* docs: fixes to README.rst loading on PyPI project description (#2029)
  • Loading branch information
shachafl authored Nov 12, 2024
1 parent 64add94 commit a4fb226
Show file tree
Hide file tree
Showing 19 changed files with 1,085 additions and 460 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/starfish-prod-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
strategy:
matrix:
os: ["windows-latest", "ubuntu-latest"]
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
strategy:
matrix:
os: ["windows-latest", "ubuntu-latest"]
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand Down
22 changes: 13 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
starfish: scalable pipelines for image-based transcriptomics
========
============================================================


.. image:: docs/source/_static/design/logo.png
:scale: 50 %
.. image:: https://github.com/spacetx/starfish/blob/64add94b51dbf6f8f5fd614b02c4dfbf4b0d702d/docs/source/_static/design/logo.png?raw=True
:alt: starfish logo
:width: 312
:height: 127
:align: center

-----------------------------

Expand All @@ -23,15 +25,17 @@ starfish: scalable pipelines for image-based transcriptomics
:target: https://spacetx-starfish.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

.. image:: https://travis-ci.com/spacetx/starfish.svg?branch=master
:target: https://travis-ci.com/spacetx/starfish
.. image:: https://github.com/spacetx/starfish/actions/workflows/starfish-prod-ci.yml/badge.svg?branch=master
:target: https://github.com/spacetx/starfish/actions/workflows/starfish-prod-ci.yml
:alt: starfish production CI

.. image:: https://codecov.io/gh/spacetx/starfish/branch/master/graph/badge.svg
:target: https://codecov.io/gh/spacetx/starfish
:alt: Code Coverage

-------------------------------

*starfish* is a Python library for processing images of image-based spatial transcriptomics.
**starfish** is a Python library for processing images of image-based spatial transcriptomics.
It lets you build scalable pipelines that localize and quantify RNA transcripts in image data
generated by any FISH method, from simple RNA single-molecule FISH to combinatorial barcoded
assays.
Expand All @@ -47,7 +51,7 @@ See `spacetx-starfish.readthedocs.io <https://spacetx-starfish.readthedocs.io/en
Installation
------------

starfish supports python 3.9-11 and can easily be installed from PyPI:
starfish supports python 3.9-3.12 and can easily be installed from PyPI:

.. code-block:: bash
Expand All @@ -70,7 +74,7 @@ We welcome contributions from our users! See our contributing.rst_ and `develope
.. _contributing.rst: https://github.com/spacetx/starfish/blob/master/CONTRIBUTING.rst

Help, support, and questions
----------------
----------------------------

- Forum: ask on the `Image.sc forum <https://forum.image.sc/tag/starfish>`_
- Email: `[email protected] <mailto:[email protected]>`_
2 changes: 1 addition & 1 deletion docs/source/installation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Installation
============

Starfish supports python 3.9-11. To install the starfish package,
Starfish supports python 3.9-3.12. To install the starfish package,
first verify that your python version is compatible. You can check this by running :code:`python
--version`.

Expand Down
6 changes: 3 additions & 3 deletions examples/data_formatting/plot_format_tilefetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
# ---------------------------
# The :py:class:`.FetchedTile` subclass defines the function you need for reading your images and
# the other properties required by :py:func:`.write_experiment_json` to construct
# :class:`slicedimage.Tile`\s.
# :class:`slicedimage.Tile`.
#
# You can use any function to read images that returns a numpy array. We recommend using
# :py:class:`imageio.volread` for 3D images and :py:class:`skimage.io.imread` for 2D images. For
Expand Down Expand Up @@ -153,7 +153,7 @@ def tile_data(self) -> np.ndarray:
# Define TileFetcher subclass
# ---------------------------
# The :py:class:`.TileFetcher` subclass acts as the interface for :py:func:`.write_experiment_json`
# to know where to get files to construct :class:`slicedimage.Tile`\s.
# to know where to get files to construct :class:`slicedimage.Tile`.
#
# If you are not using structured data, you will need to extend :py:class:`TileFetcher` to reflect
# your own file naming and organization schema.
Expand Down Expand Up @@ -252,4 +252,4 @@ def get_tile(
from starfish import Experiment

exp = Experiment.from_json(os.path.join(outputdir.name, "experiment.json"))
print(exp.fovs())
print(exp.fovs())
6 changes: 3 additions & 3 deletions examples/data_formatting_examples/format_baristaseq.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ def get_tile(self, fov_id: int, hyb: int, ch_label: int, zplane_label: int) -> F
subdir = "primary"
round_dir = f"r{hyb}"
if hyb == 0:
filename = f"T{fov_id+1:05}C{ch_label+1:02}Z{zplane_label+1:03}.tif"
filename = f"T{fov_id + 1:05}C{ch_label + 1:02}Z{zplane_label + 1:03}.tif"
else:
filename = f"alignedT{fov_id+1:05}C{ch_label+1:02}Z{zplane_label+1:03}.tif"
filename = f"alignedT{fov_id + 1:05}C{ch_label + 1:02}Z{zplane_label + 1:03}.tif"
file_path = os.path.join(self.input_dir, subdir, round_dir, filename)
return BaristaSeqTile(file_path)

Expand All @@ -110,7 +110,7 @@ def __init__(self, input_dir, aux_type) -> None:

def get_tile(self, fov_id: int, hyb: int, ch_label: int, zplane_label: int) -> FetchedTile:
subdir = "nissl"
filename = f"T00001C05Z{zplane_label+1:03}.tif"
filename = f"T00001C05Z{zplane_label + 1:03}.tif"
file_path = os.path.join(self.input_dir, subdir, filename)

return BaristaSeqTile(file_path)
Expand Down
2 changes: 1 addition & 1 deletion examples/data_formatting_examples/format_starmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def __init__(self, input_dir: str) -> None:

def get_tile(
self, fov_id: int, round_label: int, ch_label: int, zplane_label: int) -> FetchedTile:
basename = f"reg_round0{round_label+ 1}_ch0{ch_label + 1}.tif" # translate to 3d
basename = f"reg_round0{round_label + 1}_ch0{ch_label + 1}.tif" # translate to 3d
file_path = os.path.join(self.input_dir, "reg3d", basename)
return StarMapTile(file_path, zplane_label)

Expand Down
2 changes: 1 addition & 1 deletion examples/data_loading/plot_tilefetcher_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Loading Data through TileFetchers
=================================
:py:class:`.TileFetcher`\s provide a way for starfish's data
:py:class:`.TileFetcher` provide a way for starfish's data
formatting tooling to obtain image data and metadata for each tile that make up an image. It is
possible to use this interface to directly load data into starfish. This could have performance
implications as the TileFetcher's performance could potentially be highly sensitive to the order
Expand Down
4 changes: 2 additions & 2 deletions examples/how_to/clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
:py:class:`~starfish.image.Filter.Clip` is useful for normalizing images, removing background,
and removing high-intensity outliers. If you want the values to start from zero after clipping see
:py:class:`~starfish.image.Filter.ClipPercentileToZero`. Both :py:class:`FilterAlgorithm`\s use
:py:class:`~starfish.image.Filter.ClipPercentileToZero`. Both :py:class:`FilterAlgorithm` use
percentiles to set the ``p_min`` and ``p_max`` values to clip by.
"""

Expand Down Expand Up @@ -44,4 +44,4 @@ def plot_intensity_histograms(stack: starfish.ImageStack, r: int):
clipper.run(stack, in_place=True)

# View distribution of intensities after clipping
plot_intensity_histograms(stack, r=0)
plot_intensity_histograms(stack, r=0)
2 changes: 1 addition & 1 deletion examples/how_to/plot_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
# tweak your layer properties (see `napari`_).
#
# However, napari doesn't natively support starfish data structures, so to use napari methods
# follow the example below. Adding :py:class:`.IntensityTable`\s is pretty complex,
# follow the example below. Adding :py:class:`.IntensityTable` is pretty complex,
# so we recommend sticking with :py:func:`.display` for that or using the method in the next
# section.
#
Expand Down
6 changes: 3 additions & 3 deletions examples/how_to/tracebuildingstrategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
:align: center
The chosen ``TraceBuilder`` must also be compatible with how the :py:class:`.SpotFindingResults`
was generated. :py:class:`.FindSpotsAlgorithm`\s can be run with or without a ``reference_image``.
was generated. :py:class:`.FindSpotsAlgorithm` can be run with or without a ``reference_image``.
If run with a ``reference_image`` then every :py:class:`.PerImageSliceSpotResults` in
:py:class:`.SpotFindingResults` will have the same spots for every (round, channel) image volume.
This is necessary for :py:func:`.build_spot_traces_exact_match` but not recommended for
Expand Down Expand Up @@ -88,7 +88,7 @@
####################################################################################################
# Typical pipelines will set the ``trace_building_strategy`` as an argument in the
# :py:class:`.DecodeSpotsAlgorithm` but here the underlying code is exposed to reveal what the
# different :py:class:`.IntensityTable`\s look like depending on which ``TraceBuilder`` is used.
# different :py:class:`.IntensityTable` look like depending on which ``TraceBuilder`` is used.

from starfish.core.spots.DecodeSpots.trace_builders import build_spot_traces_exact_match, \
build_traces_sequential, build_traces_nearest_neighbors
Expand Down Expand Up @@ -122,4 +122,4 @@
####################################################################################################
# The same :py:func:`.build_traces_nearest_neighbors` applied to spots found in
# :py:class:`.ImageStack` *with* a ``reference image`` guarantees a spot to be found in every
# round of :py:class:`.SpotFindingResults`.
# round of :py:class:`.SpotFindingResults`.
4 changes: 2 additions & 2 deletions examples/tutorials/normalize_intensity_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:ref:`section_normalizing_intensities`.
Normalizing the distributions is done in starfish by matching the histograms of
:py:class:`.ImageStack`\s to a reference histogram. The reference histogram is created by
:py:class:`.ImageStack` to a reference histogram. The reference histogram is created by
averaging the histograms from each group defined by the ``group_by`` parameter. These groups also
determine along which :py:class:`.Axes` the intensities will be normalized.
Expand Down Expand Up @@ -128,4 +128,4 @@ def plot_intensity_histograms(
# * normalizing with ``group_by={Axes.CH}`` has the effect of significantly rescaling histograms of channel 0 to match histograms of the other channels
# * normalizing with ``group_by={Axes.R}`` does not scale histograms of channel 0 to match histograms of other channels
# * normalizing with ``group_by={Axes.CH, Axes.ROUND}`` scales histograms from every round and channel to match each other
plot_intensity_histograms(ref=stack, scaled_cr=scaled_cr, scaled_c=scaled_c, scaled_r=scaled_r, r=0)
plot_intensity_histograms(ref=stack, scaled_cr=scaled_cr, scaled_c=scaled_c, scaled_r=scaled_r, r=0)
6 changes: 3 additions & 3 deletions examples/tutorials/spotbased_decoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@
"""

####################################################################################################
# Comparison of :py:class:`.FindSpotsAlgorithm`\s
# Comparison of :py:class:`.FindSpotsAlgorithm`
# -----------------------------------------------
# This tutorial demonstrates usage and characteristics of the three available
# :py:class:`.FindSpotsAlgorithm`\s on 3-Dimensional STARmap images. Parameters were roughly
# :py:class:`.FindSpotsAlgorithm` on 3-Dimensional STARmap images. Parameters were roughly
# tuned, but these results are not reflective of the best possible performance of each
# :py:class:`.FindSpotsAlgorithm`.

Expand Down Expand Up @@ -277,4 +277,4 @@ def get_cropped_coords(table, x_min, x_max, y_min, y_max):
# display(stack=cropped_dots, spots=lmp_table)

# TrackpyLocalMaxPeakFinder
# display(stack=cropped_dots, spots=tlmpf_table)
# display(stack=cropped_dots, spots=tlmpf_table)
2 changes: 1 addition & 1 deletion examples/tutorials/watershed_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
classes and methods provided in :py:mod:`.morphology`. Then this tutorial will cover how to run
the predefined segmentation pipeline.
Inputs for this tutorial are :py:class:`.ImageStack`\s:
Inputs for this tutorial are :py:class:`.ImageStack`:
* registered primary images to mimic a cell stain
* registered nuclei images to seed the water segmentation of cells
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ classifier =
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
keywords =
single-cell
image-based
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@
include_package_data=True,
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
python_requires='>=3.9, <3.12'
python_requires='>=3.9, <3.13'
)
3 changes: 3 additions & 0 deletions starfish/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import warnings

# generated version number and commit hash
from . import _version
from ._version import get_versions

# deal with numpy import warnings due to cython
Expand All @@ -15,3 +16,5 @@
is_release_tag = None
if "+" not in str(version):
is_release_tag = f"Release: {version}"

__version__ = _version.get_versions()['version']
Loading

0 comments on commit a4fb226

Please sign in to comment.