From 1fc449a6e042d90b2d8755ba7e24878eb5da3b12 Mon Sep 17 00:00:00 2001 From: Jim Rybarski Date: Thu, 4 Jun 2015 04:32:49 +0000 Subject: [PATCH] #56 clearer README, auto-install dependencies, build numpy from source in Docker --- CHANGELOG.md | 3 ++- Dockerfile | 13 ++++++++----- Makefile | 2 +- README.md | 23 +++++++++++++++-------- setup.py | 6 +++++- 5 files changed, 31 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfe4736..cdd0791 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,8 @@ - Unit tests ### CHANGED -- Made the interface for most metadata public. +- Switched to setuptools to automatically install missing dependencies +- Made the interface for most metadata public - Refactored some poorly-named things ## [1.0.0] - 2015-05-23 diff --git a/Dockerfile b/Dockerfile index 8f656a9..969c5b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,14 +3,17 @@ MAINTAINER Jim Rybarski RUN mkdir -p /var/nds2 RUN apt-get update && apt-get install -y --no-install-recommends \ - python-numpy \ - python3-numpy \ + build-essential \ + libatlas3-base \ + liblapack-dev \ + libblas-dev \ + python \ + python3 \ + python-dev \ + python3-dev \ python-pip \ python3-pip -RUN pip install six -RUN pip3 install six - COPY . /opt/nd2reader WORKDIR /opt/nd2reader RUN python setup.py install diff --git a/Makefile b/Makefile index 87b2d38..8a6a193 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build shell +.PHONY: build py2shell py3shell test build: docker build -t jimrybarski/nd2reader . diff --git a/README.md b/README.md index dd0763d..fa0dc03 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,19 @@ ### Installation -Just use pip (`numpy` is required): +Dependencies will automatically be installed if you don't have them. That said, for optimal performance, you should +install the following packages before installing nd2reader: -`pip install numpy nd2reader` +#### Ubuntu +`apt-get install python-numpy python-six` (Python 2.x) +`apt-get install python3-numpy python3-six` (Python 3.x) -If you want to install via git, clone the repo and run: +#### Other operating systems +These have not been tested yet. -``` -pip install numpy -python setup.py install -``` +nd2reader is compatible with both Python 2.x and 3.x. I recommend installing using pip: + +`pip install nd2reader` (Python 2.x) or `pip3 install nd2reader` (Python 3.x) ### ND2s @@ -50,7 +53,7 @@ You can also get some metadata about the nd2 programatically: ### Images -`nd2reader` will always return an `Image` object, which contains some metadata about the image as well as the +Every method returns an `Image` object, which contains some metadata about the image as well as the raw pixel data itself. Images are always a 16-bit grayscale image. The `data` attribute holds the numpy array with the image data: @@ -162,6 +165,10 @@ You can also see how many images are in your image set: 7 ``` +### Protips + +nd2reader is about 14 times faster under Python 3.4 compared to Python 2.7. If you know why, please get in touch! + ### Bug Reports and Features If this fails to work exactly as expected, please open a Github issue. If you get an unhandled exception, please diff --git a/setup.py b/setup.py index ee88e1d..ee1b087 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,14 @@ -from distutils.core import setup +from setuptools import setup VERSION = "1.1.0" setup( name="nd2reader", packages=['nd2reader', 'nd2reader.model'], + install_requires=[ + 'numpy>=1.6.2, <2.0', + 'six>=1.4, <2.0' + ], version=VERSION, description='A tool for reading ND2 files produced by NIS Elements', author='Jim Rybarski',