Skip to content

Commit ae18666

Browse files
committed
MAINT: Merged project template improvements.
1 parent 608a565 commit ae18666

12 files changed

+65
-43
lines changed

.bumpversion.cfg

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[bumpversion]
2-
current_version = 0.6.3dev
3-
commit = True
2+
current_version = 0.6.3-dev
3+
commit = False
44
tag = False
5-
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?P<release>dev)?
5+
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>\w+))?
66
serialize =
7-
{major}.{minor}.{patch}{release}
7+
{major}.{minor}.{patch}-{release}
88
{major}.{minor}.{patch}
99

1010
[bumpversion:part:release]
@@ -13,9 +13,9 @@ values =
1313
dev
1414
placeholder
1515

16-
[bumpversion:file:setup.py]
17-
search = version='{current_version}'
18-
replace = version='{new_version}'
16+
[bumpversion:file:VERSION]
17+
search = {current_version}
18+
replace = {new_version}
1919

2020
[bumpversion:file:src/scrapy_redis/__init__.py]
2121
search = __version__ = '{current_version}'
@@ -25,3 +25,9 @@ replace = __version__ = '{new_version}'
2525
search = version: {current_version}
2626
replace = version: {new_version}
2727

28+
[bumpversion:file:HISTORY.rst]
29+
search = .. comment:: bumpversion marker
30+
replace = .. comment:: bumpversion marker
31+
32+
{new_version} ({now:%Y-%m-%d})
33+
------------------

.cookiecutterrc

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ cookiecutter:
44
email: rolando at rmax.io
55
full_name: Rolando Espinoza
66
github_username: rolando
7-
project_name: scrapy-redis
7+
project_name: Scrapy-Redis
88
project_package: scrapy_redis
99
project_short_description: Redis-based components for Scrapy.
1010
project_slug: scrapy-redis
1111
pypi_username: rolando
12-
release_date: '2011-09-01'
1312
use_codecov: y
1413
use_cython: n
1514
use_landscape: y
1615
use_pypi_deployment_with_travis: n
1716
use_pytest: y
1817
use_requiresio: y
19-
version: 0.6.3dev
18+
version: 0.6.3-dev
2019
year: 2011-2016

CONTRIBUTING.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ is open to whoever wants to implement it.
3838
Write Documentation
3939
~~~~~~~~~~~~~~~~~~~
4040

41-
scrapy-redis could always use more documentation, whether as part of the
42-
official scrapy-redis docs, in docstrings, or even on the web in blog posts,
41+
Scrapy-Redis could always use more documentation, whether as part of the
42+
official Scrapy-Redis docs, in docstrings, or even on the web in blog posts,
4343
articles, and such.
4444

4545
Submit Feedback

HISTORY.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
History
33
=======
44

5-
0.6.3dev (Y-m-d)
6-
----------------
7-
* TODO
5+
.. comment:: bumpversion marker
6+
7+
0.6.3-dev (unreleased)
8+
----------------------
89

910
0.6.2 (2016-06-26)
1011
------------------

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ include *.rst
99
include *.txt
1010

1111
include LICENSE
12+
include VERSION
1213
include Makefile
1314

1415
global-exclude __pycache__ *.py[cod]

Makefile

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.PHONY: clean-so clean-test clean-pyc clean-build clean-docs clean
2-
.PHONY: docs check check-manifest check-setup lint
2+
.PHONY: docs check check-manifest check-setup check-history lint
33
.PHONY: test test-all coverage
44
.PHONY: compile-reqs install-reqs
55
.PHONY: release dist install build-inplace
@@ -21,6 +21,7 @@ help:
2121
@echo "check - check setup, code style, setup, etc"
2222
@echo "check-manifest - check manifest"
2323
@echo "check-setup - check setup"
24+
@echo "check-history - check history"
2425
@echo "clean - remove all build, test, coverage and Python artifacts"
2526
@echo "clean-build - remove build artifacts"
2627
@echo "clean-docs - remove docs artifacts"
@@ -39,14 +40,20 @@ help:
3940
@echo "develop - install package in develop mode"
4041
@echo "install - install the package to the active Python's site-packages"
4142

42-
check: check-setup check-manifest lint
43+
check: check-setup check-manifest check-history lint
4344

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

4749
check-manifest:
50+
@echo "Checking MANIFEST.in"
4851
check-manifest --ignore ".*"
4952

53+
check-history:
54+
@echo "Checking latest version in HISTORY"
55+
VERSION=`cat VERSION`; grep "^$${VERSION}\b" HISTORY.rst
56+
5057
clean: clean-build clean-docs clean-pyc clean-test clean-so
5158

5259
clean-build:
@@ -95,7 +102,7 @@ coverage: develop
95102
coverage html
96103
$(BROWSER) htmlcov/index.html
97104

98-
docs:
105+
docs: develop
99106
rm -f docs/scrapy_redis.rst
100107
rm -f docs/modules.rst
101108
sphinx-apidoc -o docs/ src/scrapy_redis
@@ -106,7 +113,10 @@ docs:
106113
servedocs: docs
107114
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
108115

109-
release: check dist
116+
release: clean check dist
117+
# Tagging release.
118+
VERSION=`cat VERSION`; git tag -a v$$VERSION
119+
git push --follow-tags
110120
twine upload dist/*
111121

112122
dist: clean
@@ -124,6 +134,10 @@ requirements%.txt: requirements%.in
124134
pip-compile -v $< -o $@
125135

126136
REQUIREMENTS_TXT := $(REQUIREMENTS_IN:.in=.txt)
137+
ifndef REQUIREMENTS_TXT
138+
REQUIREMENTS_TXT := $(wildcard requirements*.txt)
139+
endif
140+
127141
compile-reqs: $(REQUIREMENTS_TXT)
128142
@test -z "$$REQUIREMENTS_TXT" && echo "No 'requirements*.in' files. Nothing to do"
129143

VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.6.3-dev

docs/conf.py

+9-17
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# All configuration values have a default; values that are commented out
1414
# serve to show the default.
1515

16-
import sys
1716
import os
17+
import re
1818

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

2525
# Get the project root dir, which is the parent dir of this
26-
cwd = os.getcwd()
27-
project_root = os.path.dirname(cwd)
28-
29-
# Insert the project root dir as the first element in the PYTHONPATH.
30-
# This lets us ensure that the source package is imported, and that its
31-
# version is used.
32-
sys.path.insert(0, project_root)
33-
34-
import scrapy_redis
26+
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
3527

3628
# -- General configuration ---------------------------------------------
3729

@@ -59,17 +51,17 @@
5951
master_doc = 'index'
6052

6153
# General information about the project.
62-
project = u'scrapy-redis'
54+
project = u'Scrapy-Redis'
6355
copyright = u'2011-2016, Rolando Espinoza'
6456

6557
# The version info for the project you're documenting, acts as replacement
6658
# for |version| and |release|, also used in various other places throughout
6759
# the built documents.
6860
#
69-
# The short X.Y version.
70-
version = scrapy_redis.__version__
7161
# The full version, including alpha/beta/rc tags.
72-
release = scrapy_redis.__version__
62+
release = open(os.path.join(project_root, 'VERSION')).read().strip()
63+
# The short X.Y version.
64+
version = re.findall(r'\d+\.\d+\.\d+', release)[0]
7365

7466
# The language for content autogenerated by Sphinx. Refer to documentation
7567
# for a list of supported languages.
@@ -213,7 +205,7 @@
213205
# [howto/manual]).
214206
latex_documents = [
215207
('index', 'scrapy_redis.tex',
216-
u'scrapy-redis Documentation',
208+
u'Scrapy-Redis Documentation',
217209
u'Rolando Espinoza', 'manual'),
218210
]
219211

@@ -244,7 +236,7 @@
244236
# (source start file, name, description, authors, manual section).
245237
man_pages = [
246238
('index', 'scrapy_redis',
247-
u'scrapy-redis Documentation',
239+
u'Scrapy-Redis Documentation',
248240
[u'Rolando Espinoza'], 1)
249241
]
250242

@@ -259,7 +251,7 @@
259251
# dir menu entry, description, category)
260252
texinfo_documents = [
261253
('index', 'scrapy_redis',
262-
u'scrapy-redis Documentation',
254+
u'Scrapy-Redis Documentation',
263255
u'Rolando Espinoza',
264256
'scrapy-redis',
265257
'One line description of project.',

docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
Welcome to scrapy-redis's documentation!
6+
Welcome to Scrapy-Redis's documentation!
77
======================================
88

99
Contents:

docs/installation.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Installation
88
Stable release
99
--------------
1010

11-
To install scrapy-redis, run this command in your terminal:
11+
To install Scrapy-Redis, run this command in your terminal:
1212

1313
.. code-block:: console
1414
@@ -24,7 +24,7 @@ you through the process.
2424
From sources
2525
------------
2626

27-
The sources for scrapy-redis can be downloaded from the `Github repo`_.
27+
The sources for Scrapy-Redis can be downloaded from the `Github repo`_.
2828

2929
You can either clone the public repository:
3030

setup.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@ def find_packages(path):
1313

1414
def read_file(filename):
1515
with open(filename) as fp:
16-
return fp.read()
16+
return fp.read().strip()
17+
18+
19+
def read_rst(filename):
20+
return "".join(
21+
line for line in read_file(filename).splitlines()
22+
# Ignore unsupported directives by pypi.
23+
if not line.startswith('.. comment::')
24+
)
1725

1826

1927
def read_requirements(filename):
@@ -25,9 +33,9 @@ def read_requirements(filename):
2533

2634
setup(
2735
name='scrapy-redis',
28-
version='0.6.3dev',
36+
version=read_file('VERSION'),
2937
description="Redis-based components for Scrapy.",
30-
long_description=read_file('README.rst') + '\n\n' + read_file('HISTORY.rst'),
38+
long_description=read_rst('README.rst') + '\n\n' + read_rst('HISTORY.rst'),
3139
author="Rolando Espinoza",
3240
author_email='rolando at rmax.io',
3341
url='https://github.com/rolando/scrapy-redis',

src/scrapy_redis/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77

88
__author__ = 'Rolando Espinoza'
99
__email__ = 'rolando at rmax.io'
10-
__version__ = '0.6.3dev'
10+
__version__ = '0.6.3-dev'

0 commit comments

Comments
 (0)