Skip to content

Commit a1a3171

Browse files
Refactored setup and __version__ single-sourcing.
1 parent 1450cb9 commit a1a3171

11 files changed

+47
-35
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ celerybeat-schedule
9292
.venv
9393
venv/
9494
.python27
95+
.clean
9596
ENV/
9697
.activate.ps1
9798

MANIFEST.in

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# Include the README
2-
include *.md
3-
41
# Include the LICENSE file
52
include LICENSE
63

74
# Include the VERSION file
8-
include VERSION
5+
# include VERSION
6+
7+
# Include the README file
8+
include README.rst
9+
include _README.md

README.rst

+7-18
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
.. Validator Collection documentation master file, created by
2-
sphinx-quickstart on Sat Apr 14 11:13:03 2018.
3-
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
51

6-
####################################################
2+
3+
======================
74
Validator Collection
8-
####################################################
5+
======================
96

107
**Python library of 60+ commonly-used validator functions**
118

@@ -91,9 +88,7 @@ Available Validators and Checkers
9188
Validators
9289
=============
9390

94-
.. seealso::
95-
96-
Please see the `Validator Reference <http://validator-collection.readthedocs.io/en/latest/validators.html>`_
91+
Please see the `Validator Reference <http://validator-collection.readthedocs.io/en/latest/validators.html>`_
9792

9893
.. list-table::
9994
:widths: 30 30 30 30 30
@@ -143,9 +138,7 @@ Validators
143138
Checkers
144139
==========
145140

146-
.. sealso::
147-
148-
Please see the `Checker Reference <http://validator-collection.readthedocs.io/en/latest/checkers.html>`_
141+
Please see the `Checker Reference <http://validator-collection.readthedocs.io/en/latest/checkers.html>`_
149142

150143
.. list-table::
151144
:widths: 30 30 30 30 30
@@ -266,9 +259,7 @@ two flavors: a validator and a checker.
266259
Using Validators
267260
==================
268261

269-
.. sealso::
270-
271-
Please see the `Validator Reference <http://validator-collection.readthedocs.io/en/latest/validators.html>`_
262+
Please see the `Validator Reference <http://validator-collection.readthedocs.io/en/latest/validators.html>`_
272263

273264
A validator does what it says on the tin: It validates that an input value is
274265
what you think it should be, and returns its valid form.
@@ -322,9 +313,7 @@ and what can cause them, please review the `Validator Reference <http://validato
322313
Using Checkers
323314
================
324315

325-
.. seealso::
326-
327-
Please see the `Checker Reference <http://validator-collection.readthedocs.io/en/latest/checkers.html>`_
316+
Please see the `Checker Reference <http://validator-collection.readthedocs.io/en/latest/checkers.html>`_
328317

329318
Likewise, a checker is what it sounds like: It checks that an input value
330319
is what you expect it to be, and tells you ``True``/``False`` whether it is or not.

VERSION

-1
This file was deleted.

_README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
# Validator Collection
24
**Python library of 60+ commonly-used validator functions**
35

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# The short X.Y version
3232
version = '1.0'
3333
# The full version, including alpha/beta/rc tags
34-
release = '1.0.0rc1'
34+
release = '1.0.0rc10'
3535

3636

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

setup.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[metadata]
22
license_file = LICENSE
3+
description_file = README.md
34

45
[bdist_wheel]
56
# This flag says to generate wheels that support both Python 2 and Python

setup.py

+21-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
https://github.com/pypa/sampleproject
66
"""
77

8+
import sys
9+
810
# Always prefer setuptools over distutils
911
from setuptools import setup, find_packages
1012
# To use a consistent encoding
@@ -18,12 +20,17 @@
1820
long_description = f.read()
1921

2022
# Get the version number from the VERSION file
21-
with open(path.join(here, 'VERSION'), encoding='utf-8') as f:
22-
version = f.read().strip()
23+
version_dict = {}
24+
with open('./validator_collection/_version.py') as version_file:
25+
exec(version_file.read(), version_dict) # pylint: disable=W0122
26+
27+
version = version_dict.get('__version__')
2328

2429
# Arguments marked as "Required" below must be included for upload to PyPI.
2530
# Fields marked as "Optional" may be commented out.
2631

32+
33+
2734
setup(
2835
# This is the name of your project. The first time you publish this
2936
# package, this name will be registered for you. It will determine how
@@ -139,8 +146,8 @@
139146
# For an analysis of "install_requires" vs pip's requirements files see:
140147
# https://packaging.python.org/en/latest/requirements.html
141148
install_requires=[
142-
"regex ; python_version<'3'"
143-
], # Optional
149+
'regex;python_version<"3"',
150+
],
144151

145152
# List additional groups of dependencies here (e.g. development
146153
# dependencies). Users will be able to install these using the "extras"
@@ -162,16 +169,24 @@
162169
#
163170
# If using Python 2.6 or earlier, then these have to be included in
164171
# MANIFEST.in as well.
165-
#package_data={ # Optional
166-
# 'sample': ['package_data.dat'],
172+
#package_data={
173+
# '': ['_README.rst', 'README.md'],
174+
# '': ['LICENSE', 'VERSION'],
167175
#},
168176

177+
#include_package_data = True,
178+
169179
# Although 'package_data' is the preferred approach, in some case you may
170180
# need to place data files outside of your packages. See:
171181
# http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files
172182
#
173183
# In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
174184
#data_files=[('my_data', ['data/data_file'])], # Optional
185+
#data_files = [
186+
# ('validator_collection', ['LICENSE']),
187+
# ('validator_collection', ['README.md']),
188+
# ('validator_collection', ['VERSION']),
189+
#],
175190

176191
# To provide executable scripts, use entry points in preference to the
177192
# "scripts" keyword. Entry points provide cross-platform support and allow

validator_collection/__init__.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010

1111
import os
1212

13-
with open(os.path.join(os.path.dirname(os.path.dirname(__file__)),
14-
'VERSION')) as version_file:
15-
__version__ = version_file.read().strip()
13+
# Get the version number from the _version.py file
14+
version_dict = {}
15+
with open(os.path.join(os.path.dirname(__file__), '_version.py')) as version_file:
16+
exec(version_file.read(), version_dict) # pylint: disable=W0122
17+
18+
__version__ = version_dict.get('__version__')
19+
1620

1721
from validator_collection.validators import bytesIO, date, dict, decimal, \
1822
directory_exists, datetime, email, float, fraction, file_exists, ip_address, \

validator_collection/_compat.py

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
from fractions import Fraction
1616
import time as time_
1717

18-
import chardet
19-
2018
_ver = sys.version_info
2119

2220
#: Python 2.x?

validator_collection/_version.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# -*- coding: utf-8 -*-
2+
__version__ = '0.1.1rc1'

0 commit comments

Comments
 (0)