2017-11-20 03:24:08 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-01-01 03:51:19 +00:00
|
|
|
# Copyright 2018 Joshua Bronson. All Rights Reserved.
|
2017-11-20 03:24:08 +00:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
2018-04-19 08:22:07 +00:00
|
|
|
"""A setuptools-based setup module.
|
2017-03-17 16:16:45 +00:00
|
|
|
|
2018-04-19 08:22:07 +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
|
|
|
|
2017-11-20 03:24:08 +00:00
|
|
|
from setuptools import setup
|
2017-03-17 16:16:45 +00:00
|
|
|
|
2015-03-22 18:21:15 +00:00
|
|
|
|
2018-04-19 08:22:07 +00:00
|
|
|
CWD = abspath(dirname(__file__))
|
|
|
|
|
|
|
|
# Get bidict's package metadata from ./bidict/metadata.py.
|
|
|
|
METADATA_PATH = join(CWD, 'bidict', 'metadata.py')
|
2017-11-21 03:27:26 +00:00
|
|
|
try:
|
2018-04-19 08:22:07 +00:00
|
|
|
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)
|
2018-07-20 04:04:44 +00:00
|
|
|
METADATA = LOADER.load_module('metadata') # pylint: disable=deprecated-method
|
2018-04-19 08:22:07 +00:00
|
|
|
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-11-21 03:27:26 +00:00
|
|
|
|
2017-12-17 18:22:42 +00:00
|
|
|
SETUP_REQS = [
|
2017-11-21 03:27:26 +00:00
|
|
|
'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-11-16 20:44:51 +00:00
|
|
|
]
|
2017-11-21 03:27:26 +00:00
|
|
|
|
2017-12-17 18:22:42 +00:00
|
|
|
COVERAGE_REQS = [
|
|
|
|
'coverage<5',
|
|
|
|
'pytest-cov<3',
|
2017-11-18 03:35:40 +00:00
|
|
|
]
|
2017-11-21 03:27:26 +00:00
|
|
|
|
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',
|
2018-04-06 04:28:44 +00:00
|
|
|
'tox<4',
|
2018-07-17 00:26:36 +00:00
|
|
|
# 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.
|
2018-08-13 17:57:07 +00:00
|
|
|
# *** Keep these in sync with the versions in .travis.yml and .pre-commit-config.yaml ***
|
2017-12-17 18:22:42 +00:00
|
|
|
'flake8<3.6',
|
|
|
|
'pydocstyle<2.2',
|
2018-08-02 01:13:43 +00:00
|
|
|
'pylint<2.2',
|
2015-03-22 18:21:15 +00:00
|
|
|
]
|
|
|
|
|
2014-09-23 14:08:21 +00:00
|
|
|
setup(
|
|
|
|
name='bidict',
|
2018-02-25 23:44:21 +00:00
|
|
|
use_scm_version={
|
|
|
|
'version_scheme': 'guess-next-dev',
|
|
|
|
'local_scheme': 'dirty-tag',
|
|
|
|
'write_to': 'bidict/_version.py',
|
|
|
|
},
|
2018-04-19 08:22:07 +00:00
|
|
|
author=METADATA.__author__,
|
|
|
|
author_email=METADATA.__email__,
|
|
|
|
description=METADATA.__description__,
|
2017-11-21 03:27:26 +00:00
|
|
|
long_description=LONG_DESCRIPTION,
|
2018-04-19 08:22:07 +00:00
|
|
|
keywords=METADATA.__keywords__,
|
|
|
|
url=METADATA.__url__,
|
|
|
|
license=METADATA.__license__,
|
2015-05-30 20:26:26 +00:00
|
|
|
packages=['bidict'],
|
2017-11-20 03:24:08 +00:00
|
|
|
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',
|
squashed changes for 0.13.0
- support Python 3.6, refactor CI/test setup, increase test coverage
- refactor BidirectionalMapping, BidictBase, OrderedBidictBase,
FrozenBidictBase, and subclasses
- move frozenorderedbidict into _frozen and looseorderedbidict into _loose
- register bidict as a virtual subclass of MutableMapping rather than
inheriting from it directly. This makes it clearer that it does not use any
of the concrete generic methods that MutableMapping provides.
- improve performance and flexibility of frozenbidict and
frozenorderedbidict hashing
- docs, including new type-hierarchy.png diagram
- rm unused imap, ifilter, izip_longest from compat, add PYPY
- update to latest versions of dependencies
- restore benchmarking on travis
2017-01-09 15:37:31 +00:00
|
|
|
'Programming Language :: Python :: 3.6',
|
2017-11-16 20:44:51 +00:00
|
|
|
'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-11-20 03:24:08 +00:00
|
|
|
],
|
2017-12-17 18:22:42 +00:00
|
|
|
setup_requires=SETUP_REQS,
|
|
|
|
tests_require=TEST_REQS,
|
2015-03-22 18:21:15 +00:00
|
|
|
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,
|
2017-11-20 03:24:08 +00:00
|
|
|
dev=DEV_REQ,
|
2015-03-22 18:21:15 +00:00
|
|
|
),
|
|
|
|
)
|