Skip to content

Commit

Permalink
Preparing for release on pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Furtado committed Oct 25, 2018
1 parent 6cb11de commit 67d2b00
Show file tree
Hide file tree
Showing 12 changed files with 280 additions and 39 deletions.
9 changes: 9 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Credits

### Development Lead

* Daniel Furtado <daniel@dfurtado.com>

### Contributors

None yet. Why not be the first?
File renamed without changes.
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# History

### 0.1.0 (2018-10-24)

* First release on PyPI.
62 changes: 33 additions & 29 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
BSD 3-Clause License

Copyright (c) 2017, Daniel Furtado
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

The web framework that favorite conventions over configurations
Copyright (C) 2018 Daniel Furtado

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

13 changes: 13 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
include AUTHORS.rst
include CONTRIBUTING.rst
include HISTORY.rst
include LICENSE
include README.rst

recursive-include pyterrier/app_templates *

recursive-include tests *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]

recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
88 changes: 88 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
.PHONY: clean clean-test clean-pyc clean-build docs help
.DEFAULT_GOAL := help

define BROWSER_PYSCRIPT
import os, webbrowser, sys

try:
from urllib import pathname2url
except:
from urllib.request import pathname2url

webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT

define PRINT_HELP_PYSCRIPT
import re, sys

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

BROWSER := python -c "$$BROWSER_PYSCRIPT"

help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts

clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +

clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache

lint: ## check style with flake8
flake8 pyterrier tests

test: ## run tests quickly with the default Python
py.test

test-all: ## run tests on every Python version with tox
tox

coverage: ## check code coverage quickly with the default Python
coverage run --source pyterrier -m pytest
coverage report -m
coverage html
$(BROWSER) htmlcov/index.html

docs: ## generate Sphinx HTML documentation, including API docs
rm -f docs/pyterrier.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ pyterrier
$(MAKE) -C docs clean
$(MAKE) -C docs html
$(BROWSER) docs/_build/html/index.html

servedocs: docs ## compile the docs watching for changes
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .

release: dist ## package and upload a release
twine upload dist/*

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

install: clean ## install the package to the active Python's site-packages
python setup.py install
Empty file added pyterrier/cli/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion pyterrier/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def create_ctrl(ctrl_name):


def _get_ctrl_name(ctrl_name):
if re.search('(\-|\_)', ctrl_name):
if re.search(r'(\-|\_)', ctrl_name):
return None

ctrl_name = re.sub('.py', '', ctrl_name)
Expand Down
24 changes: 24 additions & 0 deletions pyterrier/pyterrier_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import sys
import click

from pyterrier.cli.commands import create_app, create_ctrl


@click.command()
@click.option('--currentdir', is_flag=True)
@click.option('--newapp')
@click.option('--newcontroller')
def main(currentdir, newapp, newcontroller):
if newapp is not None and newcontroller is not None:
print(('pyterrier: error: --newapp and --newcontroller are not meant'
' to be used together.'))
sys.exit()

if newapp is not None:
create_app(newapp, currentdir)
elif newcontroller is not None:
create_ctrl(newcontroller)


if __name__ == "__main__":
sys.exit(main())
26 changes: 26 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[bumpversion]
current_version = 0.1.0
commit = True
tag = True

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

[bumpversion:file:pyterrier/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'

[bdist_wheel]
universal = 1

[flake8]
exclude = docs

[aliases]
# Define setup.py command aliases here
test = pytest

[tool:pytest]
collect_ignore = ['setup.py']

62 changes: 53 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,58 @@
from distutils.core import setup
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""The setup script."""

from setuptools import setup, find_packages

with open('README.rst') as readme_file:
readme = readme_file.read()

with open('HISTORY.rst') as history_file:
history = history_file.read()

requirements = ['Click>=6.0', 'jinja2>=2.10', ]

setup_requirements = ['pytest-runner', ]

test_requirements = ['pytest', ]

setup(
name='Pyterrier',
version='0.1.0',
author='Daniel Furtado',
author="Daniel Furtado",
author_email='daniel@dfurtado.com',
packages=['pyterrier', 'pyterrier.http'],
description='Micro web framework for Python 3',
install_requires=[
"Jinja2 == 2.8",
"nose == 1.3.7",
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
],
description="The web framework that favorite conventions over configurations",
entry_points={
'console_scripts': [
'pyterrier=pyterrier.pyterrier_cli:main',
],
},
install_requires=requirements,
license="GNU General Public License v3",
long_description=readme + '\n\n' + history,
include_package_data=True,
keywords='pyterrier',
name='pyterrier',
packages=find_packages(include=[
'pyterrier',
'pyterrier.app_template',
'pyterrier.cli',
'pyterrier.core',
'pyterrier.encoders',
'pyterrier.http',
'pyterrier.renderers',
'pyterrier.validators']),
setup_requires=setup_requirements,
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/dfurtado/pyterrier',
version='0.1.0',
zip_safe=False,
)
28 changes: 28 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[tox]
envlist = py27, py34, py35, py36, flake8

[travis]
python =
3.6: py36
3.5: py35
3.4: py34
2.7: py27

[testenv:flake8]
basepython = python
deps = flake8
commands = flake8 pyterrier

[testenv]
setenv =
PYTHONPATH = {toxinidir}
deps =
-r{toxinidir}/requirements_dev.txt
; If you want to make tox run the tests with the same versions, create a
; requirements.txt with the pinned versions and uncomment the following line:
; -r{toxinidir}/requirements.txt
commands =
pip install -U pip
py.test --basetemp={envtmpdir}


0 comments on commit 67d2b00

Please sign in to comment.