Skip to content

Commit

Permalink
Setup dev tools (#1)
Browse files Browse the repository at this point in the history
Adds Makefile and bumpversion and updates distribution config
  • Loading branch information
matyama committed Apr 17, 2019
1 parent 29a90ab commit 04c6c77
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 14 deletions.
9 changes: 9 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[bumpversion]
current_version = 0.0.1
commit = False
tag = False

[bumpversion:file:setup.py]
search = version = {current_version}
replace = {new_version}

4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ notifications:
email: false

install:
- pip install -U -e .[test]
- make setup

script:
- flake8 --config=.flake8 cytoolz-stubs
- make release-check

cache:
directories:
Expand Down
50 changes: 50 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.PHONY: help build clean clean-build setup setup-dev release-check flake8-check twine-release-test

.DEFAULT: help
help:
@echo "make build"
@echo " build distribution directories"
@echo "make clean"
@echo " clean virtual environment and distribution"
@echo "make clean-build"
@echo " clean distribution directories"
@echo "make setup"
@echo " setup development environment"
@echo "make setup-dev"
@echo " setup virtualenv and development environment"
@echo "make flake8-check"
@echo " run flake8 code style check"
@echo "make release-check"
@echo " run release checks"
@echo "make twine-release-test"
@echo " release to test pypi using twine"

build: clean-build
@echo ">>> building ftoolz distribution"
python setup.py sdist

clean: clean-build
rm -rf venv

clean-build:
rm -rf dist
rm -rf build
rm -rf *.egg-info

setup: clean
pip install -U -e .[dev,test]

setup-dev: clean
virtualenv -p python3 venv
./venv/bin/pip install -U pip
./venv/bin/pip install -U setuptools
./venv/bin/pip install -U -e .[dev,test]

flake8-check:
@echo ">>> enforcing PEP 8 style with flake8 in cytoolz-stubs"
flake8 --config=.flake8 cytoolz-stubs || ( echo ">>> flake8 check failed"; exit 1; )

release-check: flake8-check

twine-release-test: build
python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
45 changes: 33 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,58 @@
import os
from typing import Mapping, Sequence

from setuptools import setup


def find_stubs(package):
stubs = []
for root, dirs, files in os.walk(package):
for file in files:
path = os.path.join(root, file).replace(package + os.sep, '', 1)
stubs.append(path)
def find_stubs(package: str) -> Mapping[str, Sequence[str]]:
stubs = [
os.path.join(root, file).replace(package + os.sep, '', 1)
for root, dirs, files in os.walk(package)
for file in files
]
return {package: stubs}


requirements = [
'cytoolz==0.9.0.1',
]

dev_requirements = [
'bumpversion==0.5.3',
'twine==1.13.0',
]

test_requirements = [
'flake8==3.7.7',
]

version = '0.0.1'

setup(
name='cytoolz-stubs',
maintainer="Martin Matyasek",
maintainer_email="[email protected]",
description="PEP 561 type stubs for cytoolz",
url="https://github.com/blindspot-ai/cytoolz-stubs",
version=version,
license='MIT',
version="0.0.1",
description='PEP 561 type stubs for cytoolz',
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'Natural Language :: English',
'Operating System :: Unix',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
url='https://github.com/blindspot-ai/cytoolz-stubs',
maintainer='Martin Matyasek',
maintainer_email='[email protected]',
keywords='cytoolz stubs',
packages=['cytoolz-stubs'],
zip_safe=False,
python_requires='>=3.6',
install_requires=requirements,
extras_require={'test': test_requirements},
extras_require={'dev': dev_requirements, 'test': test_requirements},
tests_require=requirements + test_requirements,
package_data=find_stubs('cytoolz-stubs'),
)

0 comments on commit 04c6c77

Please sign in to comment.