Skip to content

Commit 5461ec8

Browse files
authored
Modernize setup.py
1 parent 9a3ea16 commit 5461ec8

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

setup.py

+13-19
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,38 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3-
import os
3+
import pathlib
44

5+
from pkg_resources import parse_requirements
56
from setuptools import setup, find_packages
67

8+
# Repository root directory for use with reading files
9+
directory = pathlib.Path(__path__).parent
710

8-
# Utility function to read the README file.
9-
# Used for the long_description. It's nice, because now 1) we have a top level
10-
# README file and 2) it's easier to type in the README file than to put a raw
11-
# string in below ...
12-
def read(fname):
13-
return open(os.path.join(os.path.dirname(__file__), fname)).read()
14-
15-
16-
install_requires_replacements = {}
17-
18-
install_requirements = list(set(
19-
install_requires_replacements.get(requirement.strip(), requirement.strip())
20-
for requirement in open('requirements.txt')
21-
if not requirement.lstrip().startswith('#')
22-
))
11+
# Load install_requires from requirements.txt.
12+
# https://stackoverflow.com/a/59971236/4651668
13+
requirements = directory.joinpath('requirements.txt').read_text()
14+
requirements = [str(r) for r in parse_requirements(requirements)]
2315

2416
version = '1.8.1' # Do not edit: this is maintained by bumpversion (see .bumpversion.cfg)
2517

2618
setup(
2719
name='rotkehlchen',
2820
author='Lefteris Karapetsas',
2921
author_email='[email protected]',
30-
description=('Acccounting, asset management and tax report helper for cryptocurrencies'),
22+
description='Acccounting, asset management and tax report helper for cryptocurrencies',
3123
license='BSD-3',
3224
keywords='accounting tax-report portfolio asset-management cryptocurrencies',
3325
url='https://github.com/rotki/rotki',
3426
packages=find_packages('.'),
3527
package_data={
3628
"rotkehlchen": ["data/*.json"],
3729
},
38-
install_requires=install_requirements,
30+
python_requires='>=3.6',
31+
install_requires=requirements,
3932
use_scm_version=True,
4033
setup_requires=['setuptools_scm'],
41-
long_description=read('README.md'),
34+
long_description=directory.joinpath('README.md').read_text(),
35+
long_description_content_type='text/markdown',
4236
classifiers=[
4337
'Development Status :: 1 - Planning',
4438
'Topic :: Utilities',

0 commit comments

Comments
 (0)