From cb871e56c65f462efa6c3036fe63abe58419e22b Mon Sep 17 00:00:00 2001 From: Elliot Tower Date: Thu, 29 Jun 2023 15:58:07 -0400 Subject: [PATCH] Add pyproject.toml (#416) * Test only pyproject.toml changes * Add print lines and remove setup.cfg as it resulted in errors in CI * Change setup to not install deps, hardcoded version number to test --- docker/Dockerfile | 11 ++++-- pyproject.toml | 88 +++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 45 +++++++++--------------- 3 files changed, 113 insertions(+), 31 deletions(-) create mode 100644 pyproject.toml diff --git a/docker/Dockerfile b/docker/Dockerfile index 80bea6f11..aec999e96 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -49,13 +49,20 @@ ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:$HOME/.mujoco/mujoco210/bin RUN python3 -m venv $HOME/venv -# Copy setup.py first, so that the Docker cache doesn't expire until +# Copy setup.py/config.cfg/pyproject.toml first, so that the Docker cache doesn't expire until # dependencies change COPY --chown=$USER:$USER setup.py $HOME/code/metaworld/setup.py +COPY --chown=$USER:$USER pyproject.toml $HOME/code/metaworld/pyproject.toml + WORKDIR $HOME/code/metaworld +# Testing: list out all files +RUN ls -alh +RUN pwd +RUN ls .. + # Install metaworld dependencies -RUN . $HOME/venv/bin/activate && exec pip install -e .[dev] +RUN . $HOME/venv/bin/activate && exec pip install -e .[testing] # Add code stub last COPY --chown=$USER:$USER . $HOME/code/metaworld diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..7845d3c6f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,88 @@ +# Package ###################################################################### + +[build-system] +requires = ["setuptools >= 61.0.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "metaworld" +description = "Collections of robotics environments geared towards benchmarking multi-task and meta reinforcement learning." +readme = "README.md" +requires-python = ">= 3.8" +authors = [{ name = "Farama Foundation", email = "contact@farama.org" }] +license = { text = "MIT License" } +keywords = ["Reinforcement Learning", "game", "RL", "AI", "gymnasium"] +classifiers = [ + "Development Status :: 4 - Beta", # change to `5 - Production/Stable` when ready + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + 'Intended Audience :: Science/Research', + 'Topic :: Scientific/Engineering :: Artificial Intelligence', +] +dependencies = [ + "gym>=0.15.4", + "mujoco-py<2.2,>=2.0", + "numpy>=1.18", + "scipy>=1.4.1", +] +dynamic = ["version"] + +[project.optional-dependencies] +# Update dependencies in `all` if any are added or removed +testing = [ + "ipdb", + "memory_profiler", + "pylint", # TODO: remove in favor of precommit? + "pyquaternion==0.9.5", + "pytest>=4.4.0", # Required for pytest-xdist + "pytest-xdist", + "pytest-cov", #TODO: test this + "pre-commit", #TODO: test this +] + +[project.urls] +Homepage = "https://farama.org" +Repository = "https://github.com/Farama-Foundation/Metaworld" +Documentation = "https://meta-world.github.io/" +"Bug Report" = "https://github.com/Farama-Foundation/Metaworld/issues" + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.packages.find] +include = ["metaworld", "metaworld.*"] + +# Linters and Test tools ####################################################### + +[tool.black] +safe = true + +[tool.isort] +atomic = true +profile = "black" +src_paths = ["metaworld", "tests"] + +[tool.pyright] +# add any files/directories with type declaration to include +include = [ + "metaworld/", +] +strict = [ +] +verboseOutput = true +typeCheckingMode = "basic" +reportMissingImports = false +# TODO: fix these +reportUnboundVariable = false +reportOptionalMemberAccess = false +reportGeneralTypeIssues = false +reportOptionalSubscript = false + +[tool.pytest.ini_options] +norecursedirs = [ + "metaworld" +] diff --git a/setup.py b/setup.py index f3c013251..0316e759b 100644 --- a/setup.py +++ b/setup.py @@ -1,34 +1,21 @@ -from setuptools import find_packages, setup +"""Sets up the project.""" +# import pathlib -# Required dependencies -required = [ - # Please keep alphabetized - "gym>=0.15.4", - "mujoco-py<2.2,>=2.0", - "numpy>=1.18", - "scipy>=1.4.1", -] +from setuptools import setup +# CWD = pathlib.Path(__file__).absolute().parent +# +# +# def get_version(): +# """Gets the metaworld version.""" +# path = CWD / "metaworld" / "__init__.py" +# content = path.read_text() +# +# for line in content.splitlines(): +# if line.startswith("__version__"): +# return line.strip().split()[-1].strip().strip('"') +# raise RuntimeError("bad version data in __init__.py") -# Development dependencies -extras = dict() -extras["dev"] = [ - # Please keep alphabetized - "ipdb", - "memory_profiler", - "pylint", - "pyquaternion==0.9.5", - "pytest>=4.4.0", # Required for pytest-xdist - "pytest-xdist", -] - -setup( - name="metaworld", - version="0.1.0", - packages=find_packages(), - include_package_data=True, - install_requires=required, - extras_require=extras, -) +setup(name="metaworld", version="2.0.0")