Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,87 @@
[project]
name = "nle"
description = "The NetHack Learning Environment (NLE): a reinforcement learning environment based on NetHack"
readme = "README.md"
authors = [ { name = "The NLE Dev Team" } ]
requires-python = ">=3.10"
dynamic = ["classifiers", "version"]
dependencies = [
"pybind11>=2.2",
"numpy>=1.16",
"gymnasium==1.2.0"
]

[project.license]
file = "LICENSE"

[project.urls]
Homepage = "https://github.com/NetHack-LE/nle"

[build-system]
requires = ["setuptools", "pybind11>=2.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages]
find = { include = [
"nle",
"nle.dataset",
"nle.env",
"nle.nethack",
"nle.agent",
"nle.scripts",
"nle.tests"
]}

[project.scripts]
nle-play = "nle.scripts.play:main"
nle-ttyrec = "nle.scripts.ttyrec:main"
nle-ttyplay = "nle.scripts.ttyplay:main"
nle-ttyplay2 = "nle.scripts.ttyplay2:main"
nle-read-tty = "nle.scripts.read_tty:main"

[dependency-groups]
dev = [
"pre-commit>=2.0.1",
"isort>=5.13.2",
"cmake_format>=0.6.10",
"memory-profiler>=0.60.0",
"pytest>=6.2.5",
"pytest-benchmark>=3.4.1",
"sphinx>=2.4.4",
"sphinx-rtd-theme>=0.4.3",
"setuptools>=69.5.1",
"ruff>=0.4.3",
]

[project.optional-dependencies]
agent = [
"torch>=1.3.1"
]
dev = [
"pre-commit>=2.0.1",
"isort>=5.13.2",
"cmake_format>=0.6.10",
"memory-profiler>=0.60.0",
"pytest>=6.2.5",
"pytest-benchmark>=3.4.1",
"sphinx>=2.4.4",
"sphinx-rtd-theme>=0.4.3",
"setuptools>=69.5.1",
"ruff>=0.4.3"
]
all = [
"pre-commit>=2.0.1",
"isort>=5.13.2",
"cmake_format>=0.6.10",
"memory-profiler>=0.60.0",
"pytest>=6.2.5",
"pytest-benchmark>=3.4.1",
"sphinx>=2.4.4",
"sphinx-rtd-theme>=0.4.3",
"setuptools>=69.5.1",
"ruff>=0.4.3",
"torch>=1.3.1"
]
[tool.black]
line-length = 88
target-version = ['py38']
Expand Down Expand Up @@ -68,3 +152,6 @@ manylinux-aarch64-image = "manylinux2014"
[tool.cibuildwheel.macos]
# For macOS wheels, we only need to install cmake
before-all = "rm -rf {project}/build {project}/*.so {project}/CMakeCache.txt && brew install cmake"

[tool.pytest.ini_options]
testpaths = ["nle/tests"]
64 changes: 1 addition & 63 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#
# List of environment variables used:
#
# NLE_PACKAGE_NAME
# Prefix of the generated package (defaults to "nle").
#
# NLE_BUILD_RELEASE
# If set, builds wheel (s)dist such as to prepare it for upload to PyPI.
#
Expand Down Expand Up @@ -71,48 +68,7 @@ def build_extension(self, ext):
sys.exit(1)


packages = [
"nle",
"nle.dataset",
"nle.env",
"nle.nethack",
"nle.agent",
"nle.scripts",
"nle.tests",
]

entry_points = {
"console_scripts": [
"nle-play = nle.scripts.play:main",
"nle-ttyrec = nle.scripts.ttyrec:main",
"nle-ttyplay = nle.scripts.ttyplay:main",
"nle-ttyplay2 = nle.scripts.ttyplay2:main",
"nle-read-tty = nle.scripts.read_tty:main",
]
}


extras_deps = {
"dev": [
"pre-commit>=2.0.1",
"isort>=5.13.2",
"cmake_format>=0.6.10",
"memory-profiler>=0.60.0",
"pytest>=6.2.5",
"pytest-benchmark>=3.4.1",
"sphinx>=2.4.4",
"sphinx-rtd-theme>=0.4.3",
"setuptools>=69.5.1",
"ruff>=0.4.3",
],
"agent": ["torch>=1.3.1"],
}

extras_deps["all"] = [item for group in extras_deps.values() for item in group]


if __name__ == "__main__":
package_name = os.getenv("NLE_PACKAGE_NAME", "nle")
cwd = os.path.dirname(os.path.abspath(__file__))
version = open("version.txt", "r").read().strip()
sha = "Unknown"
Expand All @@ -128,36 +84,18 @@ def build_extension(self, ext):

if sha != "Unknown" and not os.getenv("NLE_RELEASE_BUILD"):
version += "+" + sha[:7]
package_name = setuptools.find_packages()[0]
print("Building wheel {}-{}".format(package_name, version))

version_path = os.path.join(cwd, "nle", "version.py")
with open(version_path, "w") as f:
f.write("__version__ = '{}'\n".format(version))
f.write("git_version = {}\n".format(repr(sha)))

with open("README.md") as f:
long_description = f.read()

setuptools.setup(
name=package_name,
version=version,
description=(
"The NetHack Learning Environment (NLE): "
"a reinforcement learning environment based on NetHack"
),
long_description=long_description,
long_description_content_type="text/markdown",
author="The NLE Dev Team",
url="https://github.com/NetHack-LE/nle",
license="NetHack General Public License",
entry_points=entry_points,
packages=packages,
ext_modules=[setuptools.Extension("nle", sources=[])],
cmdclass={"build_ext": CMakeBuild},
setup_requires=["pybind11>=2.2"],
install_requires=["pybind11>=2.2", "numpy>=1.16", "gymnasium==1.2.0"],
extras_require=extras_deps,
python_requires=">=3.10",
classifiers=[
"License :: OSI Approved :: Nethack General Public License",
"Development Status :: 5 - Production/Stable",
Expand Down
Loading
Loading