Debian Codegraph @

setup.py

raw
1 #!/usr/bin/env python
2 #
3 # Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
4 # Copyright (c) 2013-2016 California Institute of Technology.
5 # Copyright (c) 2016-2026 The Uncertainty Quantification Foundation.
6 # License: 3-clause BSD. The full license text is available at:
7 # - https://github.com/uqfoundation/klepto/blob/master/LICENSE
8
9 import os
10 import sys
11 # drop support for older python
12 if sys.version_info < (3, 9):
13 unsupported = 'Versions of Python before 3.9 are not supported'
14 raise ValueError(unsupported)
15
16 # get distribution meta info
17 here = os.path.abspath(os.path.dirname(__file__))
18 sys.path.append(here)
19 from version import (__version__, __author__, __contact__ as AUTHOR_EMAIL,
20 get_license_text, get_readme_as_rst, write_info_file)
21 LICENSE = get_license_text(os.path.join(here, 'LICENSE'))
22 README = get_readme_as_rst(os.path.join(here, 'README.md'))
23
24 # write meta info file
25 write_info_file(here, 'klepto', doc=README, license=LICENSE,
26 version=__version__, author=__author__)
27 del here, get_license_text, get_readme_as_rst, write_info_file
28
29 # check if setuptools is available
30 try:
31 from setuptools import setup
32 from setuptools.dist import Distribution
33 has_setuptools = True
34 except ImportError:
35 from distutils.core import setup
36 Distribution = object
37 has_setuptools = False
38
39 # build the 'setup' call
40 setup_kwds = dict(
41 name='klepto',
42 version=__version__,
43 description='persistent caching to memory, disk, or database',
44 long_description = README.strip(),
45 author = __author__,
46 author_email = AUTHOR_EMAIL,
47 maintainer = __author__,
48 maintainer_email = AUTHOR_EMAIL,
49 license = 'BSD-3-Clause',
50 platforms = ['Linux', 'Windows', 'Mac'],
51 url = 'https://github.com/uqfoundation/klepto',
52 download_url = 'https://pypi.org/project/klepto/#files',
53 project_urls = {
54 'Documentation':'http://klepto.rtfd.io',
55 'Source Code':'https://github.com/uqfoundation/klepto',
56 'Bug Tracker':'https://github.com/uqfoundation/klepto/issues',
57 },
58 python_requires = '>=3.9',
59 classifiers = [
60 'Development Status :: 5 - Production/Stable',
61 'Intended Audience :: Developers',
62 'Intended Audience :: Science/Research',
63 'License :: OSI Approved :: BSD License',
64 'Programming Language :: Python :: 3',
65 'Programming Language :: Python :: 3.9',
66 'Programming Language :: Python :: 3.10',
67 'Programming Language :: Python :: 3.11',
68 'Programming Language :: Python :: 3.12',
69 'Programming Language :: Python :: 3.13',
70 'Programming Language :: Python :: 3.14',
71 'Programming Language :: Python :: Implementation :: CPython',
72 'Programming Language :: Python :: Implementation :: PyPy',
73 'Topic :: Database',
74 'Topic :: Scientific/Engineering',
75 'Topic :: Software Development',
76 ],
77 packages = ['klepto','klepto.tests'],
78 package_dir = {'klepto':'klepto', 'klepto.tests':'klepto/tests'},
79 )
80
81 # force python-, abi-, and platform-specific naming of bdist_wheel
82 class BinaryDistribution(Distribution):
83 """Distribution which forces a binary package with platform name"""
84 def has_ext_modules(foo):
85 return True
86
87 # define dependencies
88 sysversion = sys.version_info[:3]
89 dill_version = 'dill>=0.4.1'
90 pox_version = 'pox>=0.3.7'
91 jsonpickle_version = 'jsonpickle>=0.9.6'
92 cloudpickle_version = 'cloudpickle>=0.5.2'
93 sqlalchemy_version = 'sqlalchemy>=1.4.0'
94 h5py_version = 'h5py>=2.8.0'
95 pandas_version = 'pandas>=0.17.0'
96 # add dependencies
97 depend = [pox_version, dill_version]
98 extras = {'archives': [h5py_version, sqlalchemy_version, pandas_version], 'crypto': [jsonpickle_version, cloudpickle_version]}
99 # update setup kwds
100 if has_setuptools:
101 setup_kwds.update(
102 zip_safe=False,
103 # distclass=BinaryDistribution,
104 install_requires=depend,
105 extras_require=extras,
106 )
107
108 # call setup
109 setup(**setup_kwds)
110
111 # if dependencies are missing, print a warning
112 try:
113 import dill
114 import pox
115 #import jsonpickle
116 #import cloudpickle
117 #import sqlalchemy
118 #import h5py
119 #import pandas
120 except ImportError:
121 print ("\n***********************************************************")
122 print ("WARNING: One of the following dependencies is unresolved:")
123 print (" %s" % dill_version)
124 print (" %s" % pox_version)
125 print (" %s (optional)" % jsonpickle_version)
126 print (" %s (optional)" % cloudpickle_version)
127 print (" %s (optional)" % sqlalchemy_version)
128 print (" %s (optional)" % h5py_version)
129 print (" %s (optional)" % pandas_version)
130 print ("***********************************************************\n")