Skip to content

Commit

Permalink
Release prep (#21) (#22)
Browse files Browse the repository at this point in the history
* * changed relative import to absolute
* hacking some tests timeouts to speed them up (this will need to change)
* split out requrements for setup and dev
* Makefile for dev speed and CI prep
* travis template
* removed pip private methods

* * travis slack token

* * slack token 2

* * safer shebang

* * consolidated test-reqs to dev-reqs
* I'm not sure if the dockerfile is used, but now it matches the Makefile more

* * filled out more setup keys for a nicer release
* moved version into setup.py (it wasn't reliable there)
* pypi now supports markdown!!!

* * bump version to 0.0.4 to prepare for release
  • Loading branch information
Aylr authored Dec 17, 2018
1 parent c18cbd3 commit 4140e25
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ celerybeat-schedule
venv/
ENV/

.idea/

# Spyder project settings
.spyderproject
.spyproject
Expand Down
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: python
python:
- '3.6'
cache: pip
install:
- make install
script:
- make test
notifications:
slack:
secure: f46jABKvxN82+MbbNFA2rp5dZrRpDJXaQr7tJAOZgVAlvfq5IRWmWgjluczFAZ4ibhChnSRVyfiFY9/ZlWWZ/9lvUgqN0kCollcWXVdp8ic7Ev3c9b+YNxzvYMSnI7GyI7ijT2jCF6fDQxJIKhI8+C0xSfwqboo7indxuYHJWyZje9XEsOLdsXo4uqHTPMU8VP1MNh47Sid+NIz6zlW59rgsYejIb9JlvlO8T2w/I24KyveSxaASRq1wUQEzVlfHW97U160SvS+sGhz7aoBoomWfRVH87P1/vcDLJ7CFSr1TqTERL+UwKG8zJawzNMTR06c9fnd7FZJ7bKumPufiCz982hXzllG3L+wjqzinbBr3/YxPpi9hBbQvS2OjJGjayYC9gYPBqV7Ts4WTmkSNkGcJkb/hxIwamOhREnNE36K9LPILUFUwCTltJuIaZ9H87daqa/tt9h4iKVICP1rUXD9MpwyP8GAc9Mw0DOg4gbtnKIoO5Jh1Eej9xkINJRnMTK2vPR/DVRFN3kemiKp775TucszZIZGWdHoM6kTPwNPTf4gqAfZlbaUh6xYFfizTtT6HZFGxqZ7NPXf+BbLKZqU8fWJ2smHQ2M5TUHiVcbb/BAWhUnNO3wa6Xx8sMaH1H1joLcrUCdVz8GYZSPTyT4lAtaaw782odnlsr5BpAUs=
10 changes: 3 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ RUN mkdir -p /var/pair

WORKDIR /var/pair

COPY test_requirements.txt ./

RUN pip3 install -r test_requirements.txt

COPY dev-requirements.txt ./
COPY requirements.txt ./

RUN pip3 install -r requirements.txt

COPY . ./

RUN pip3 install -r dev-requirements.txt
RUN pip3 install -r requirements.txt
RUN pip3 install -e .

CMD py.test
71 changes: 71 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.DEFAULT_GOAL := help

define PRINT_HELP_PYSCRIPT
import re, sys


HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDCOLOR = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'

print(OKBLUE + "Welcome! You can run these make commands:\n" + ENDCOLOR)

for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print(OKGREEN + "%-30s " % target + ENDCOLOR + "%s" % (help))
endef
export PRINT_HELP_PYSCRIPT

help: ## Get help messages
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
.PHONY: help

github: ## Open the GitHub repo for this project
open https://github.com/superconductive/cooper-pair
.PHONY: github

install: ## update your python environment
pip install -r requirements.txt || echo 'No requirements.txt found'
pip install -r dev-requirements.txt || echo 'No dev-requirements.txt found'
pip install -e .
pip list
.PHONY: install-requirements

notebooks: ## Run juypter lab for your notebooks
jupyter lab
.PHONY: notebooks

clean: ## Clean out python cache files
find . -name '*.pyc' -delete
find . -name '__pycache__' -type d | xargs rm -fr
rm -fr docs/_build/
rm -fr dist/*
.PHONY: clean

dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
ls -l dist
.PHONY: dist

release: dist ## package and upload a release
# TODO using TEST pypi for now
# twine upload dist/*
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
.PHONY: release

venv: ## Create a new virtualenv in the repo root
rm -rf venv
virtualenv venv
.PHONY: venv

test: ## Run tests
pytest -s tests
.PHONY: test
2 changes: 1 addition & 1 deletion cooper_pair/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .pair import CooperPair
from cooper_pair.pair import CooperPair
1 change: 0 additions & 1 deletion cooper_pair/version.py

This file was deleted.

4 changes: 4 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pandas==0.22.0
pytest-cov==2.5.1
pytest==3.2.5
twine
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pytest-cov==2.5.1
pytest==3.2.5
great_expectations==0.4.4
gql==0.1.0
requests==2.20.1
54 changes: 27 additions & 27 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
#!/usr/bin/python
#!/usr/bin/env python

import os
from pip.download import PipSession
from pip.req import parse_requirements
from setuptools import (find_packages, setup)
from setuptools import find_packages, setup

def get_version():
basedir = os.path.dirname(__file__)
with open(os.path.join(basedir, 'cooper_pair/version.py')) as f:
__version__ = None
exec(f.read())
return __version__
with open("README.md", "r") as fh:
long_description = fh.read()

if __name__ == '__main__':
install_reqs = list(
parse_requirements(
'requirements.txt',
session=PipSession()))
dependency_links = [str(r.url) for r in install_reqs if hasattr(r, 'url')]
install_reqs = [str(r.req) for r in install_reqs if r.req]

setup(name='cooper_pair',
version=get_version(),
author='Superconductive Health',
author_email='[email protected]',
maintainer='Superconductive Health',
maintainer_email='[email protected]',
install_requires=install_reqs,
dependency_links=dependency_links,
packages=find_packages())
setup(
name='cooper_pair',
version='0.0.4',
author='Superconductive Health',
author_email='[email protected]',
maintainer='Superconductive Health',
maintainer_email='[email protected]',
url='https://github.com/superconductive/cooper-pair',
packages=find_packages(),
classifiers=[
'Programming Language :: Python :: 3',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
],
description='A small library that provides programmatic access to Superconductive\'s GraphQL API.',
long_description=long_description,
long_description_content_type="text/markdown",
install_requires=[
'gql',
'requests',
'great_expectations'
],
)
1 change: 0 additions & 1 deletion test_requirements.txt

This file was deleted.

17 changes: 8 additions & 9 deletions tests/test_pair.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@
except ImportError:
from StringIO import StringIO

from cooper_pair import CooperPair
from cooper_pair.version import __version__
from cooper_pair.pair import CooperPair
from graphql.error.syntax_error import GraphQLSyntaxError

DQM_GRAPHQL_URL = os.getenv('DQM_GRAPHQL_URL', 'http://0.0.0.0:3010/graphql')

pair = CooperPair(
graphql_endpoint=DQM_GRAPHQL_URL,
email='[email protected]',
password='foobar')
password='foobar',
timeout=1,
max_retries=1,
)

SAMPLE_EXPECTATIONS_CONFIG = {
'dataset_name': None,
Expand All @@ -38,9 +40,6 @@
'meta': {'great_expectations.__version__': '0.4.3'}}


def test_version():
assert __version__

# FIXME: This test runs very slowly
def test_init():
assert pair.client #This is the slow line.
Expand All @@ -54,15 +53,15 @@ def test_init_client_without_credentials():
#FIXME: This test runs very slowly
def test_login_success():
with pytest.warns(UserWarning):
pair = CooperPair(graphql_endpoint=DQM_GRAPHQL_URL)
pair = CooperPair(graphql_endpoint=DQM_GRAPHQL_URL, timeout=1, max_retries=1)
assert pair.login(
email='[email protected]',
password='foobar')

#FIXME: This test runs very slowly
def test_login_failure():
with pytest.warns(UserWarning):
pair = CooperPair(graphql_endpoint=DQM_GRAPHQL_URL)
pair = CooperPair(graphql_endpoint=DQM_GRAPHQL_URL, timeout=1, max_retries=1)
with pytest.warns(UserWarning):
assert not pair.login(
email='sdfjkhkdfsh',
Expand All @@ -77,7 +76,7 @@ def test_login_failure():
#FIXME: This test runs very slowly
def test_unauthenticated_query():
with pytest.warns(UserWarning):
pair = CooperPair(graphql_endpoint=DQM_GRAPHQL_URL)
pair = CooperPair(graphql_endpoint=DQM_GRAPHQL_URL, timeout=1, max_retries=1)
with pytest.warns(UserWarning):
pair.add_evaluation(dataset_id=1, checkpoint_id=1)

Expand Down

0 comments on commit 4140e25

Please sign in to comment.