1
1
# Copyright (C) 2019 Nicolas Legrand
2
+ import codecs
2
3
import os
3
4
5
+ from setuptools import setup
4
6
5
- def read ( fname ):
6
- return open ( os .path .join (os . path . dirname ( __file__ ), fname )). read ( )
7
+ PROJECT_ROOT = os . path . dirname ( os . path . realpath ( __file__ ))
8
+ REQUIREMENTS_FILE = os .path .join (PROJECT_ROOT , "requirements.txt" )
7
9
8
10
9
- DESCRIPTION = "metadpy: Metacognitive efficiency modelling in Python"
10
- LONG_DESCRIPTION = (
11
- "Fitting behavioural and cognitive models of metacognitive efficiency in Python."
12
- )
11
+ def get_requirements ():
12
+ with codecs .open (REQUIREMENTS_FILE ) as buff :
13
+ return buff .read ().splitlines ()
14
+
15
+
16
+ # Get the package's version number of the __init__.py file
17
+ def read (rel_path ):
18
+ """Read the file located at the provided relative path."""
19
+ here = os .path .abspath (os .path .dirname (__file__ ))
20
+ with codecs .open (os .path .join (here , rel_path ), "r" ) as fp :
21
+ return fp .read ()
22
+
23
+
24
+ def get_version (rel_path ):
25
+ """Get the package's version number.
26
+ We fetch the version number from the `__version__` variable located in the
27
+ package root's `__init__.py` file. This way there is only a single source
28
+ of truth for the package's version number.
13
29
30
+ """
31
+ for line in read (rel_path ).splitlines ():
32
+ if line .startswith ("__version__" ):
33
+ delim = '"' if '"' in line else "'"
34
+ return line .split (delim )[1 ]
35
+ else :
36
+ raise RuntimeError ("Unable to find version string." )
37
+
38
+
39
+ DESCRIPTION = "metadpy: Metacognitive efficiency modelling in Python"
14
40
DISTNAME = "metadpy"
15
41
MAINTAINER = "Nicolas Legrand"
16
42
MAINTAINER_EMAIL = "nicolas.legrand@cas.au.dk"
17
43
VERSION = "0.1.1"
18
44
19
- INSTALL_REQUIRES = [
20
- "numpy>=1.18.1" ,
21
- "scipy>=1.3" ,
22
- "pandas>=0.24" ,
23
- "matplotlib>=3.1.3" ,
24
- "seaborn>=0.10.0" ,
25
- "pandas_flavor>=0.1.2" ,
26
- "numba>=0.55.1" ,
27
- ]
28
-
29
45
PACKAGES = ["metadpy" , "metadpy.datasets" ]
30
46
31
- try :
32
- from setuptools import setup
33
-
34
- _has_setuptools = True
35
- except ImportError :
36
- from distutils .core import setup
37
47
38
48
if __name__ == "__main__" :
39
49
@@ -44,10 +54,11 @@ def read(fname):
44
54
maintainer = MAINTAINER ,
45
55
maintainer_email = MAINTAINER_EMAIL ,
46
56
description = DESCRIPTION ,
47
- long_description = LONG_DESCRIPTION ,
57
+ long_description = open ("README.md" , encoding = "utf-8" ).read (),
58
+ long_description_content_type = "text/markdown" ,
48
59
license = "GPL-3.0" ,
49
- version = VERSION ,
50
- install_requires = INSTALL_REQUIRES ,
60
+ version = get_version ( "metadpy/__init__.py" ) ,
61
+ install_requires = get_requirements () ,
51
62
include_package_data = True ,
52
63
packages = PACKAGES ,
53
64
)
0 commit comments