|
1 | 1 | """Augment pandas DataFrame with methods for machine learning"""
|
2 | 2 | __version__ = '0.2.1'
|
3 |
| - |
4 | 3 | import os
|
| 4 | +import re |
| 5 | + |
5 | 6 | from setuptools import setup, find_packages
|
| 7 | +from setuptools.command.sdist import sdist |
| 8 | + |
| 9 | +URL = 'https://github.com/KIC/pandas-ml-quant' |
| 10 | +NAME = 'pandas-ml-utils-torch' |
| 11 | + |
| 12 | + |
| 13 | +class SDist(sdist): |
| 14 | + |
| 15 | + def fix_github_links(self, lines): |
| 16 | + # ist https://github.com/KIC/pandas-ml-quant/pandas-ml-common/tree/0.2.0/./examples/ |
| 17 | + # soll https://github.com/KIC/pandas-ml-quant/tree/0.2.0/pandas-ml-common/./examples/ |
| 18 | + def fix_line(line): |
| 19 | + fixed_images = re.sub(r'(^\[ghi\d+]:\s+)', f'\\1{URL}/raw/{__version__}/{NAME}/', line) |
| 20 | + fixed_location = re.sub(r'(^\[ghl\d+]:\s+)', f'\\1{URL}/tree/{__version__}/{NAME}/', fixed_images) |
| 21 | + fixed_files = re.sub(r'(^\[ghf\d+]:\s+)', f'\\1{URL}/blob/{__version__}/{NAME}/', fixed_location) |
| 22 | + return fixed_files |
| 23 | + |
| 24 | + return [fix_line(line) for line in lines] |
| 25 | + |
| 26 | + def make_release_tree(self, base_dir, files): |
| 27 | + # create the regular distribution files |
| 28 | + super().make_release_tree(base_dir, files) |
| 29 | + |
| 30 | + # but then fix the github links |
| 31 | + readme_file = os.path.join(base_dir, 'Readme.md') |
| 32 | + readme_lines = open(readme_file).readlines() |
| 33 | + |
| 34 | + with open(readme_file, 'w') as f: |
| 35 | + f.writelines(self.fix_github_links(readme_lines)) |
6 | 36 |
|
7 | 37 |
|
8 | 38 | setup(
|
9 |
| - name="pandas-ml-utils-torch", |
10 |
| - version=__version__, |
11 |
| - author='KIC', |
12 |
| - author_email='', |
13 |
| - packages=find_packages(), |
14 |
| - scripts=[], |
15 |
| - url='https://github.com/KIC/pandas-ml-quant', |
16 |
| - license='MIT', |
17 |
| - description=__doc__, |
18 |
| - long_description=open('Readme.md').read(), |
19 |
| - long_description_content_type='text/markdown', |
20 |
| - install_requires=open("requirements.txt").read().splitlines() + [f"pandas-ml-common=={__version__}", f"pandas-ml-utils=={__version__}"], |
21 |
| - extras_require={ |
22 |
| - "dev": open("dev-requirements.txt").read().splitlines(), |
23 |
| - }, |
24 |
| - include_package_data=True, |
25 |
| - classifiers=[ |
26 |
| - # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package |
27 |
| - 'Development Status :: 3 - Alpha', |
28 |
| - 'Intended Audience :: Developers', |
29 |
| - 'Topic :: Software Development :: Build Tools', |
30 |
| - 'License :: OSI Approved :: MIT License', |
31 |
| - 'Programming Language :: Python :: 3', |
32 |
| - 'Programming Language :: Python :: 3.7', |
33 |
| - ], |
34 |
| - keywords=['pandas', 'ml', 'util', 'quant'], |
| 39 | + name=NAME, |
| 40 | + version=__version__, |
| 41 | + author='KIC', |
| 42 | + author_email='', |
| 43 | + packages=find_packages(), |
| 44 | + scripts=[], |
| 45 | + url=f'{URL}/{NAME}', |
| 46 | + license='MIT', |
| 47 | + description=__doc__, |
| 48 | + long_description=open('Readme.md').read(), |
| 49 | + long_description_content_type='text/markdown', |
| 50 | + install_requires=open("requirements.txt").read().splitlines() + [f"pandas-ml-common=={__version__}", f"pandas-ml-utils=={__version__}"], |
| 51 | + extras_require={ |
| 52 | + "dev": open("dev-requirements.txt").read().splitlines(), |
| 53 | + }, |
| 54 | + include_package_data=True, |
| 55 | + classifiers=[ |
| 56 | + # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package |
| 57 | + 'Development Status :: 3 - Alpha', |
| 58 | + 'Intended Audience :: Developers', |
| 59 | + 'Topic :: Software Development :: Build Tools', |
| 60 | + 'License :: OSI Approved :: MIT License', |
| 61 | + 'Programming Language :: Python :: 3', |
| 62 | + 'Programming Language :: Python :: 3.8', |
| 63 | + ], |
| 64 | + keywords=['pandas', 'ml', 'util', 'quant'], |
| 65 | + cmdclass={ |
| 66 | + 'sdist': SDist |
| 67 | + }, |
35 | 68 | )
|
0 commit comments