-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathsetup.py
68 lines (57 loc) · 2.37 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
66
67
68
"""Augment pandas DataFrame with methods for machine learning"""
__version__ = '0.2.7'
import os
import re
from setuptools import setup, find_packages
from setuptools.command.sdist import sdist
URL = 'https://github.com/KIC/pandas-ml-quant'
NAME = 'pandas-ml-utils'
class SDist(sdist):
def fix_github_links(self, lines):
# ist https://github.com/KIC/pandas-ml-quant/pandas-ml-common/tree/0.2.0/./examples/
# soll https://github.com/KIC/pandas-ml-quant/tree/0.2.0/pandas-ml-common/./examples/
def fix_line(line):
fixed_images = re.sub(r'(^\[ghi\d+]:\s+)', f'\\1{URL}/raw/{__version__}/{NAME}/', line)
fixed_location = re.sub(r'(^\[ghl\d+]:\s+)', f'\\1{URL}/tree/{__version__}/{NAME}/', fixed_images)
fixed_files = re.sub(r'(^\[ghf\d+]:\s+)', f'\\1{URL}/blob/{__version__}/{NAME}/', fixed_location)
return fixed_files
return [fix_line(line) for line in lines]
def make_release_tree(self, base_dir, files):
# create the regular distribution files
super().make_release_tree(base_dir, files)
# but then fix the github links
readme_file = os.path.join(base_dir, 'Readme.md')
readme_lines = open(readme_file).readlines()
with open(readme_file, 'w') as f:
f.writelines(self.fix_github_links(readme_lines))
setup(
name=NAME,
version=__version__,
author='KIC',
author_email='',
packages=find_packages(),
scripts=[],
url=f'{URL}/{NAME}',
license='MIT',
description=__doc__,
long_description=open('Readme.md').read(),
long_description_content_type='text/markdown',
install_requires=open("requirements.frozen.txt").read().splitlines() + [f"pandas-ml-common=={__version__}"],
extras_require={
"dev": open("dev-requirements.frozen.txt").read().splitlines(),
},
include_package_data=True,
classifiers=[
# Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
],
keywords=['pandas', 'ml', 'util', 'quant'],
cmdclass={
'sdist': SDist
},
)