Skip to content

Commit

Permalink
MAINT: Update project boilerplate files improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmax committed Jul 5, 2016
1 parent e8bcae5 commit dbc4ecf
Show file tree
Hide file tree
Showing 22 changed files with 207 additions and 129 deletions.
34 changes: 34 additions & 0 deletions .bumpversion.cfg
@@ -0,0 +1,34 @@
[bumpversion]
current_version = 0.3.0-dev
commit = False
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>\w+))?
serialize =
{major}.{minor}.{patch}-{release}
{major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = placeholder
values =
dev
placeholder

[bumpversion:file:VERSION]
search = {current_version}
replace = {new_version}

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

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

[bumpversion:file:HISTORY.rst]
search = .. comment:: bumpversion marker
replace = .. comment:: bumpversion marker

{new_version} ({now:%Y-%m-%d})
------------------

6 changes: 4 additions & 2 deletions .cookiecutterrc
Expand Up @@ -9,9 +9,11 @@ cookiecutter:
project_short_description: A decorator for writing coroutine-like spider callbacks.
project_slug: scrapy-inline-requests
pypi_username: rolando
release_date: '2012-02-03'
use_codecov: y
use_cython: n
use_landscape: y
use_pypi_deployment_with_travis: n
use_pytest: y
version: 0.3.1dev
use_requiresio: y
version: 0.3.1-dev
year: 2012-2016
15 changes: 15 additions & 0 deletions .coveragerc
@@ -0,0 +1,15 @@
[paths]
source =
src

[run]
branch = true
source =
inline_requests
tests
parallel = true

[report]
show_missing = true
precision = 2
omit =
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -57,3 +57,6 @@ docs/_build/

# PyBuilder
target/

# rope-vim
.ropeproject
12 changes: 10 additions & 2 deletions .travis.yml
Expand Up @@ -22,15 +22,23 @@ before_install:

# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install:
- pip install -U tox twine
- pip install -U tox
- pip install -U coverage
- virtualenv --version
- easy_install --version
- pip --version
- tox --version

# command to run tests, e.g. python setup.py test
script:
- tox -v
- tox

after_success:
- |
# Codecov requires a single .coverage and will run 'coverage xml' to
# generate the report.
coverage combine
bash <(curl -s https://codecov.io/bash)
after_failure:
- more .tox/log/* | cat
Expand Down
15 changes: 8 additions & 7 deletions HISTORY.rst
Expand Up @@ -2,18 +2,19 @@
History
=======

0.3.1dev (next release)
-----------------------
.. comment:: bumpversion marker

* TODO
0.3.1-dev (unreleased)
----------------------
* Added deprecation about decorating non-spider functions.
* Warn if the callback returns requests with callback or errback set. This
reverts the compability with requests with callbacks.

0.3.0 (2016-06-24)
------------------

* ~~Backward incompatible change: Added more restrictions to the request object (no callback/errback).~~
* Cleanup callback/errback attributes before sending back the request to the
generator. This fixes an edge case when using ``request.repalce()``.
* Warn if the callback returns requests with callback or errback set.
* Added deprecation about decorating non-spider functions.
generator. This fixes an edge case when using ``request.replace()``.
* Simplified example spider.

0.2.0 (2016-06-23)
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Expand Up @@ -9,8 +9,8 @@ include *.rst
include *.txt

include LICENSE
include VERSION
include Makefile
include conftest.py

global-exclude __pycache__ *.py[cod]
global-exclude *.so *.dylib
55 changes: 39 additions & 16 deletions Makefile
@@ -1,5 +1,5 @@
.PHONY: clean-so clean-test clean-pyc clean-build clean-docs clean
.PHONY: docs check check-manifest check-setup lint
.PHONY: docs check check-manifest check-setup check-history lint
.PHONY: test test-all coverage
.PHONY: compile-reqs install-reqs
.PHONY: release dist install build-inplace
Expand All @@ -21,6 +21,7 @@ help:
@echo "check - check setup, code style, setup, etc"
@echo "check-manifest - check manifest"
@echo "check-setup - check setup"
@echo "check-history - check history"
@echo "clean - remove all build, test, coverage and Python artifacts"
@echo "clean-build - remove build artifacts"
@echo "clean-docs - remove docs artifacts"
Expand All @@ -39,14 +40,20 @@ help:
@echo "develop - install package in develop mode"
@echo "install - install the package to the active Python's site-packages"

check: check-setup check-manifest lint
check: check-setup check-manifest check-history lint

check-setup:
@echo "Checking package metadata (name, description, etc)"
python setup.py check --strict --metadata --restructuredtext

check-manifest:
@echo "Checking MANIFEST.in"
check-manifest --ignore ".*"

check-history:
@echo "Checking latest version in HISTORY"
VERSION=`cat VERSION`; grep "^$${VERSION}\b" HISTORY.rst

clean: clean-build clean-docs clean-pyc clean-test clean-so

clean-build:
Expand Down Expand Up @@ -80,41 +87,39 @@ build-inplace:
python setup.py build_ext --inplace

develop: clean
python setup.py develop -v
pip install -e .

test: develop
py.test -v
py.test

test-all:
tox -v

coverage: develop
coverage run -m pytest
coverage run -m py.test
coverage combine
coverage report
coverage html
$(BROWSER) htmlcov/index.html

compile-reqs:
pip-compile -v requirements.in -o requirements.txt
pip-compile -v dev-requirements.in -o dev-requirements.txt

install-reqs:
pip install -r requirements.txt
pip install -r dev-requirements.txt

docs:
docs-build: develop
rm -f docs/inline_requests.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ src/inline_requests
$(MAKE) -C docs clean
$(MAKE) -C docs $(SPHINX_BUILD)

docs: docs-build
$(BROWSER) docs/_build/$(SPHINX_BUILD)/index.html

servedocs: docs
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .

release: dist
release: clean check dist
git branch | grep '* master'
# Tagging release.
VERSION=`cat VERSION`; git tag -a v$$VERSION
git push --follow-tags
twine upload dist/*

dist: clean
Expand All @@ -123,4 +128,22 @@ dist: clean
ls -l dist

install: clean
python setup.py install
pip install .

REQUIREMENTS_IN := $(wildcard requirements*.in)
.PHONY: $(REQUIREMENTS_IN)

requirements%.txt: requirements%.in
pip-compile -v $< -o $@

REQUIREMENTS_TXT := $(REQUIREMENTS_IN:.in=.txt)
ifndef REQUIREMENTS_TXT
REQUIREMENTS_TXT := $(wildcard requirements*.txt)
endif

compile-reqs: $(REQUIREMENTS_TXT)
@test -z "$$REQUIREMENTS_TXT" && echo "No 'requirements*.in' files. Nothing to do"

install-reqs:
@test -z "$$REQUIREMENTS_TXT" && echo "No 'requirements*.txt' files. Nothing to do"
$(foreach req,$(REQUIREMENTS_TXT),pip install -r $(req);)
21 changes: 17 additions & 4 deletions README.rst
Expand Up @@ -5,20 +5,33 @@ Scrapy Inline Requests
.. image:: https://img.shields.io/pypi/v/scrapy-inline-requests.svg
:target: https://pypi.python.org/pypi/scrapy-inline-requests

.. image:: https://img.shields.io/travis/rolando/scrapy-inline-requests.svg
:target: https://travis-ci.org/rolando/scrapy-inline-requests
.. image:: https://img.shields.io/pypi/pyversions/scrapy-inline-requests.svg
:target: https://pypi.python.org/pypi/scrapy-inline-requests

.. image:: https://readthedocs.org/projects/scrapy-inline-requests/badge/?version=latest
:target: https://readthedocs.org/projects/scrapy-inline-requests/?badge=latest
:alt: Documentation Status

.. image:: https://img.shields.io/travis/rolando/scrapy-inline-requests.svg
:target: https://travis-ci.org/rolando/scrapy-inline-requests

A decorator for writing coroutine-like spider callbacks.
.. image:: https://codecov.io/github/rolando/scrapy-inline-requests/coverage.svg?branch=master
:alt: Coverage Status
:target: https://codecov.io/github/rolando/scrapy-inline-requests

.. image:: https://landscape.io/github/rolando/scrapy-inline-requests/master/landscape.svg?style=flat
:target: https://landscape.io/github/rolando/scrapy-inline-requests/master
:alt: Code Quality Status

Requires ``Scrapy>=1.0`` and supports Python 2.7+ and 3.4+.
.. image:: https://requires.io/github/rolando/scrapy-inline-requests/requirements.svg?branch=master
:alt: Requirements Status
:target: https://requires.io/github/rolando/scrapy-inline-requests/requirements/?branch=master

A decorator for writing coroutine-like spider callbacks.

* Free software: MIT license
* Documentation: https://scrapy-inline-requests.readthedocs.org.
* Python versions: 2.7, 3.4+

Quickstart
----------
Expand Down
1 change: 1 addition & 0 deletions VERSION
@@ -0,0 +1 @@
0.3.1-dev
24 changes: 10 additions & 14 deletions docs/conf.py
Expand Up @@ -13,8 +13,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import re

# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
Expand All @@ -23,15 +23,7 @@
#sys.path.insert(0, os.path.abspath('.'))

# Get the project root dir, which is the parent dir of this
cwd = os.getcwd()
project_root = os.path.dirname(cwd)

# Insert the project root dir as the first element in the PYTHONPATH.
# This lets us ensure that the source package is imported, and that its
# version is used.
sys.path.insert(0, project_root)

import inline_requests
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# -- General configuration ---------------------------------------------

Expand All @@ -40,7 +32,11 @@

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand All @@ -62,10 +58,10 @@
# for |version| and |release|, also used in various other places throughout
# the built documents.
#
# The short X.Y version.
version = inline_requests.__version__
# The full version, including alpha/beta/rc tags.
release = inline_requests.__version__
release = open(os.path.join(project_root, 'VERSION')).read().strip()
# The short X.Y version.
version = re.findall(r'\d+\.\d+\.\d+', release)[0]

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
10 changes: 9 additions & 1 deletion docs/index.rst
Expand Up @@ -4,7 +4,7 @@
contain the root `toctree` directive.
Welcome to Scrapy Inline Requests's documentation!
======================================
==================================================

Contents:

Expand All @@ -15,3 +15,11 @@ Contents:
installation
reference
history

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

2 changes: 1 addition & 1 deletion docs/installation.rst
Expand Up @@ -42,7 +42,7 @@ Once you have a copy of the source, you can install it with:

.. code-block:: console
$ python setup.py install
$ pip install -e .
.. _Github repo: https://github.com/rolando/scrapy-inline-requests
Expand Down
13 changes: 13 additions & 0 deletions pytest.ini
@@ -0,0 +1,13 @@
[pytest]
norecursedirs =
.*
dist
build
python_files =
test_*.py
*_test.py
tests.py
ignore =
setup.py
addopts =
-rxEfsw -v
8 changes: 8 additions & 0 deletions requirements-dev.txt
@@ -0,0 +1,8 @@
# This packages are requires only for development and release management.
Sphinx
bumpversion
check-manifest
pip-tools
twine
watchdog
wheel
3 changes: 3 additions & 0 deletions requirements-install.txt
@@ -0,0 +1,3 @@
# This packages are required to install and run our package.
Scrapy>=1.0
six>=1.5

0 comments on commit dbc4ecf

Please sign in to comment.