From 4877b6fddec253f66f8fe62874ca423a8915a4b6 Mon Sep 17 00:00:00 2001 From: Craig Sanders Date: Tue, 28 Jun 2022 13:11:18 -0700 Subject: [PATCH] make installation and starting the server easier (#62) Summary: Pull Request resolved: https://github.com/facebookresearch/aepsych/pull/62 These changes will allow aepsych to be hosted on pypi and installed from pip; also allows a server to be started with a simple command Reviewed By: mshvartsman Differential Revision: D37176812 fbshipit-source-id: 4d34e9c5bd51918d583fd1608fbdb92d1f8a4832 --- aepsych/server/server.py | 4 ++-- pyproject.toml | 3 +++ setup.py | 51 +++++++++++++++++++++++++++++++++++----- 3 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 pyproject.toml diff --git a/aepsych/server/server.py b/aepsych/server/server.py index 28edf8ebe..f4a3fca87 100644 --- a/aepsych/server/server.py +++ b/aepsych/server/server.py @@ -19,8 +19,8 @@ import pandas as pd import torch from aepsych.config import Config -from aepsych.strategy import SequentialStrategy from aepsych.server.sockets import DummySocket, createSocket +from aepsych.strategy import SequentialStrategy logger = utils_logging.getLogger(logging.INFO) @@ -845,7 +845,7 @@ def start_server(server_class, args): raise RuntimeError(e) -def main(server_class): +def main(server_class=AEPsychServer): args = parse_argument() if args.logs: # overide logger path diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..8fe2f47af --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index beec4964a..5307838fb 100644 --- a/setup.py +++ b/setup.py @@ -5,18 +5,57 @@ # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. -from os import path +import os -from setuptools import setup, find_packages +from setuptools import find_packages, setup -this_directory = path.abspath(path.dirname(__file__)) -with open(path.join(this_directory, "Readme.md"), encoding="utf-8") as f: - long_description = f.read() +root_dir = os.path.dirname(__file__) + +REQUIRES = [ + "matplotlib", + "torch", + "pyzmq==19.0.2", + "scipy", + "sklearn", + "gpytorch>=1.4", + "botorch>=0.6.1", + "SQLAlchemy", + "dill", + "pandas", + "tqdm", + "pathos", +] + +DEV_REQUIRES = [ + "coverage", + "flake8", + "black", + "numpy>=1.20, " "sqlalchemy-stubs", # for mypy stubs + "mypy", + "parameterized", +] + +with open(os.path.join(root_dir, "README.md"), "r") as fh: + long_description = fh.read() setup( name="aepsych", - version="0.1", + version="0.1.0", + python_requires=">=3.8", packages=find_packages(), + description="Adaptive experimetation for psychophysics", long_description=long_description, long_description_content_type="text/markdown", + install_requires=REQUIRES, + entry_points={ + "console_scripts": [ + "aepsych_server = aepsych.server.server:main", + ], + }, +) + +extras_require = ( + { + "dev": DEV_REQUIRES, + }, )