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

pip-installable Wheel #28

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
topojson/_version.py export-subst
3 changes: 3 additions & 0 deletions .pytest_cache/v/cache/nodeids
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
"tests/topojson_test.py::TestTopojson::test_convert_geojson_to_topojson"
]
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Travis configuration file using the build matrix feature
# Read more under http://docs.travis-ci.com/user/build-configuration/
sudo: false
language: python
env:
matrix:
- TOXENV=py27
- TOXENV=py36
addons:
apt:
packages:
- git
- python-pip
install:
- pip install 'tox<3.0'
script:
- tox --version
- ./scripts/ci/conditional_tox.sh
branches:
only:
- master
cache:
directories:
- $HOME/.pip-cache

notifications:
email: false
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include *.rst *.txt *.sql *.json
recursive-include tests *

include versioneer.py
include topojson/_version.py
Empty file modified README.md
100755 → 100644
Empty file.
2 changes: 0 additions & 2 deletions __init__.py

This file was deleted.

22 changes: 0 additions & 22 deletions geojson/conversion.py

This file was deleted.

105 changes: 0 additions & 105 deletions geojson/geojson.py

This file was deleted.

26 changes: 26 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

.PHONY : develop build clean clean_pyc tseries doc test

test:
py.test --cov=topojson --cov-report term

clean:
-python setup.py clean

clean_pyc:
-find . -name '*.py[co]' -exec rm {} \;

build: clean_pyc
python setup.py bdist_wheel --universal;

lint-diff:
git diff master --name-only -- "*.py" | grep "topojson" | xargs flake8

develop: build
-python setup.py develop

doc:
-rm -rf doc/build doc/source/generated
cd doc; \
python make.py clean; \
python make.py html
11 changes: 11 additions & 0 deletions scripts/ci/conditional_tox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -ex

ENDENV=$(echo $TOXENV | tail -c 7)
if [[ $ENDENV == gcloud ]]
then
[[ $DIDNT_CREATE_GCP_CREDS = 1 ]] || tox
else
tox --hashseed 1
fi
37 changes: 37 additions & 0 deletions scripts/ci/travis_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
# This script is meant to be called by the "install" step defined in
# .travis.yml. See http://docs.travis-ci.com/ for more details.
# The behavior of the script is controlled by environment variabled defined
# in the .travis.yml in the top level folder of the project.
#
# This script is taken from Scikit-Learn (http://scikit-learn.org/)
#
# THIS SCRIPT IS SUPPOSED TO BE AN EXAMPLE. MODIFY IT ACCORDING TO YOUR NEEDS!

set -e

if [[ "$DISTRIB" == "conda" ]]; then
# Deactivate the travis-provided virtual environment and setup a
# conda-based environment instead
deactivate

# Use the miniconda installer for faster download / install of conda
# itself
wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh \
-O miniconda.sh
chmod +x miniconda.sh && ./miniconda.sh -b -p $HOME/miniconda
export PATH=$HOME/miniconda/bin:$PATH
conda update --yes conda

# Configure the conda environment and put it in the path using the
# provided versions
conda create -n testenv --yes python=$PYTHON_VERSION pip
source activate testenv

# elif [[ "$DISTRIB" == "ubuntu" ]]; then
# Use standard ubuntu packages in their default version
fi

if [[ "$COVERAGE" == "true" ]]; then
pip install coverage coveralls
fi
43 changes: 43 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[bdist_wheel]
# This flag says that the code is written to work on both Python 2 and Python
# 3. If at all possible, it is good practice to do this. If you cannot, you
# will need to generate wheels for each Python version that you support.
universal=1

[pep8]
ignore = E501
max-line-length = 160

[coverage:run]

[coverage:report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:
def __repr__
if self\.debug

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:

ignore_errors = True

[coverage:html]
directory = $CIRCLE_ARTIFACTS


[versioneer]
VCS = git
style = pep440
versionfile_source = topojson/_version.py
versionfile_build = topojson/_version.py
tag_prefix = v
parentdir_prefix = tp-
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from setuptools import setup, find_packages
import versioneer

setup(
name="topojson",
version="0.1.0",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
license="BSD",
packages=find_packages(),
packages=find_packages(exclude=['tests']),
test_suite="tests"
)
3 changes: 2 additions & 1 deletion tests/topojson_test.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import json
import unittest

from os import path as p
from topojson.conversion import convert


class TestTopojson(unittest.TestCase):

def setUp(self):
path = p.join(p.dirname(__file__), 'data', 'square.geojson')
with open("tests/data/square.geojson") as f:
self.square_geojson = json.load(f)

Expand Down
7 changes: 7 additions & 0 deletions topojson/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
from .conversion import convert as topojson
from .geojson import geojson

_all_ = ['geojson', 'topojson']

from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
Loading