Files
cs249r_book/pyproject.toml
Vijay Janapa Reddi 29cefb9a6f fix: centralize path configuration for book/ restructure
- Add BOOK_ROOT, QUARTO_DIR, TOOLS_DIR, DEPS_DIR, DOCKER_DIR env vars to all workflows
- Update path references to use centralized env vars
- Fix requirements.txt to reference book/tools/dependencies
- Fix pyproject.toml entry points: cli.main -> book.cli.main
- Add __init__.py to book/ and book/tools/ for Python package support
- Fix Dockerfile path casing (dockerfile -> Dockerfile)
- Fix publish-live.yml relative path after cd

This enables TinyTorch to coexist at repo root alongside book/ directory.
2025-12-05 15:14:01 -08:00

268 lines
6.1 KiB
TOML

[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "mlsysbook"
version = "1.0.0"
description = "Machine Learning Systems Textbook - Tools and Scripts"
readme = "README.md"
requires-python = ">=3.9"
license = {text = "MIT"}
authors = [
{name = "MLSysBook Contributors", email = "info@mlsysbook.ai"}
]
keywords = ["machine-learning", "systems", "textbook", "education", "ai"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Education",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Documentation",
"Topic :: Text Processing :: Markup",
]
dependencies = [
# Core dependencies for Quarto/Jupyter integration
"jupyterlab-quarto>=0.3.0",
"jupyter>=1.0.0",
# Bibliography and document processing
"pybtex>=0.24.0",
"pypandoc>=1.11",
"pyyaml>=6.0",
# Data processing and validation
"pandas>=2.0.0",
"numpy>=1.24.0",
"jsonschema>=4.0.0",
# Image processing
"Pillow>=9.0.0",
# HTTP and API interactions
"requests>=2.31.0",
# Text processing
"titlecase>=2.4.1",
# Terminal output and UI
"rich>=13.0.0",
# Type checking and validation
"typing-extensions>=4.5.0",
# Utilities
"click>=8.0.0",
"pathlib2>=2.3.0; python_version<'3.11'",
]
[project.optional-dependencies]
dev = [
# Testing
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"pytest-mock>=3.10.0",
"pytest-asyncio>=0.21.0",
# Code quality
"black>=23.0.0",
"isort>=5.12.0",
"flake8>=6.0.0",
"mypy>=1.0.0",
"pylint>=2.17.0",
# Security
"bandit>=1.7.0",
"safety>=2.3.0",
# Documentation
"sphinx>=6.0.0",
"sphinx-rtd-theme>=1.2.0",
# Pre-commit hooks
"pre-commit>=3.0.0",
]
ai = [
# AI/ML specific dependencies
"openai>=1.0.0",
"sentence-transformers>=2.2.0",
"transformers>=4.21.0",
"torch>=1.12.0",
"scikit-learn>=1.3.0",
"gradio>=3.40.0",
"ollama>=0.1.0",
]
build = [
# Build and publishing tools
"twine>=4.0.0",
"build>=0.10.0",
"setuptools>=61.0",
"wheel>=0.40.0",
]
[project.urls]
Homepage = "https://mlsysbook.ai"
Documentation = "https://docs.mlsysbook.ai"
Repository = "https://github.com/mlsysbook/mlsysbook"
Issues = "https://github.com/mlsysbook/mlsysbook/issues"
Changelog = "https://github.com/mlsysbook/mlsysbook/blob/main/CHANGELOG.md"
[project.scripts]
binder = "book.cli.main:main"
mlsysbook = "book.cli.main:main"
[tool.setuptools.packages.find]
where = ["."]
include = ["book*", "book.tools*", "book.cli*"]
exclude = ["tests*", "docs*"]
[tool.setuptools.package-data]
"book.tools.scripts" = ["**/*.yaml", "**/*.yml", "**/*.json", "**/*.txt", "**/*.md"]
# Black formatting configuration
[tool.black]
line-length = 100
target-version = ['py39', 'py310', 'py311', 'py312']
include = '\.pyi?$'
extend-exclude = '''
/(
# Exclude build artifacts
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
# Exclude generated files
| contents/
| quarto/
)/
'''
# isort import sorting configuration
[tool.isort]
profile = "black"
line_length = 100
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
src_paths = ["book/tools"]
skip_glob = ["book/quarto/contents/*", "book/quarto/*"]
# MyPy type checking configuration
[tool.mypy]
python_version = "3.9"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_equality = true
show_error_codes = true
[[tool.mypy.overrides]]
module = [
"pypandoc.*",
"pybtex.*",
"titlecase.*",
"gradio.*",
"ollama.*",
]
ignore_missing_imports = true
# Pytest configuration
[tool.pytest.ini_options]
minversion = "7.0"
addopts = [
"--strict-markers",
"--strict-config",
"--cov=book/tools",
"--cov-report=term-missing",
"--cov-report=html",
"--cov-fail-under=80"
]
testpaths = ["tests", "book/tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"unit: marks tests as unit tests",
"ai: marks tests that require AI models",
]
# Coverage configuration
[tool.coverage.run]
source = ["book/tools"]
branch = true
omit = [
"*/tests/*",
"*/test_*",
"*/__pycache__/*",
"*/.*",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]
# Pylint configuration
[tool.pylint.messages_control]
disable = [
"C0330", # Wrong hanging indentation before block (conflicts with black)
"C0326", # Bad whitespace (conflicts with black)
"R0903", # Too few public methods (sometimes OK for data classes)
"R0913", # Too many arguments (sometimes necessary)
]
[tool.pylint.format]
max-line-length = "100"
[tool.pylint.design]
max-args = 8
max-locals = 20
max-branches = 15
max-statements = 60
# Bandit security linting
[tool.bandit]
exclude_dirs = ["tests", "book/quarto/contents", "book/quarto"]
skips = ["B101", "B601"] # Skip assert_used and shell=True (sometimes needed)
# Flake8 configuration (in setup.cfg or .flake8 file)
# Note: flake8 doesn't support pyproject.toml yet