Skip to content

Commit 0562e27

Browse files
committed
remove hapiplot. Addresses #31
1 parent 96bf773 commit 0562e27

26 files changed

+171
-3849
lines changed

CHANGES.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ v0.1.8:
6464
2020-12-23 -- 1cfbfc3 Add P1D chunk tests
6565
2020-12-23 -- f41599c Add P1Y chunk tests
6666
2020-12-23 -- ff8e1ab Refactor hapi.py; clean up util.py
67-
v0.1.9:
68-
2020-12-23 -- Remove hapiplot. Addresses #31.
67+
v0.1.9b0:
68+
2020-12-24 -- Remove hapiplot. Addresses #31.

Makefile

Lines changed: 79 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
# Test hapi() data read functions using repository code:
2+
# make repository-test # Test using $(PYTHON)
3+
# make repository-test-all # Test on all versions in $(PYTHONVERS)
4+
#
5+
# Making a local package:
6+
# 1. Update CHANGES.txt to have a new version line
7+
# 2. make package
8+
# 3. make package-test-all
9+
#
10+
# Upload package to pypi.org
11+
# 1. make release
12+
# 2. Wait ~5 minutes and execute
13+
# 3. make release-test-all
14+
# (Will fail until new version is available at pypi.org for pip install.
15+
# Sometimes takes ~5 minutes even though web page is immediately
16+
# updated.)
17+
# 4. After package is finalized, create new version number in CHANGES.txt ending
18+
# with "b0" in setup.py and then run
19+
# make version-update
20+
# git commit -a -m "Update version for next release"
21+
# This will update the version information in the repository to indicate it
22+
# is now in a pre-release state.
23+
#
24+
# Notes:
25+
# 1. make repository-test tests with Anaconda virtual environment
26+
# make package-test and release-test tests with native Python virtual
27+
# environment.
28+
29+
URL=https://upload.pypi.org/
30+
REP=pypi
31+
132
# Default Python version to use for tests
233
PYTHON=python3.8
334
PYTHON_VER=$(subst python,,$(PYTHON))
@@ -8,13 +39,14 @@ PYTHONVERS=python3.8 python3.7 python3.6 python3.5 python2.7
839

940
# VERSION is updated in "make version-update" step and derived
1041
# from CHANGES.txt. Do not edit.
11-
VERSION=0.1.9
42+
VERSION=0.1.9b0
1243
SHELL:= /bin/bash
1344

1445
LONG_TESTS=false
1546

1647
# Select this to have anaconda installed for you.
1748
CONDA=./anaconda3
49+
# Use existing anaconda
1850
# CONDA=/opt/anaconda3
1951
# CONDA=~/anaconda3
2052

@@ -24,74 +56,59 @@ ifeq ($(TRAVIS_OS_NAME),windows)
2456
CONDA=/c/tools/miniconda3
2557
endif
2658

27-
2859
CONDA_ACTIVATE=source $(CONDA)/etc/profile.d/conda.sh; conda activate
2960

3061
# ifeq ($(shell uname -s),MINGW64_NT-10.0-18362)
3162
ifeq ($(TRAVIS_OS_NAME),windows)
3263
CONDA_ACTIVATE=source $(CONDA)/Scripts/activate; conda activate
3364
endif
3465

35-
# Development:
36-
# Test hapi() data read functions using repository code:
37-
# make repository-test-data # Test using $(PYTHON)
38-
# make repository-test-data-all # Test on all versions in $(PYTHONVERS)
39-
#
40-
# Test hapiplot() functions using repository code:
41-
# make repository-test-plots # Test using $(PYTHON)
42-
# make repository-test-plots-all # Test on all versions in $(PYTHONVERS)
43-
#
44-
# Making a local package:
45-
# 1. Update CHANGES.txt to have a new version line
46-
# 2. make package
47-
# 3. make package-test-all
48-
#
49-
# Upload package to pypi.org test starting with uploaded package:
50-
# 1. make release
51-
# 2. Wait ~5 minutes and execute
52-
# 3. make release-test-all
53-
# (Will fail until new version is available at pypi.org for pip install.
54-
# Sometimes takes ~5 minutes even though web page is immediately
55-
# updated.)
56-
# 4. After package is finalized, create new version number in CHANGES.txt ending
57-
# with "b0" in setup.py and then run
58-
# make version-update
59-
# git commit -a -m "Update version for next release"
60-
# This will update the version information in the repository to indicate it
61-
# is now in a pre-release state.
62-
63-
URL=https://upload.pypi.org/
64-
REP=pypi
65-
66+
################################################################################
6667
test:
67-
make repository-test-data-all
68-
make repository-test-plots-all
68+
make repository-test-all
6969

70-
##########################################################################
7170
# Test contents in repository using different python versions
72-
repository-test-data-all:
71+
repository-test-all:
7372
@ for version in $(PYTHONVERS) ; do \
74-
make repository-test-data PYTHON=$$version ; \
73+
make repository-test PYTHON=$$version ; \
7574
done
7675

77-
repository-test-plots-all:
78-
@ for version in $(PYTHONVERS) ; do \
79-
make repository-test-plots PYTHON=$$version ; \
80-
done
76+
repository-test:
77+
@make clean
78+
79+
make condaenv PYTHON=$(PYTHON)
8180

81+
# https://stackoverflow.com/questions/30306099/pip-install-editable-vs-python-setup-py-develop
82+
$(CONDA_ACTIVATE) $(PYTHON); \
83+
pip install pytest deepdiff; pip install --editable .
84+
# Previously used:
85+
# $(CONDA_ACTIVATE) $(PYTHON); $(PYTHON) setup.py develop | grep "Best"
86+
87+
ifeq (LONG_TESTS,true)
88+
$(CONDA_ACTIVATE) $(PYTHON); $(python) -m pytest -v -m 'long' hapiclient/test/test_hapi.py
89+
else
90+
$(CONDA_ACTIVATE) $(PYTHON); $(python) -m pytest -v -m 'short' hapiclient/test/test_hapi.py
91+
endif
92+
93+
$(CONDA_ACTIVATE) $(PYTHON); $(python) -m pytest -v hapiclient/test/test_chunking.py
94+
$(CONDA_ACTIVATE) $(PYTHON); $(python) -m pytest -v hapiclient/test/test_hapitime2datetime.py
95+
$(CONDA_ACTIVATE) $(PYTHON); $(python) -m pytest -v hapiclient/test/test_hapitime_reformat.py
96+
################################################################################
97+
98+
################################################################################
99+
# Anaconda install
82100
CONDA_PKG=Miniconda3-latest-Linux-x86_64.sh
83101
ifeq ($(shell uname -s),Darwin)
84102
CONDA_PKG=Miniconda3-latest-MacOSX-x86_64.sh
85103
endif
86104

87-
88105
condaenv:
89106
# ifeq ($(shell uname -s),MINGW64_NT-10.0-18362)
90107
ifeq ($(TRAVIS_OS_NAME),windows)
91108
cp $(CONDA)/Library/bin/libcrypto-1_1-x64.* $(CONDA)/DLLs/
92109
cp $(CONDA)/Library/bin/libssl-1_1-x64.* $(CONDA)/DLLs/
93110

94-
# $(CONDA)/Scripts/conda config --set ssl_verify no
111+
# $(CONDA)/Scripts/conda config --set ssl_verify no
95112
$(CONDA)/Scripts/conda create -y --name $(PYTHON) python=$(PYTHON_VER)
96113
else
97114
make $(CONDA)/envs/$(PYTHON) PYTHON=$(PYTHON)
@@ -105,63 +122,10 @@ $(CONDA)/envs/$(PYTHON): ./anaconda3
105122
bash /tmp/$(CONDA_PKG) -b -p $(CONDA)
106123

107124
/tmp/$(CONDA_PKG):
108-
curl https://repo.anaconda.com/miniconda/$(CONDA_PKG) > /tmp/$(CONDA_PKG)
109-
110-
pythonw=$(PYTHON)
125+
curl https://repo.anaconda.com/miniconda/$(CONDA_PKG) > /tmp/$(CONDA_PKG)
126+
################################################################################
111127

112-
# ifeq ($(shell uname -s),MINGW64_NT-10.0-18362)
113-
ifeq ($(TRAVIS_OS_NAME),windows)
114-
pythonw=python
115-
endif
116-
117-
ifeq ($(UNAME_S),Darwin)
118-
# Use pythonw instead of python. On OS-X, this prevents "need to install python as a framework" error.
119-
# The following finds the path to the binary of $(PYTHON) and replaces it with pythonw, e.g.,
120-
# /opt/anaconda3/envs/python3.6/bin/python3.6 -> /opt/anaconda3/envs/python3.6/bin/pythonw
121-
a=$(shell source activate $(PYTHON); which $(PYTHON))
122-
pythonw=$(subst bin/$(PYTHON),bin/pythonw,$(a))
123-
endif
124-
125-
repository-test-data:
126-
@make clean
127-
128-
make condaenv PYTHON=$(PYTHON)
129-
130-
# https://stackoverflow.com/questions/30306099/pip-install-editable-vs-python-setup-py-develop
131-
$(CONDA_ACTIVATE) $(PYTHON); pip install pytest deepdiff; pip install --editable .
132-
# 'python setup.py develop' creates symlinks in system package directory.
133-
# $(CONDA_ACTIVATE) $(PYTHON); $(PYTHON) setup.py develop | grep "Best"
134-
135-
ifeq (LONG_TESTS,true)
136-
$(CONDA_ACTIVATE) $(PYTHON); $(pythonw) -m pytest -v -m 'long' hapiclient/test/test_hapi.py
137-
else
138-
$(CONDA_ACTIVATE) $(PYTHON); $(pythonw) -m pytest -v -m 'short' hapiclient/test/test_hapi.py
139-
endif
140-
141-
$(CONDA_ACTIVATE) $(PYTHON); $(pythonw) -m pytest -v hapiclient/test/test_chunking.py
142-
$(CONDA_ACTIVATE) $(PYTHON); $(pythonw) -m pytest -v hapiclient/test/test_hapitime2datetime.py
143-
$(CONDA_ACTIVATE) $(PYTHON); $(pythonw) -m pytest -v hapiclient/test/test_hapitime_reformat.py
144-
145-
# These require visual inspection.
146-
repository-test-plots:
147-
@make clean
148-
make condaenv PYTHON=$(PYTHON)
149-
$(CONDA_ACTIVATE) $(PYTHON); $(PYTHON) setup.py develop | grep "Best"
150-
# Run using pythonw instead of python only so plot windows always work
151-
# for programs called from command line. This is needed for
152-
# OS-X, Python 3.5, and matplotlib instaled from pip.
153-
$(CONDA_ACTIVATE) $(PYTHON); $(pythonw) hapi_demo.py
154-
155-
repository-test-plots-other:
156-
$(CONDA_ACTIVATE) $(PYTHON); $(PYTHON) hapiclient/hapiplot_test.py
157-
$(CONDA_ACTIVATE) $(PYTHON); $(PYTHON) hapiclient/plot/timeseries_test.py
158-
$(CONDA_ACTIVATE) $(PYTHON); $(PYTHON) hapiclient/plot/heatmap_test.py
159-
$(CONDA_ACTIVATE) $(PYTHON); $(PYTHON) hapiclient/gallery/gallery_test.py
160-
$(CONDA_ACTIVATE) $(PYTHON); $(PYTHON) hapiclient/autoplot/autoplot_test.py
161-
jupyter-notebook ../client-python-notebooks/hapi_demo.ipynb
162-
##########################################################################
163-
164-
##########################################################################
128+
################################################################################
165129
# Packaging
166130
package:
167131
make clean
@@ -189,11 +153,12 @@ package-test:
189153
pip install dist/hapiclient-$(VERSION).tar.gz \
190154
--index-url $(URL)/simple \
191155
--extra-index-url https://pypi.org/simple && \
192-
env-$(PYTHON)/bin/python /tmp/hapi_demo.py #&& \
193-
#env/bin/pytest -v hapiclient/test/test_hapi.py
194-
##########################################################################
156+
env-$(PYTHON)/bin/python /tmp/hapi_demo.py && \
157+
env-$(PYTHON)/bin/pytest -v -m 'short' hapiclient/test/test_hapi.py
158+
################################################################################
195159

196-
##########################################################################
160+
################################################################################
161+
# Release a package to pypi.org
197162
release:
198163
make package
199164
make version-tag
@@ -223,8 +188,9 @@ release-test:
223188
--extra-index-url https://pypi.org/simple && \
224189
env/bin/pytest -v hapiclient/test/test_hapi.py && \
225190
env/bin/python /tmp/hapi_demo.py
226-
##########################################################################
191+
################################################################################
227192

193+
################################################################################
228194
# Update version based on content of CHANGES.txt
229195
version-update:
230196
python misc/version.py
@@ -234,23 +200,28 @@ version-tag:
234200
git push
235201
git tag -a v$(VERSION) -m "Version "$(VERSION)
236202
git push --tags
203+
################################################################################
237204

205+
################################################################################
238206
# Install package in local directory (symlinks made to local dir)
239207
install-local:
240-
# python setup.py -e .
241208
$(CONDA_ACTIVATE) $(PYTHON); pip install --editable .
242209

243210
install:
244211
pip install 'hapiclient==$(VERSION)' --index-url $(URL)/simple
245212
conda list | grep hapiclient
246213
pip list | grep hapiclient
214+
################################################################################
247215

216+
################################################################################
217+
# Recreate reference response files. Use this if server response changes
248218
# Run pytest twice because first run creates test files that
249219
# subsequent tests use for comparison.
250220
test-clean:
251221
rm -f hapiclient/test/data/*
252222
pytest -v hapiclient/test/test_hapi.py
253223
pytest -v hapiclient/test/test_hapi.py
224+
################################################################################
254225

255226
clean:
256227
- @find . -name __pycache__ | xargs rm -rf {}
@@ -265,6 +236,5 @@ clean:
265236
- @rm -f MANIFEST
266237
- @rm -rf .pytest_cache/
267238
- @rm -rf hapiclient.egg-info/
268-
- @rm -rf /c/tools/Anaconda3/envs/python3.6/Scripts/wheel.exe*
269-
- @rm -rf /c/tools/Anaconda3/envs/python3.6/vcruntime140.dll.*
270-
239+
- @rm -rf /c/tools/miniconda3/envs/python3.6/Scripts/wheel.exe*
240+
- @rm -rf /c/tools/miniconda3/envs/python3.6/vcruntime140.dll.*

hapiclient/__init__.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,7 @@
44
# Allow "from hapiclient import hapitime2datetime"
55
from hapiclient.time import hapitime2datetime
66

7-
import warnings
8-
try:
9-
import matplotlib
10-
11-
# Deal with this issue: https://github.com/matplotlib/matplotlib/issues/13118
12-
warnings.filterwarnings(action="ignore",
13-
message=r'\n.*rcparam was deprecated',
14-
category=matplotlib.cbook.MatplotlibDeprecationWarning)
15-
warnings.filterwarnings(action="ignore",
16-
message=r'\n.*examples\.directory is deprecated',
17-
category=matplotlib.cbook.MatplotlibDeprecationWarning)
18-
19-
# Allow "from hapiclient import hapiplot"
20-
from hapiclient.hapiplot import hapiplot
21-
except:
22-
print('Problem importing Matplotlib. hapiplot function will not work.')
23-
7+
# Allow "from hapiclient import HAPIError"
248
from hapiclient.util import HAPIError
259

26-
# Allow "from hapiclient import autoplot"
27-
from hapiclient.autoplot.autoplot import autoplot
28-
29-
# Allow "from hapiclient import gallery"
30-
from hapiclient.gallery.gallery import gallery
31-
32-
__version__ = '0.1.9'
10+
__version__ = '0.1.9b0'

hapiclient/autoplot/__init__.py

Whitespace-only changes.

hapiclient/autoplot/autoplot.png

-4.25 KB
Binary file not shown.

0 commit comments

Comments
 (0)