Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update install setup #120

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ before_install:
- conda update --yes conda
# install deps
- conda install --yes cartopy geopandas matplotlib==2.1.2
- pip install cython>0.15.1 numpy scipy pandas pyyaml xlrd xlsxwriter seaborn==0.8.1
- mkdir -p ~/.matplotlib
- touch ~/.matplotlib/matplotlibrc
- "echo 'backend: TkAgg' >> ~/.matplotlib/matplotlibrc"

install:
- python setup.py install
- pip install -e .[tests]
- echo $PWD

# Run test
script:
- pip install pytest pytest-mpl
- pytest -v --mpl tests
16 changes: 16 additions & 0 deletions MANIFEST.IN
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# MANIFEST.in
exclude .gitignore
exclude appveyor.yml
exclude .travis.yml
recursive-exclude ci

include README.md
include setup.cfg
include LICENSE

prune .cache
prune .git
prune build
prune dist

recursive-exclude *.egg-info *
40 changes: 40 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.PHONY: new_release
new_release:
@echo 'For a new release on PyPI:'
@echo 'git tag vX.Y.Z'
@echo 'make publish-on-pypi'

# first time setup, follow this https://blog.jetbrains.com/pycharm/2017/05/how-to-publish-your-package-on-pypi/
# then this works
.PHONY: publish-on-testpypi
publish-on-testpypi:
-rm -rf build dist
@status=$$(git status --porcelain); \
if test "x$${status}" = x; then \
$(call activate_conda_env,); \
python setup.py sdist bdist_wheel --universal; \
twine upload -r testpypi dist/*; \
else \
echo Working directory is dirty >&2; \
fi;

.PHONY: publish-on-pypi
publish-on-pypi:
-rm -rf build dist
@status=$$(git status --porcelain); \
if test "x$${status}" = x; then \
$(call activate_conda_env,); \
python setup.py sdist bdist_wheel --universal; \
twine upload dist/*; \
else \
echo Working directory is dirty >&2; \
fi;

.PHONY: release-on-conda
release-on-conda:
@echo 'For now, this is all very manual'
@echo 'Checklist:'
@echo '- version number'
@echo '- sha'
@echo '- README.md badge'
@echo '- release notes up to date'
4 changes: 2 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Next Release

- (#128)[https://github.com/IAMconsortium/pyam/pull/128] add ability to directly read data from iiasa data sources

- (#120)[https://github.com/IAMconsortium/pyam/pull/120] update install setup

# Release v0.1.0

Expand All @@ -12,7 +12,7 @@
- (#104)[https://github.com/IAMconsortium/pyam/pull/104] fixes a bug with timeseries utils functions, ensures that years are cast as integers
- (#101)[https://github.com/IAMconsortium/pyam/pull/101] add function `cross_threshold()` to determine years where a timeseries crosses a given threshold
- (#98)[https://github.com/IAMconsortium/pyam/pull/98] add a module to compute and format summary statistics for timeseries data (wrapper for `pd.describe()`
- (#95)[https://github.com/IAMconsortium/pyam/pull/95] add a `scatter()` chart in the plotting library using metadata
- (#95)[https://github.com/IAMconsortium/pyam/pull/95] add a `scatter()` chart in the plotting library using metadata
- (#94)[https://github.com/IAMconsortium/pyam/pull/94] `set_meta()` can take pd.DataFrame (with columns `['model', 'scenario']`) as `index` arg
- (#93)[https://github.com/IAMconsortium/pyam/pull/93] IamDataFrame can be initilialzed from pd.DataFrame with index
- (#92)[https://github.com/IAMconsortium/pyam/pull/92] Adding `$` to the pseudo-regexp syntax in `pattern_match()`, adds override option
Expand Down
9 changes: 3 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

environment:
matrix:
- PYTHON_VERSION: "2.7"
- PYTHON_VERSION: "2.7"
MINICONDA: "C:\\Miniconda-x64"
PYTHON_ARCH: "64"
- PYTHON_VERSION: "3.6"
Expand All @@ -10,7 +10,7 @@ environment:

init:
- "ECHO %PYTHON_VERSION% %MINICONDA%"

install:
# these correspond to folder naming of miniconda installs on appveyor. See
# https://www.appveyor.com/docs/installed-software#python
Expand All @@ -22,15 +22,12 @@ install:

# Dependencies and package install
- conda install --yes geopandas cartopy
- pip install cython>0.15.1 numpy scipy pandas pyyaml xlrd xlsxwriter
- if "%PYTHON_VERSION%" == "2.7" pip install functools32
- pip install matplotlib==2.1.2 seaborn==0.8.1
- python setup.py install

build: false

test_script:
- pip install pytest pytest-mpl
- pip install -e .[tests]
- pytest -v --mpl tests --mpl-results-path=test-artifacts

artifacts:
Expand Down
9 changes: 0 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
argparse
numpy
pandas >=0.21.0
pyyaml
xlrd
xlsxwriter
matplotlib
seaborn
six
geopandas
cartopy
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal=1
51 changes: 45 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
import glob
import os
import shutil
from subprocess import call

from setuptools import setup, Command, find_packages
from setuptools.command.install import install

# Thanks to http://patorjk.com/software/taag/
logo = r"""
______ __ __ ______ __ __
/\ == \ /\ \_\ \ /\ __ \ /\ "-./ \
\ \ _-/ \ \____ \ \ \ __ \ \ \ \-./\ \
\ \_\ \/\_____\ \ \_\ \_\ \ \_\ \ \_\
\/_/ \/_____/ \/_/\/_/ \/_/ \/_/
______ __ __ ______ __ __
/\ == \ /\ \_\ \ /\ __ \ /\ "-./ \
\ \ _-/ \ \____ \ \ \ __ \ \ \ \-./\ \
\ \_\ \/\_____\ \ \_\ \_\ \ \_\ \ \_\
\/_/ \/_____/ \/_/\/_/ \/_/ \/_/
"""

INFO = {
Expand Down Expand Up @@ -43,9 +44,29 @@ def run(self):
shutil.rmtree(d)


# thank you https://stormpath.com/blog/building-simple-cli-interfaces-in-python
class RunTests(Command):
"""Run all tests."""
description = 'run tests'
user_options = []

def initialize_options(self):
pass

def finalize_options(self):
pass

def run(self):
"""Run all tests!"""
errno = call(['py.test', '--cov=skele', '--cov-report=term-missing'])
raise SystemExit(errno)


def main():
print(logo)

classifiers = [
"License :: OSI Approved :: Apache Software License",
]
packages = [
'pyam',
]
Expand All @@ -63,10 +84,26 @@ def main():
cmdclass = {
'install': Cmd,
}
install_requirements = [
"argparse",
"numpy",
"pandas >=0.21.0",
"PyYAML",
"xlrd",
"xlsxwriter",
"matplotlib",
"seaborn",
"six",
]
extra_requirements = {
'tests': ['coverage', 'pytest', 'pytest-cov', 'pytest-mpl'],
}
setup_kwargs = {
"name": "pyam-iamc",
"version": INFO['version'],
"description": 'Analyze & Visualize Assessment Model Results',
"classifiers": classifiers,
"license": "Apache License 2.0",
"author": 'Matthew Gidden & Daniel Huppmann',
"author_email": 'matthew.gidden@gmail.com',
"url": 'https://github.com/IAMconsortium/pyam',
Expand All @@ -75,6 +112,8 @@ def main():
"entry_points": entry_points,
"cmdclass": cmdclass,
"package_data": package_data,
"install_requires": install_requirements,
"extras_require": extra_requirements,
}
rtn = setup(**setup_kwargs)

Expand Down