Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Commit

Permalink
Merge pull request #13 from cta-sst-1m/v_044
Browse files Browse the repository at this point in the history
use v0.44: no core dumps, OSX as well
  • Loading branch information
Dominik Neise authored Feb 12, 2018
2 parents b7c442a + 5fd28e5 commit bb554e7
Show file tree
Hide file tree
Showing 17 changed files with 237 additions and 19 deletions.
105 changes: 105 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
.static_storage/
.media/
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
46 changes: 31 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
language: python
python:
# We don't actually use the Travis Python, but this keeps it organized.
- "3.5"
- "3.6"
language: generic

matrix:
include:
- os: linux
python: 3.5
env:
- PYTHON_VERSION=3.5
- MINICONDA_URL=https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
- os: linux
python: 3.6
env:
- PYTHON_VERSION=3.6
- MINICONDA_URL=https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
- os: osx
python: 3.5
env:
- PYTHON_VERSION=3.5
- MINICONDA_URL=https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
- DYLD_LIBRARY_PATH=$HOME/miniconda/envs/pz/lib/python3.5/site-packages/protozfitsreader
- os: osx
python: 3.6
env:
- PYTHON_VERSION=3.6
- MINICONDA_URL=https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
- DYLD_LIBRARY_PATH=$HOME/miniconda/envs/pz/lib/python3.6/site-packages/protozfitsreader

install:
- sudo apt-get update
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
- wget $MINICONDA_URL -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
- conda create -q -n pz python=$TRAVIS_PYTHON_VERSION pip numpy protobuf pytest
- conda create -q -n pz python=$PYTHON_VERSION pip numpy protobuf # pytest
- source activate pz
- pip install .
- pip install -r requirements.txt
- pip install pytest

script:
- pytest -vv
- echo "trying to show, that deinstall works"
- cd /home/travis
- find . | grep "rawzfitsreader.cpython-35m-x86_64-linux-gnu.so"
- pip uninstall protozfitsreader --yes
- find . | grep "rawzfitsreader.cpython-35m-x86_64-linux-gnu.so"

71 changes: 69 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,75 @@

## installation:

conda install numpy protobuf libgcc
pip install https://github.com/cta-sst-1m/protozfitsreader/archive/v0.43.1.tar.gz
We all use [Anaconda](https://www.anaconda.com/) and this package is tested
against Anaconda. You can [download anaconda](https://www.anaconda.com/download) for your system for free.

You do not have to use a [conda environment](https://conda.io/docs/user-guide/tasks/manage-environments.html) to use this package. It cleanly installs and uninstalls with [pip](https://docs.python.org/3.6/installing/). If you plan to play around with different versions of this package your might want to use environments though.

### Faster installation?

If you use Anaconda this is not interesting for you.

You can just `pip install` this, but it will use `pip` to install all the dependencies.
`pip install <some package>` is sometimes much slower than `conda install <some package>`.

If you use "miniconda" or if you install this in a fresh conda environment, then
numpy and protobuf might not be there, so we recommend to

conda install numpy protobuf

for your convenience.

### Linux (with anaconda)

pip install https://github.com/cta-sst-1m/protozfitsreader/archive/v0.44.0.tar.gz

### OSX (with anaconda)

pip install https://github.com/cta-sst-1m/protozfitsreader/archive/v0.44.0.tar.gz

To use it you'll have to find your `site-packages` folder, e.g. like this:

dneise@lair:~$ python -m site
sys.path = [
'/home/dneise',
'/home/dneise/Downloads/rootfoo/build_root/lib',
'/home/dneise/anaconda3/lib/python36.zip',
'/home/dneise/anaconda3/lib/python3.6',
'/home/dneise/anaconda3/lib/python3.6/lib-dynload',
'/home/dneise/anaconda3/lib/python3.6/site-packages', <----- this one <-----
]

And then you'll have to (put it in your .bashrc for example)

export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/home/dneise/anaconda3/lib/python3.6/site-packages

### To developers: No `pip --editable`

This package contains pre-build binaries, which (at the moment) are required to be installed
into your "site-packages" folder.
Developers like to install packages they are currently developing like this:

pip install --editable .

Because then they can modify code and try it out without constant uninstall/install cycles.
Unfortunately this nice development workcycle is not possible at the moment.

I personally do:

git clone https://github.com/cta-sst-1m/protozfitsreader
pip install protozfitsreader
# play around ... modify ...
pip uninstall protozfitsreader --yes && pip install protozfitsreader
# play around ... modify ...
pip uninstall protozfitsreader --yes && pip install protozfitsreader
# and so on

The uninstall/install takes 1..2sec ... so it is rather ok... not perfect though.



# Where does this come from?

The contents of this repo come entirely from: http://www.isdc.unige.ch/~lyard/repo/

Expand Down
Binary file added protozfitsreader/libACTLCore.dylib
Binary file not shown.
Binary file added protozfitsreader/libZFitsIO.dylib
Binary file not shown.
Binary file added protozfitsreader/libprotobuf.13.dylib
Binary file not shown.
Binary file added protozfitsreader/libprotobuf.9.dylib
Binary file not shown.
Binary file added protozfitsreader/libzmq.4.dylib
Binary file not shown.
Binary file not shown.
Binary file modified protozfitsreader/rawzfitsreader.cpython-35m-x86_64-linux-gnu.so
Binary file not shown.
Binary file not shown.
Binary file modified protozfitsreader/rawzfitsreader.cpython-36m-x86_64-linux-gnu.so
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions protozfitsreader/tests/test_rawzfitsreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,20 @@ def test_trigger_output_patch19():
trigger_output_patch19 = to_numpy(e.trigger_output_patch19)
assert trigger_output_patch19.shape == (2700, )
assert trigger_output_patch19.dtype == np.uint8


def test_no_crash_when_iterating_too_far():
from protozfitsreader import rawzfitsreader
from protozfitsreader import L0_pb2

rawzfitsreader.open(example_file_path + ':Events')
for i in range(rawzfitsreader.getNumRows()):
event = L0_pb2.CameraEvent()
event.ParseFromString(rawzfitsreader.readEvent())

# At this point we iterated through the entire file.
# In version 0.43 we got a crash (seg fault or so) when iterating too
# far. This test should ensure this behaviour is fixed in 0.44

with pytest.raises(EOFError):
rawzfitsreader.readEvent()
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--index-url https://pypi.python.org/simple/

.
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[aliases]
test=pytest

[tool:pytest]
addopts = --verbose
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
setup(
name='protozfitsreader',
packages=['protozfitsreader'],
version='0.43.1',
version='0.44.0',
description='Basic python bindings for protobuf zfits reader',
author="Etienne Lyard et al.",
author_email="[email protected]",
package_data={
'protozfitsreader': ['*.so*'],
'protozfitsreader': [
'*.so*',
'*.dylib'
],
'': ['tests/resources/*'],
},
install_requires=['numpy', 'protobuf'],
setup_requires=['pytest-runner'],
tests_require=['pytest'],
)

0 comments on commit bb554e7

Please sign in to comment.