Tianshou/pyproject.toml
Michael Panchenko 33d241a29b
Docs/html doc issues (#1048)
Closes #1005 

## Main changes

2. Load vega-embed things using jupyter-book config 
3. Add vega-embed dependencies as part of local code for offline
development
4. Reduced duplication in benchmark.js
5. Update sphinx, docutils, and jupyter-book

Co-authored-by: carlocagnetta <c.cagnetta@appliedai.de>
2024-02-09 19:43:10 +01:00

226 lines
7.8 KiB
TOML

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "tianshou"
version = "0.5.1"
description = "A Library for Deep Reinforcement Learning"
authors = ["TSAIL <trinkle23897@gmail.com>"]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/thu-ml/tianshou"
classifiers = [
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
exclude = ["test/*", "examples/*", "docs/*"]
[tool.poetry.dependencies]
python = "^3.11"
gymnasium = "^0.28.0"
h5py = "^3.9.0"
numba = "^0.57.1"
numpy = "^1"
overrides = "^7.4.0"
packaging = "*"
pettingzoo = "^1.22"
tensorboard = "^2.5.0"
# Torch 2.0.1 causes problems, see https://github.com/pytorch/pytorch/issues/100974
torch = "^2.0.0, !=2.0.1, !=2.1.0"
tqdm = "*"
virtualenv = [
# special sauce b/c of a flaky bug in poetry on windows
# see https://github.com/python-poetry/poetry/issues/7611#issuecomment-1466478926
{ version = "^20.4.3,!=20.4.5,!=20.4.6" },
{ version = "<20.16.4", markers = "sys_platform == 'win32'" },
]
# Atari, box2d, classic-control, and mujoco environments are all optional dependencies of gymnasium.
# Unfortunately, we cannot have extras relying on (multiple) optionals of other packages due to a poetry issue (see e.g.
# https://github.com/python-poetry/poetry/issues/7911) and therefore have to maintain our own list of dependencies.
# This requires attention and monitoring of gymnasium's dependencies and their version numbers!
ale-py = { version = "~=0.8.1", optional = true }
autorom = { version = "~=0.4.2", extras = ["accept-rom-license"], optional = true }
box2d_py = { version = "2.3.5", optional = true }
cython = { version = ">=0.27.2", optional = true }
docstring-parser = { version = "^0.15", optional = true }
envpool = { version = "^0.8.2", optional = true, markers = "sys_platform != 'darwin'"}
gymnasium-robotics = { version = "*", optional = true }
imageio = { version = ">=2.14.1", optional = true }
jsonargparse = {version = "^4.24.1", optional = true}
mujoco = { version = ">=2.1.5", optional = true }
mujoco-py = { version = ">=2.1,<2.2", optional = true }
opencv_python = { version = "*", optional = true }
pybullet = { version = "*", optional = true }
pygame = { version = ">=2.1.3", optional = true }
shimmy = { version = ">=0.1.0,<1.0", optional = true }
swig = { version = "4.*", optional = true }
vizdoom = { version = "*", optional = true }
[tool.poetry.extras]
argparse = ["docstring-parser", "jsonargparse"]
atari = ["ale-py", "autorom", "opencv-python", "shimmy"]
box2d = ["box2d-py", "pygame", "swig"]
classic_control = ["pygame"]
mujoco = ["mujoco", "imageio"]
mujoco_py = ["mujoco-py", "cython"]
pybullet = ["pybullet"]
envpool = ["envpool"]
robotics = ["gymnasium-robotics"]
vizdoom = ["vizdoom"]
[tool.poetry.group.dev]
optional = true
[tool.poetry.group.dev.dependencies]
black = { version = "^23.7.0", extras = ["jupyter"] }
docutils = "0.20.1"
jinja2 = "*"
jupyter = "^1.0.0"
jupyter-book = "^1.0.0"
mypy = "^1.4.1"
nbqa = "^1.7.1"
nbstripout = "^0.6.1"
# networkx is used in a test
networkx = "*"
poethepoet = "^0.20.0"
pre-commit = "^3.3.3"
pygame = "^2.1.0"
pymunk = "^6.2.1"
pytest = "*"
pytest-cov = "*"
# Ray currently causes issues when installed on windows server 2022 in CI
# If users want to use ray, they should install it manually.
ray = { version = "^2", markers = "sys_platform != 'win32'" }
ruff = "^0.0.285"
scipy = "*"
sphinx = "^7"
sphinx-book-theme = "^1.0.1"
sphinx-comments = "^0.0.3"
sphinx-copybutton = "^0.5.2"
sphinx-jupyterbook-latex = "^1.0.0"
sphinx-togglebutton = "^0.3.2"
sphinx-toolbox = "^3.5.0"
sphinxcontrib-bibtex = "*"
sphinxcontrib-spelling = "^8.0.0"
wandb = "^0.12.0"
[tool.mypy]
allow_redefinition = true
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
ignore_missing_imports = true
no_implicit_optional = true
pretty = true
show_error_codes = true
show_error_context = true
show_traceback = true
strict_equality = true
strict_optional = true
warn_no_return = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true
exclude = "^build/|^docs/"
[tool.doc8]
max-line-length = 1000
[tool.black]
line-length = 100
target-version = ["py311"]
[tool.nbqa.exclude]
ruff = ".jupyter_cache"
mypy = ".jupyter_cache"
[tool.ruff]
select = [
"ASYNC", "B", "C4", "C90", "COM", "D", "DTZ", "E", "F", "FLY", "G", "I", "ISC", "PIE", "PLC", "PLE", "PLW", "RET", "RUF", "RSE", "SIM", "TID", "UP", "W", "YTT",
]
ignore = [
"SIM118", # Needed b/c iter(batch) != iter(batch.keys()). See https://github.com/thu-ml/tianshou/issues/922
"E501", # line too long. black does a good enough job
"E741", # variable names like "l". this isn't a huge problem
"B008", # do not perform function calls in argument defaults. we do this sometimes
"B011", # assert false. we don't use python -O
"B028", # we don't need explicit stacklevel for warnings
"D100", "D101", "D102", "D104", "D105", "D107", "D203", "D213", "D401", "D402", # docstring stuff
"DTZ005", # we don't need that
# remaining rules from https://github.com/psf/black/blob/main/.flake8 (except W503)
# this is a simplified version of config, making vscode plugin happy
"E402", "E501", "E701", "E731", "C408", "E203",
# Logging statement uses f-string warning
"G004",
# Unnecessary `elif` after `return` statement
"RET505",
"D106", # undocumented public nested class
"D205", # blank line after summary (prevents summary-only docstrings, which makes no sense)
]
unfixable = [
"F841", # unused variable. ruff keeps the call, but mostly we want to get rid of it all
"F601", # automatic fix might obscure issue
"F602", # automatic fix might obscure issue
"B018", # automatic fix might obscure issue
]
extend-fixable = [
"F401", # unused import
"B905", # bugbear
]
target-version = "py311"
[tool.ruff.mccabe]
max-complexity = 20
[tool.ruff.per-file-ignores]
"test/**" = ["D103"]
"docs/**" = ["D103"]
"examples/**" = ["D103"]
[tool.poetry_bumpversion.file."tianshou/__init__.py"]
[tool.poetry-sort]
move-optionals-to-bottom = true
[tool.poe.env]
PYDEVD_DISABLE_FILE_VALIDATION="1"
# keep relevant parts in sync with pre-commit
[tool.poe.tasks] # https://github.com/nat-n/poethepoet
test = "pytest test --cov=tianshou --cov-report=xml --cov-report=term-missing --durations=0 -v --color=yes"
test-reduced = "pytest test/base test/continuous --cov=tianshou --durations=0 -v --color=yes"
_black_check = "black --check ."
_ruff_check = "ruff check ."
_ruff_check_nb = "nbqa ruff ."
_black_format = "black ."
_ruff_format = "ruff --fix ."
_ruff_format_nb = "nbqa ruff --fix ."
lint = ["_black_check", "_ruff_check", "_ruff_check_nb"]
_poetry_install_sort_plugin = "poetry self add poetry-plugin-sort"
_poetry_sort = "poetry sort"
clean-nbs = "python docs/nbstripout.py"
format = ["_black_format", "_ruff_format", "_ruff_format_nb", "_poetry_install_sort_plugin", "_poetry_sort"]
_autogen_rst = "python docs/autogen_rst.py"
_sphinx_build = "sphinx-build -W -b html docs docs/_build"
_jb_generate_toc = "python docs/create_toc.py"
_jb_generate_config = "jupyter-book config sphinx docs/"
doc-clean = "rm -rf docs/_build"
doc-generate-files = ["_autogen_rst", "_jb_generate_toc", "_jb_generate_config"]
doc-spellcheck = "sphinx-build -W -b spelling docs docs/_build"
doc-build = ["doc-generate-files", "doc-spellcheck", "_sphinx_build"]
_mypy = "mypy tianshou"
_mypy_nb = "nbqa mypy ."
type-check = ["_mypy", "_mypy_nb"]