ether0-inference / pyproject.toml
jonahkall's picture
Upload 51 files
4c346eb verified
[build-system]
build-backend = "setuptools.build_meta"
# SEE: https://github.com/pypa/setuptools_scm#pyprojecttoml-usage
requires = ["setuptools>=64", "setuptools_scm>=8"]
[dependency-groups]
dev = ["ether0.remotes[dev]", "ether0[dev]"]
[project]
authors = [
{email = "[email protected]", name = "FutureHouse technical staff"},
]
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Chemistry",
]
dependencies = [
"accelerate>=1.10.1",
"datasets",
"exmol>=3.3.0", # to get fixed functional group names and py.typed
"gradio>=5.44.0",
"httpx",
"huggingface-hub",
"molbloom==2.3.4", # exact pin to be compatible with rings.bloom
"pydantic>=2", # Pin to keep recent
"rdkit",
"regex", # For unicode property \p
"spaces>=0.40.1",
"tenacity",
]
description = "Data models, rewards, and utility functions for ether0."
dynamic = [
"version", # Required for setuptools_scm
]
license = {file = "LICENSE"}
name = "ether0"
readme = "README.md"
requires-python = ">=3.11"
[project.optional-dependencies]
add-tokens = [
"ipykernel", # For Jupyter notebook support
"ipywidgets>=8", # For Jupyter notebook support, and pin to keep recent
"transformers>=4.49", # Pin to keep recent
]
baselines = [
"fhaviary>=0.19", # Pin for Python 3.13 compatibility
"fhlmi>=0.26", # Pin for Python 3.13 compatibility
"ipython",
]
dev = [
"ether0[add-tokens,typing]",
"huggingface-hub[cli]", # For login inside of CI
"ipython>=8", # Pin to keep recent
"mypy>=1.8", # For addition of mutable-override
"pre-commit>=3.4", # Pin to keep recent
"pylint>=3", # Pin to keep recent
"pytest",
"pytest-subtests",
"pytest-sugar",
"pytest-timer[colorama]",
"pytest-xdist",
"refurb>=2", # Pin to keep recent
"typeguard",
]
typing = [
"types-regex",
]
[project.urls]
issues = "https://github.com/Future-House/ether0/issues"
repository = "https://github.com/Future-House/ether0"
[tool.black]
enable-unstable-feature = [
"hug_parens_with_braces_and_square_brackets", # TODO: remove after https://github.com/psf/black/issues/4036 resolution
]
preview = true
[tool.codespell]
check-filenames = true
check-hidden = true
ignore-words-list = "amination,astroid,ser"
[tool.coverage]
[tool.coverage.report]
exclude_also = [
"@overload", # SEE: https://github.com/nedbat/coveragepy/issues/970
"if TYPE_CHECKING:",
]
# Number of digits after the decimal point to display for reported coverage percentages
precision = 2
[tool.coverage.run]
# Measure branch coverage
branch = true
# This will be used if you run `coverage run` with no further arguments
# This is designed to be invoked from within the test directory
command_line = "-m pytest"
[tool.markdownlint]
no-inline-html = false
[tool.markdownlint.line-length]
code_block_line_length = 88 # Match ruff line-length
line_length = 120 # Match ruff max-doc-length
stern = true
tables = false
[tool.mypy]
# Type-checks the interior of functions without type annotations.
check_untyped_defs = true
# Allows enabling one or multiple error codes globally. Note: This option will
# override disabled error codes from the disable_error_code option.
enable_error_code = [
"ignore-without-code",
"mutable-override",
"redundant-cast",
"redundant-expr",
"redundant-self",
"truthy-bool",
"truthy-iterable",
"unimported-reveal",
"unreachable",
"unused-awaitable",
"unused-ignore",
]
# Shows a short summary line after error messages.
error_summary = false
# A regular expression that matches file names, directory names and paths which mypy
# should ignore while recursively discovering files to check. Use forward slashes (/) as
# directory separators on all platforms.
exclude = [
"^\\.?venv", # SEE: https://regex101.com/r/0rp5Br/1
]
# This flag tells mypy that top-level packages will be based in either the current
# directory, or a member of the MYPYPATH environment variable or mypy_path config
# option. This option is only useful in the absence of __init__.py. See Mapping file
# paths to modules for details.
explicit_package_bases = true
# Specifies the paths to use, after trying the paths from MYPYPATH environment variable.
# Useful if you'd like to keep stubs in your repo, along with the config file.
# Multiple paths are always separated with a : or , regardless of the platform.
# User home directory and environment variables will be expanded.
mypy_path = "$MYPY_CONFIG_FILE_DIR/src,$MYPY_CONFIG_FILE_DIR/packages/remotes/src"
# Comma-separated list of mypy plugins.
plugins = ["pydantic.mypy"]
# Use visually nicer output in error messages: use soft word wrap, show source
# code snippets, and show error location markers.
pretty = true
# Shows column numbers in error messages.
show_column_numbers = true
# Shows error codes in error messages.
# SEE: https://mypy.readthedocs.io/en/stable/error_codes.html#error-codes
show_error_codes = true
# Prefixes each error with the relevant context.
show_error_context = true
# Warns about casting an expression to its inferred type.
warn_redundant_casts = true
# Shows a warning when encountering any code inferred to be unreachable or
# redundant after performing type analysis.
warn_unreachable = true
# Warns about per-module sections in the config file that do not match any
# files processed when invoking mypy.
warn_unused_configs = true
# Warns about unneeded `# type: ignore` comments.
warn_unused_ignores = true
[[tool.mypy.overrides]]
# Suppresses error messages about imports that cannot be resolved.
ignore_missing_imports = true
# Per-module configuration options
module = [
"datasets.*", # SEE: https://github.com/huggingface/datasets/issues/3841
"huggingface_hub.*", # SEE: https://github.com/huggingface/huggingface_hub/issues/1662
"molbloom", # SEE: https://github.com/whitead/molbloom/issues/29
"molsol", # SEE: https://github.com/maykcaldas/molsol/issues/6
"onmt.*",
"setuptools_scm", # SEE: https://github.com/pypa/setuptools_scm/issues/501
"transformers.*", # SEE: https://github.com/huggingface/transformers/pull/18485
]
[tool.pylint]
[tool.pylint.design]
# Maximum number of attributes for a class (see R0902).
max-attributes = 12
[tool.pylint.format]
# Maximum number of characters on a single line.
max-line-length = 97 # Match ruff line-length
[tool.pylint.main]
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use, and will cap the count on Windows to
# avoid hangs.
jobs = 0
[tool.pylint.messages_control]
# Disable the message, report, category or checker with the given id(s).
disable = [
"bare-except", # Rely on ruff E722 for this
"broad-exception-caught", # Rely on ruff BLE001 for this
"broad-exception-raised", # Rely on ruff TRY002 for this
"dangerous-default-value", # Rely on ruff W0102 for this
"empty-docstring", # Let pep257 take care of docstrings
"expression-not-assigned", # Rely on mypy func-returns-value for this
"fixme", # codetags are useful
"function-redefined", # Rely on mypy no-redef for this
"global-statement", # Rely on ruff PLW0603 for this
"global-variable-not-assigned", # Rely on ruff PLW0602 for this
"import-outside-toplevel", # Rely on ruff PLC0415 for this
"keyword-arg-before-vararg", # Rely on ruff B026 for this
"line-too-long", # Rely on ruff E501 for this
"logging-fstring-interpolation", # f-strings are convenient
"logging-too-many-args", # Rely on ruff PLE1205 for this
"missing-docstring", # Let docformatter and ruff take care of docstrings
"missing-final-newline", # Rely on ruff W292 for this
"no-else-return", # Rely on ruff RET506 for this
"no-member", # Buggy, SEE: https://github.com/pylint-dev/pylint/issues/8138
"no-value-for-parameter", # Rely on mypy call-arg for this
"protected-access", # Don't care to enforce this in testing
"raise-missing-from", # Rely on ruff B904 for this
"redefined-builtin", # Rely on ruff A002 for this
"too-few-public-methods", # Don't care to enforce this
"too-many-arguments", # Don't care to enforce this
"too-many-boolean-expressions", # Rely on ruff PLR0916 for this
"too-many-branches", # Rely on ruff PLR0912 for this
"too-many-locals", # Rely on ruff PLR0914 for this
"too-many-positional-arguments", # Rely on ruff PLR0917 for this
"too-many-public-methods", # Rely on ruff PLR0904 for this
"too-many-return-statements", # Rely on ruff PLR0911 for this
"too-many-statements", # Rely on ruff PLR0915 for this
"ungrouped-imports", # Rely on ruff I001 for this
"unidiomatic-typecheck", # Rely on ruff E721 for this
"unnecessary-dict-index-lookup", # Rely on ruff PLR1733 for this
"unreachable", # Rely on mypy unreachable for this
"unspecified-encoding", # Rely on ruff PLW1514 for this
"unsubscriptable-object", # Buggy, SEE: https://github.com/pylint-dev/pylint/issues/3637
"unsupported-membership-test", # Buggy, SEE: https://github.com/pylint-dev/pylint/issues/3045
"unused-argument", # Rely on ruff ARG002 for this
"unused-import", # Rely on ruff F401 for this
"unused-variable", # Rely on ruff F841 for this
"unused-wildcard-import", # Wildcard imports are convenient
"use-sequence-for-iteration", # Rely on ruff C0208 for this
"wildcard-import", # Wildcard imports are convenient
"wrong-import-order", # Rely on ruff I001 for this
"wrong-import-position", # Rely on ruff E402 for this
]
# Enable the message, report, category or checker with the given id(s).
enable = [
"useless-suppression", # Print unused `pylint: disable` comments
]
[tool.pylint.reports]
# Set true to activate the evaluation score.
score = false
[tool.pylint.similarities]
# Minimum lines number of a similarity.
min-similarity-lines = 10
[tool.pytest.ini_options]
# Add the specified `OPTS` to the set of command line arguments as if they had
# been specified by the user.
addopts = "--typeguard-packages=ether0 --doctest-modules"
# List of directories that should be searched for tests when no specific directories,
# files or test ids are given in the command line when executing pytest from the rootdir
# directory. File system paths may use shell-style wildcards, including the recursive **
# pattern.
testpaths = ["packages/remotes", "src", "tests"]
[tool.refurb]
enable_all = true
ignore = [
"FURB101", # Rely on ruff FURB101 for this
"FURB103", # Rely on ruff FURB103 for this
"FURB141", # Rely on ruff PTH110 for this
"FURB144", # Rely on ruff PTH107 for this
"FURB146", # Rely on ruff PTH113 for this
"FURB147", # Rely on ruff PTH118 for this
"FURB150", # Rely on ruff PTH102 for this
"FURB155", # Rely on ruff PTH202 for this
]
[tool.ruff]
# Line length to use when enforcing long-lines violations (like `E501`).
line-length = 97 # ceil(1.1 * 88) makes `E501` equivalent to `B950`
# Enable application of unsafe fixes.
unsafe-fixes = true
[tool.ruff.format]
# Enable reformatting of code snippets in docstrings.
docstring-code-format = true
# Enable preview style formatting.
preview = true
[tool.ruff.lint]
explicit-preview-rules = true
extend-select = [
"AIR002",
"AIR301",
"AIR302",
"AIR311",
"AIR312",
"ASYNC116",
"B901",
"B903",
"B909",
"CPY001",
"DOC201",
"DOC202",
"DOC402",
"DOC403",
"DOC501",
"DOC502",
"E111",
"E112",
"E113",
"E114",
"E115",
"E116",
"E117",
"E201",
"E202",
"E203",
"E204",
"E211",
"E221",
"E222",
"E223",
"E224",
"E225",
"E226",
"E227",
"E228",
"E231",
"E241",
"E242",
"E251",
"E252",
"E261",
"E262",
"E265",
"E266",
"E271",
"E272",
"E273",
"E274",
"E275",
"E301",
"E302",
"E303",
"E304",
"E305",
"E306",
"E502",
"FURB101",
"FURB103",
"FURB110",
"FURB113",
"FURB116",
"FURB118",
"FURB122",
"FURB131",
"FURB132",
"FURB140",
"FURB142",
"FURB145",
"FURB148",
"FURB152",
"FURB154",
"FURB156",
"FURB157",
"FURB162",
"FURB164",
"FURB166",
"FURB171",
"FURB180",
"FURB189",
"FURB192",
"LOG004",
"LOG014",
"PLC0415",
"PLC1901",
"PLC2701",
"PLC2801",
"PLE0304",
"PLE1141",
"PLE4703",
"PLR0202",
"PLR0203",
"PLR0904",
"PLR0914",
"PLR0916",
"PLR0917",
"PLR1702",
"PLR1733",
"PLR6104",
"PLR6201",
"PLR6301",
"PLW0108",
"PLW0177",
"PLW0244",
"PLW1514",
"PLW1641",
"PLW3201",
"PT028",
"PT029",
"PT030",
"PT031",
"PYI059",
"PYI061",
"RUF027",
"RUF028",
"RUF029",
"RUF031",
"RUF036",
"RUF037",
"RUF038",
"RUF039",
"RUF043",
"RUF045",
"RUF047",
"RUF049",
"RUF052",
"RUF053",
"RUF054",
"RUF055",
"RUF056",
"RUF057",
"RUF058",
"RUF059",
"RUF102",
"TC008",
"UP042",
"UP045",
"UP046",
"UP047",
"UP049",
"W391",
]
external = [
"FURB", # refurb
]
ignore = [
"ANN", # Don't care to enforce typing
"BLE001", # Don't care to enforce blind exception catching
"C901", # Don't care to limit complexity
"COM812", # Trailing comma with black leads to wasting lines
"CPY001", # Don't care to require copyright notices in every file
"D100", # D100, D101, D102, D103, D104, D105, D106, D107: don't always need docstrings
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
"D203", # Keep docstring next to the class definition (covered by D211)
"D212", # Summary should be on second line (opposite of D213)
"D402", # It's nice to reuse the method name
"D406", # Google style requires ":" at end
"D407", # We aren't using numpy style
"D413", # Blank line after last section. -> No blank line
"DOC201", # Don't care to require Returns in docstrings
"DOC402", # Don't care to require Yields in docstrings
"DOC501", # Don't care to require Raises in docstrings
"DTZ", # Don't care to have timezone safety
"EM", # Overly pedantic
"FBT001", # FBT001, FBT002: overly pedantic
"FBT002",
"FIX", # Don't care to prevent TODO, FIXME, etc.
"G004", # f-strings are convenient
"INP001", # Can use namespace packages
"ISC001", # For ruff format compatibility
"PLR0911", # Don't care to limit complexity
"PLR0912", # Don't care to limit complexity
"PLR0913", # Don't care to limit complexity
"PLR0917", # Don't care to limit complexity
"PTH", # Overly pedantic
"SLF001", # Overly pedantic
"T201", # Overly pedantic
"TC001", # TC001, TC002, TC003: don't care to enforce type checking blocks
"TC002",
"TC003",
"TC006", # Strings in cast don't work with PyCharm CE 2024.3.4's jump-to-definition
"TD002", # Don't care for TODO author
"TD003", # Don't care for TODO links
"TRY003", # Overly pedantic
]
preview = true
select = ["ALL"]
unfixable = [
"B007", # While debugging, unused loop variables can be useful
"B905", # Default fix is zip(strict=False), but that can hide bugs
"ERA001", # While debugging, temporarily commenting code can be useful
"F401", # While debugging, unused imports can be useful
"F841", # While debugging, unused locals can be useful
"TC004", # While debugging, it can be nice to keep TYPE_CHECKING in-tact
]
[tool.ruff.lint.flake8-annotations]
mypy-init-return = true
[tool.ruff.lint.per-file-ignores]
"**/tests/*.py" = [
"N802", # Tests function names can match class names
"PLR2004", # Tests can have magic values
"PLR6301", # Test classes can ignore self
"S101", # Tests can have assertions
]
[tool.ruff.lint.pycodestyle]
# The maximum line length to allow for line-length violations within
# documentation (W505), including standalone comments.
max-doc-length = 97 # Match line-length
[tool.ruff.lint.pydocstyle]
# Whether to use Google-style or NumPy-style conventions or the PEP257
# defaults when analyzing docstring sections.
convention = "google"
[tool.tomlsort]
all = true
in_place = true
spaces_before_inline_comment = 2 # Match Python PEP 8
spaces_indent_inline_array = 4 # Match Python PEP 8
trailing_comma_inline_array = true
[tool.uv.sources]
ether0 = {workspace = true}
"ether0.remotes" = {workspace = true}
[tool.uv.workspace]
members = ["packages/*"]