-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
automated packaging in setup.py (#10)
- Loading branch information
1 parent
eadf426
commit eeea3df
Showing
2 changed files
with
37 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,49 @@ | ||
# Copyright (C) 2019 Nicolas Legrand | ||
import codecs | ||
import os | ||
|
||
from setuptools import setup | ||
|
||
def read(fname): | ||
return open(os.path.join(os.path.dirname(__file__), fname)).read() | ||
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) | ||
REQUIREMENTS_FILE = os.path.join(PROJECT_ROOT, "requirements.txt") | ||
|
||
|
||
DESCRIPTION = "metadpy: Metacognitive efficiency modelling in Python" | ||
LONG_DESCRIPTION = ( | ||
"Fitting behavioural and cognitive models of metacognitive efficiency in Python." | ||
) | ||
def get_requirements(): | ||
with codecs.open(REQUIREMENTS_FILE) as buff: | ||
return buff.read().splitlines() | ||
|
||
|
||
# Get the package's version number of the __init__.py file | ||
def read(rel_path): | ||
"""Read the file located at the provided relative path.""" | ||
here = os.path.abspath(os.path.dirname(__file__)) | ||
with codecs.open(os.path.join(here, rel_path), "r") as fp: | ||
return fp.read() | ||
|
||
|
||
def get_version(rel_path): | ||
"""Get the package's version number. | ||
We fetch the version number from the `__version__` variable located in the | ||
package root's `__init__.py` file. This way there is only a single source | ||
of truth for the package's version number. | ||
""" | ||
for line in read(rel_path).splitlines(): | ||
if line.startswith("__version__"): | ||
delim = '"' if '"' in line else "'" | ||
return line.split(delim)[1] | ||
else: | ||
raise RuntimeError("Unable to find version string.") | ||
|
||
|
||
DESCRIPTION = "metadpy: Metacognitive efficiency modelling in Python" | ||
DISTNAME = "metadpy" | ||
MAINTAINER = "Nicolas Legrand" | ||
MAINTAINER_EMAIL = "[email protected]" | ||
VERSION = "0.1.1" | ||
|
||
INSTALL_REQUIRES = [ | ||
"numpy>=1.18.1", | ||
"scipy>=1.3", | ||
"pandas>=0.24", | ||
"matplotlib>=3.1.3", | ||
"seaborn>=0.10.0", | ||
"pandas_flavor>=0.1.2", | ||
"numba>=0.55.1", | ||
] | ||
|
||
PACKAGES = ["metadpy", "metadpy.datasets"] | ||
|
||
try: | ||
from setuptools import setup | ||
|
||
_has_setuptools = True | ||
except ImportError: | ||
from distutils.core import setup | ||
|
||
if __name__ == "__main__": | ||
|
||
|
@@ -44,10 +54,11 @@ def read(fname): | |
maintainer=MAINTAINER, | ||
maintainer_email=MAINTAINER_EMAIL, | ||
description=DESCRIPTION, | ||
long_description=LONG_DESCRIPTION, | ||
long_description=open("README.md", encoding="utf-8").read(), | ||
long_description_content_type="text/markdown", | ||
license="GPL-3.0", | ||
version=VERSION, | ||
install_requires=INSTALL_REQUIRES, | ||
version=get_version("metadpy/__init__.py"), | ||
install_requires=get_requirements(), | ||
include_package_data=True, | ||
packages=PACKAGES, | ||
) |