-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsetup.py
65 lines (54 loc) · 2.07 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import os
from setuptools import setup, Command
VERSION = "0.4"
with open(os.path.join(os.path.dirname(__file__), "README.md"), "r") as r:
README = r.read()
class bench(Command):
description = "run lightweight benchmarks"
user_options = [] # distutils complains if this is not here.
def __init__(self, *args):
self.args = args[0] # so we can pass it to other classes
Command.__init__(self, *args)
def initialize_options(self): # distutils wants this
pass
def finalize_options(self): # this too
pass
def run(self):
"""Ensure that several cuids can be generated per millisecond"""
import timeit
setup_stmt = "import cuid; g = cuid.CuidGenerator()"
timed_stmt = "g.cuid()"
times = 1000000
time_to_run = timeit.timeit(timed_stmt, setup=setup_stmt, number=times)
time_each = time_to_run / times
time_each_ns = time_each * 1000000000
print("%d cuids in %f s (%f ns per cuid, %f per sec)" %
(times, time_to_run, time_each_ns, 1.0 / time_each))
setup(
name='cuid',
version=VERSION,
description='Fast, scalable unique ID generation',
long_description=README,
long_description_content_type='text/markdown',
url='http://github.com/necaris/cuid.py',
py_modules=['cuid'],
# license specified by classifier
author='Rami Chowdhury',
author_email='[email protected]',
maintainer='Rami Chowdhury',
maintainer_email='[email protected]',
download_url=('http://github.com/necaris/cuid.py/tarball'
'/v{}'.format(VERSION)),
cmdclass={"bench": bench},
install_requires=[],
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Software Development :: Libraries :: Python Modules",
]
)