Skip to content

Commit

Permalink
Upgrade to Python 3.7 (#592)
Browse files Browse the repository at this point in the history
* added notes on issues upgrading to py37

* added changes

* changed rtd python version

* added spatial_lda and palettable

* added spatial_lda

* pycodestyle

* removed unnecessary file

* palettable

* removed tables from setup.py

* changed spatial-lda from 0.1.3 to 0.1.2

* dropped scikit image from 0.16.2 to 0.14.3

* changed python 3.7 -> 3.7.12 in .travis.yml

* changed python 3.7.12 -> 3.7 in .travis.yml

* removed spatial_lda dependency_links

* uncommented dep links

* adjsuted spatial_lda requirements

* depricated importlib-metadata from 4.11.4 to 3.6.0

* adjusted requirements

* setuptools==60.8.2

* importlib-metadata<3.4.0

* removed importlib_metadata requirements

* moved setuptools to the top of req.txt

* what version of setuptools and importlib-metadata is travis-ci using?

* updated travis' setuptools / importlib-metadata

* updated travis

* reverted scikit-image to 14.3

* replaced instances of 3.6 in conf.py, start_docker.sh, and dev.md with 3.7

* spelling

* Update docs/_rtd/development.md

Co-authored-by: Noah F. Greenwald <noahfgreenwald@gmail.com>

* removed spatial_lda@primary

* added toffy stile dependency retrieval

* bumped matplotlib, ipympl, should work better with 3.8 libraries: toffy, mibi-bin-tools

* make_iterable now accounts for instances of T, s.t. type(T) == `type`

* updated VERSION from 0.2.10 -> 0.3.00

Co-authored-by: Sricharan Reddy Varra <srivarra@mbp.local>
Co-authored-by: Sricharan Reddy Varra <srivarra@DN52eo49.SUNet>
Co-authored-by: Noah F. Greenwald <noahfgreenwald@gmail.com>
  • Loading branch information
4 people authored Jun 23, 2022
1 parent 55289aa commit 730893f
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ sphinx:
fail_on_warning: true

python:
version: 3.6
version: "3.7"
install:
- requirements: docs/rtd-requirements.txt
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ git:
language: python

python:
- 3.6
- 3.7

# Install the updated versions of importlib-metadata and setuptools, as Travis 3.7 environments
# contains a very old version of importlib-metadata which is incompatible for 3.7+
# We add python path to enable testing jupyter notebooks
install:
- pip install -U importlib_metadata setuptools
- travis_retry pip install -r requirements.txt
- travis_retry pip install -r requirements-test.txt
- travis_retry export PYTHONPATH=$PWD
Expand All @@ -26,7 +29,7 @@ script:
jobs:
include:
- stage: pypi_deploy
python: 3.6
python: 3.7
deploy:
provider: pypi
user: $PYPI_USERNAME
Expand All @@ -35,7 +38,7 @@ jobs:
tags: true
- stage: docker_deploy
if: tag IS present
python: 3.6
python: 3.7
script:
- "travis_wait 120 sleep 7200 &"
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.6
FROM python:3.7

# system maintenance
RUN apt-get update
Expand Down
10 changes: 8 additions & 2 deletions ark/segmentation/marker_quantification.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,19 @@ def assign_single_compartment_features(marker_counts, compartment, cell_props, c
cell_counts = EXTRACTION_FUNCTION[extraction](cell_coords, input_images, **kwargs)

# get morphology metrics
current_cell_props = cell_props.loc[cell_props['label'] == label_id, regionprops_names]
# Filter regionprops_names to only those in cell_props.columns
filtered_regionprops_names = [rp_name for rp_name in regionprops_names if rp_name in
cell_props.columns]
current_cell_props = cell_props.loc[cell_props['label'] == label_id,
filtered_regionprops_names]

# combine marker counts and morphology metrics together
cell_features = np.concatenate((cell_counts, current_cell_props), axis=None)

# add counts of each marker to appropriate column
marker_counts.loc[compartment, cell_id, marker_counts.features[1]:] = cell_features
# Only include the marker_count features up to the last filtered feature.
marker_counts.loc[compartment, cell_id,
marker_counts.features[1]:filtered_regionprops_names[-1]] = cell_features

# add cell size to first column
marker_counts.loc[compartment, cell_id, marker_counts.features[0]] = cell_coords.shape[0]
Expand Down
5 changes: 3 additions & 2 deletions ark/utils/misc_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from typing import Any
import warnings
from collections.abc import Iterable
import numpy as np
Expand Down Expand Up @@ -143,8 +144,8 @@ def create_invalid_data_str(invalid_data):
return err_str_data


def make_iterable(a, ignore_str=True):
""" Convert noniterable type to singelton in list
def make_iterable(a: Any, ignore_str: bool = True):
""" Convert noniterable type to singleton in list
Args:
a (T | Iterable[T]):
Expand Down
2 changes: 1 addition & 1 deletion docs/_rtd/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Miniforge contains conda with native Apple Silicon support. There are a few inst

Now that Anaconda is installed, you can now create a `conda` environment.

To do so, on your command line, type `conda create -n <my_env> python=3.6`, where `<my_env>` is a name you set. Our codebase only supports Python 3.6, so please do not change the `python=3.6` flag when creating your environment.
To do so, on your command line, type `conda create -n <my_env> python=3.7`, where `<my_env>` is a name you set. Our codebase only supports Python 3.7, so please do not change the `python=3.7` flag when creating your environment.

Say yes to any prompts and your `conda` environment will be created!

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
# intersphinx mapping, for when there is a cross-reference that has no matching target
# in the current documentation
intersphinx_mapping = {
'python': ('https://docs.python.org/3.6', None),
'python': ('https://docs.python.org/3.7', None),
'numpy': ('https://numpy.org/doc/stable', None),
'matplotlib': ('https://matplotlib.org/3.2.1', None),
'xarray': ('https://xarray.pydata.org/en/stable', None),
Expand Down
12 changes: 6 additions & 6 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
attrs>=20.3.0
coveralls>=1.8.2,<2.0.0
pytest<6.0.0
attrs>=21.4.0
coveralls>=1.11.1,<2.0.0
pytest>=7.1.2,<8.0.0
pytest-cases>=3.6.0,<4
pytest-cov<3.0.0
pytest-mock<4.0.0
pytest-pycodestyle<3.0.0
pytest-asyncio>=0.15.1
six>=1.13.0
testbook>=0.2.3,<1.0.0
pytest-asyncio>=0.18.1,<2.0.0
six>=1.16.0,<2.00
testbook>=0.4.2,<1.0.0
31 changes: 16 additions & 15 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
cryptography>=3.4.8,<4
feather-format>=0.4.1,<1
jupyter>=1.0.0,<2
ipympl==0.7.0
importlib-metadata>=4.11.4,<5.0
ipympl==0.9.1
jupyter_contrib_nbextensions>=0.5.1,<1
jupyterlab>=3.1.5,<4
jupyterlab>=3.4.3,<4
jedi>=0.17.2,<0.18
matplotlib>=2.2.2,<3
numpy>=1.16.3,<2
matplotlib>=3.5.2,<4
numpy>=1.21.6,<2
palettable>=3.3.0,<4
pandas>=0.23.3,<1
requests>=2.25.1,<3
pandas>=1.3.5,<2
requests>=2.27.1,<3
scikit-image>=0.14.3,<=0.16.2
scikit-learn>=0.19.1,<1
scipy>=1.1.0,<2
seaborn>=0.10.1,<1
git+https://github.com/calico/spatial_lda.git@primary
statsmodels>=0.11.1,<1
tables>=3.6.1,<4
umap-learn>=0.4.6,<1
xarray>=0.12.3,<1
tqdm>=4.54.1,<5
scikit-learn>=0.24.2,<1
scipy>=1.7.3,<2
seaborn>=0.11.2,<1
spatial-lda>=0.1.3,<1
statsmodels>=0.13.2,<1
tables>=3.7.0,<4
umap-learn>=0.5.3,<1
xarray>=0.17.0,<1
tqdm>=4.64.0,<5
35 changes: 9 additions & 26 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
from os import path
from os import path, pardir
from setuptools import setup, find_packages

VERSION = '0.2.10'
VERSION = '0.3.00'

PKG_FOLDER = path.abspath(path.join(__file__, pardir))

# set a long description which is basically the README
with open(path.join(path.abspath(path.dirname(__file__)), 'README.md')) as f:
long_description = f.read()

with open(path.join(PKG_FOLDER, 'requirements.txt')) as req_file:
requirements = req_file.read().splitlines()

setup(
name='ark-analysis',
version=VERSION,
Expand All @@ -16,29 +21,7 @@
author='Angelo Lab',
url='https://github.com/angelolab/ark-analysis',
download_url='https://github.com/angelolab/ark-analysis/archive/v{}.tar.gz'.format(VERSION),
install_requires=['cryptography>=3.4.8,<4',
'feather_format>=0.4.1,<1',
'ipympl>=0.7.0,<0.8.0',
'jupyter>=1.0.0,<2',
'jupyter_contrib_nbextensions>=0.5.1,<1',
'jupyterlab>=3.1.5,<4',
'matplotlib>=2.2.2,<3',
'numpy>=1.16.3,<2',
'palettable>=3.3.0,<4',
'pandas>=0.23.3,<1',
'requests>=2.25.1,<3',
'scikit-image>=0.14.3,<=0.16.2',
'scikit-learn>=0.19.1,<1',
'scipy>=1.1.0,<2',
'seaborn>=0.10.1,<1',
'spatial-lda>=0.1.3,<1',
'statsmodels>=0.11.1,<1',
'umap-learn>=0.4.6,<1',
'xarray>=0.12.3,<1',
'tqdm>=4.54.1,<5'],
dependency_links=[
'git+https://github.com/calico/spatial_lda.git@primary',
],
install_requires=requirements,
extras_require={
'tests': ['pytest',
'pytest-cov',
Expand All @@ -50,5 +33,5 @@
classifiers=['License :: OSI Approved :: Apache Software License',
'Development Status :: 4 - Beta',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6']
'Programming Language :: Python :: 3.7']
)
4 changes: 2 additions & 2 deletions start_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if [ ! -z "$external" ]
-p $PORT:$PORT \
-e JUPYTER_PORT=$PORT \
-e JUPYTER_DIR=$JUPYTER_DIR \
-v "$PWD/ark:/usr/local/lib/python3.6/site-packages/ark" \
-v "$PWD/ark:/usr/local/lib/python3.7/site-packages/ark" \
-v "$PWD/scripts:/scripts" \
-v "$PWD/data:/data" \
-v "$external:/data/external" \
Expand All @@ -68,7 +68,7 @@ if [ ! -z "$external" ]
-p $PORT:$PORT \
-e JUPYTER_PORT=$PORT \
-e JUPYTER_DIR=$JUPYTER_DIR \
-v "$PWD/ark:/usr/local/lib/python3.6/site-packages/ark" \
-v "$PWD/ark:/usr/local/lib/python3.7/site-packages/ark" \
-v "$PWD/scripts:/scripts" \
-v "$PWD/data:/data" \
-v "$PWD/ark/phenotyping/create_pixel_som.R:/create_pixel_som.R" \
Expand Down

0 comments on commit 730893f

Please sign in to comment.