bidict/setup.py

119 lines
3.5 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2018-01-01 03:51:19 +00:00
# Copyright 2018 Joshua Bronson. All Rights Reserved.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
2017-03-17 16:16:45 +00:00
"""A setuptools-based setup module.
2017-03-17 16:16:45 +00:00
Ref: https://github.com/pypa/sampleproject/blob/master/setup.py
"""
from codecs import open as c_open
from os.path import abspath, dirname, join
2017-03-17 16:16:45 +00:00
from setuptools import setup
2017-03-17 16:16:45 +00:00
CWD = abspath(dirname(__file__))
# Get bidict's package metadata from ./bidict/metadata.py.
METADATA_PATH = join(CWD, 'bidict', 'metadata.py')
try:
from importlib.util import module_from_spec, spec_from_file_location
except ImportError: # Python < 3.5
try:
from importlib.machinery import SourceFileLoader
except ImportError: # Python < 3.3 - treat as Python 2 (otherwise unsupported).
from imp import load_source
METADATA = load_source('metadata', METADATA_PATH)
else: # Python 3.3 or 3.4
LOADER = SourceFileLoader('metadata', METADATA_PATH)
METADATA = LOADER.load_module() # pylint: disable=deprecated-method
else:
SPEC = spec_from_file_location('metadata', METADATA_PATH)
METADATA = module_from_spec(SPEC)
SPEC.loader.exec_module(METADATA)
with c_open(join(CWD, 'README.rst'), encoding='utf-8') as f:
LONG_DESCRIPTION = f.read()
2017-12-17 18:22:42 +00:00
SETUP_REQS = [
'pytest-runner',
'setuptools_scm',
]
2017-12-17 18:22:42 +00:00
TEST_REQS = [
'hypothesis<4',
'hypothesis-pytest<1',
'py<2',
'pytest<4',
'pytest-benchmark<4',
'sortedcollections<1',
'sortedcontainers<2',
]
2017-12-17 18:22:42 +00:00
COVERAGE_REQS = [
'coverage<5',
'pytest-cov<3',
]
strengthen too-weak assume(..) in test_eq_ne_hash, use "max_examples=5000" for nightly CI jobs, add .readthedocs.yml The `assume(init_items != init_unequal)` was not sufficient because it would allow cases like: bi_cls=bidict, other_cls=bidict, init_items=[(1, 0), (0, 1)], init_unequal=[(0, 1), (1, 0)] causing the resulting bidicts' item sets to still be equal, so assertions like assert items_match(some_bidict, other_unequal, relation=ne) would fail. Changing the assume to assume(set(init_items) != set(init_unequal)) fixes the issue. Surprisingly, hypothesis only just found a failing example for this for the first time (in https://travis-ci.org/jab/bidict/jobs/363962257) despite having numerous opportunities to find it before. Using a new max_examples=5000 hypothesis profile, only on nightly CI, should help surface any remaining issues that hypothesis hasn't found yet, without slowing commit-triggered tests with too much example generation. Also improve Travis config: - ditch ALLOW_FAIL=1, for some reason it didn't work - comment out python 3.7-dev job while Travis is stuck on an old 3.7 alpha - don't use "- |" command block where we want to see output after each command - prefix more network-dependent commands with travis_retry Finally, improve docs building setup: - Factor out sphinx from "dev" extras_require to its own "docs" extras_require. - Add a .readthedocs.yml to customize the readthedocs build. Use pip and the "docs" extras_require to get an up-to-date Sphinx version. Fixes some broken :ref:`addendum:...` autosectionlabel links in learning-from-bidict.
2018-04-10 04:31:29 +00:00
DOCS_REQS = [
2017-12-17 18:22:42 +00:00
'Sphinx<2',
strengthen too-weak assume(..) in test_eq_ne_hash, use "max_examples=5000" for nightly CI jobs, add .readthedocs.yml The `assume(init_items != init_unequal)` was not sufficient because it would allow cases like: bi_cls=bidict, other_cls=bidict, init_items=[(1, 0), (0, 1)], init_unequal=[(0, 1), (1, 0)] causing the resulting bidicts' item sets to still be equal, so assertions like assert items_match(some_bidict, other_unequal, relation=ne) would fail. Changing the assume to assume(set(init_items) != set(init_unequal)) fixes the issue. Surprisingly, hypothesis only just found a failing example for this for the first time (in https://travis-ci.org/jab/bidict/jobs/363962257) despite having numerous opportunities to find it before. Using a new max_examples=5000 hypothesis profile, only on nightly CI, should help surface any remaining issues that hypothesis hasn't found yet, without slowing commit-triggered tests with too much example generation. Also improve Travis config: - ditch ALLOW_FAIL=1, for some reason it didn't work - comment out python 3.7-dev job while Travis is stuck on an old 3.7 alpha - don't use "- |" command block where we want to see output after each command - prefix more network-dependent commands with travis_retry Finally, improve docs building setup: - Factor out sphinx from "dev" extras_require to its own "docs" extras_require. - Add a .readthedocs.yml to customize the readthedocs build. Use pip and the "docs" extras_require to get an up-to-date Sphinx version. Fixes some broken :ref:`addendum:...` autosectionlabel links in learning-from-bidict.
2018-04-10 04:31:29 +00:00
]
DEV_REQ = SETUP_REQS + TEST_REQS + COVERAGE_REQS + DOCS_REQS + [
2017-12-17 18:22:42 +00:00
'pre-commit<2',
'tox<4',
# The following dependencies have a higher chance of suddenly causing CI to fail after updating
# even between minor versions so pin to currently-working minor versions. Upgrade to newer
# minor versions manually to have a chance to fix any resulting breakage before it hits CI.
2017-12-17 18:22:42 +00:00
'flake8<3.6',
'pydocstyle<2.2',
'pylint<2.1',
]
2014-09-23 14:08:21 +00:00
setup(
name='bidict',
use_scm_version={
'version_scheme': 'guess-next-dev',
'local_scheme': 'dirty-tag',
'write_to': 'bidict/_version.py',
},
author=METADATA.__author__,
author_email=METADATA.__email__,
description=METADATA.__description__,
long_description=LONG_DESCRIPTION,
keywords=METADATA.__keywords__,
url=METADATA.__url__,
license=METADATA.__license__,
2015-05-30 20:26:26 +00:00
packages=['bidict'],
zip_safe=False, # Don't zip. (We're zip-safe but prefer not to.)
2014-09-23 14:08:21 +00:00
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
2017-03-15 20:43:05 +00:00
'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
2014-09-23 14:08:21 +00:00
'Operating System :: OS Independent',
2014-09-30 15:54:30 +00:00
'Programming Language :: Python :: 2.7',
2015-11-28 14:17:43 +00:00
'Programming Language :: Python :: 3',
2014-09-30 15:54:30 +00:00
'Programming Language :: Python :: 3.4',
2015-09-14 14:11:55 +00:00
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
2014-09-30 15:54:30 +00:00
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
2014-09-23 14:08:21 +00:00
'Topic :: Software Development :: Libraries :: Python Modules',
],
2017-12-17 18:22:42 +00:00
setup_requires=SETUP_REQS,
tests_require=TEST_REQS,
extras_require=dict(
2017-12-17 18:22:42 +00:00
test=TEST_REQS,
coverage=COVERAGE_REQS,
strengthen too-weak assume(..) in test_eq_ne_hash, use "max_examples=5000" for nightly CI jobs, add .readthedocs.yml The `assume(init_items != init_unequal)` was not sufficient because it would allow cases like: bi_cls=bidict, other_cls=bidict, init_items=[(1, 0), (0, 1)], init_unequal=[(0, 1), (1, 0)] causing the resulting bidicts' item sets to still be equal, so assertions like assert items_match(some_bidict, other_unequal, relation=ne) would fail. Changing the assume to assume(set(init_items) != set(init_unequal)) fixes the issue. Surprisingly, hypothesis only just found a failing example for this for the first time (in https://travis-ci.org/jab/bidict/jobs/363962257) despite having numerous opportunities to find it before. Using a new max_examples=5000 hypothesis profile, only on nightly CI, should help surface any remaining issues that hypothesis hasn't found yet, without slowing commit-triggered tests with too much example generation. Also improve Travis config: - ditch ALLOW_FAIL=1, for some reason it didn't work - comment out python 3.7-dev job while Travis is stuck on an old 3.7 alpha - don't use "- |" command block where we want to see output after each command - prefix more network-dependent commands with travis_retry Finally, improve docs building setup: - Factor out sphinx from "dev" extras_require to its own "docs" extras_require. - Add a .readthedocs.yml to customize the readthedocs build. Use pip and the "docs" extras_require to get an up-to-date Sphinx version. Fixes some broken :ref:`addendum:...` autosectionlabel links in learning-from-bidict.
2018-04-10 04:31:29 +00:00
docs=DOCS_REQS,
dev=DEV_REQ,
),
)