| [build-system] | |
| requires = ["setuptools", "setuptools-rust"] | |
| build-backend = "setuptools.build_meta" | |
| [project] | |
| name = "selenium" | |
| dynamic = ["version"] | |
| license = "Apache-2.0" | |
| license-files = ["LICENSE", "NOTICE"] | |
| description = "Official Python bindings for Selenium WebDriver." | |
| readme = "README.rst" | |
| requires-python = ">=3.10" | |
| classifiers = [ | |
| "Development Status :: 5 - Production/Stable", | |
| "Intended Audience :: Developers", | |
| "Operating System :: POSIX", | |
| "Operating System :: Microsoft :: Windows", | |
| "Operating System :: MacOS :: MacOS X", | |
| "Topic :: Software Development :: Testing", | |
| "Topic :: Software Development :: Libraries", | |
| "Programming Language :: Python", | |
| "Programming Language :: Python :: 3.10", | |
| "Programming Language :: Python :: 3.11", | |
| "Programming Language :: Python :: 3.12", | |
| "Programming Language :: Python :: 3.13", | |
| "Programming Language :: Python :: 3.14", | |
| "Programming Language :: Python :: 3.15", | |
| ] | |
| dependencies = [ | |
| "certifi>=2026.10.23", | |
| "trio>=0.31.0,<1.0", | |
| "trio-websocket>=0.12.2,<1.0", | |
| "typing_extensions>=4.15.0,<5.0", | |
| "urllib3[socks]>=2.6.3,<3.0", | |
| "websocket-client>=1.8.0,<2.0", | |
| ] | |
| [project.urls] | |
| homepage = "https://www.selenium.dev" | |
| source = "https://github.com/SeleniumHQ/selenium/tree/trunk/py" | |
| download = "https://pypi.org/project/selenium" | |
| changelog = "https://github.com/SeleniumHQ/selenium/blob/trunk/py/CHANGES" | |
| documentation = "https://www.selenium.dev/documentation/webdriver" | |
| issues = "https://github.com/SeleniumHQ/selenium/issues" | |
| [tool.setuptools] | |
| zip-safe = false | |
| [tool.setuptools.dynamic] | |
| version = {attr = "selenium._version.__version__"} | |
| [tool.setuptools.packages.find] | |
| include = ["selenium*"] | |
| exclude = ["test*"] | |
| namespaces = true | |
| # include-package-data is `true` by default in pyproject.toml | |
| [[tool.setuptools-rust.ext-modules]] | |
| target = "selenium.webdriver.common.selenium-manager" | |
| binding = "Exec" | |
| [tool.setuptools.package-data] | |
| "*" = [ | |
| "*.py", | |
| "*.pyi", | |
| "*.rst", | |
| "*.json", | |
| "*.xpi", | |
| "*.js", | |
| "py.typed", | |
| "prune*", | |
| "selenium.egg-info*", | |
| "selenium-manager", | |
| "selenium-manager.exe", | |
| "CHANGES", | |
| "LICENSE", | |
| "NOTICE", | |
| ] | |
| [tool.pytest] | |
| console_output_style = "progress" | |
| faulthandler_timeout = "60" | |
| log_cli = true | |
| trio_mode = true | |
| addopts = ["-s", "--tb=no"] | |
| filterwarnings = [ | |
| "ignore::DeprecationWarning", | |
| ] | |
| markers = [ | |
| "xfail_chrome: Tests expected to fail in Chrome", | |
| "xfail_edge: Tests expected to fail in Edge", | |
| "xfail_firefox: Tests expected to fail in Firefox", | |
| "xfail_ie: Tests expected to fail in IE", | |
| "xfail_remote: Tests expected to fail with Remote webdriver", | |
| "xfail_safari: Tests expected to fail in Safari", | |
| "xfail_webkitgtk: Tests expected to fail in WebKitGTK", | |
| "xfail_wpewebkit: Tests expected to fail in WPEWebKit", | |
| "no_driver_after_test: If there are no drivers after the test it will create a new one.", | |
| "needs_fresh_driver: Mark tests that may need a fresh driver instance for proper isolation." | |
| ] | |
| python_files = ["test_*.py", "*_test.py", "*_tests.py"] | |
| testpaths = ["test"] | |
| # mypy global options | |
| [tool.mypy] | |
| # The aim in future is we would be able to turn (most) of these flags on | |
| # warn about per-module sections in the config file that do not match any files processed. | |
| warn_unused_configs = true | |
| # disallows subclassing of typing.Any. | |
| disallow_subclassing_any = true | |
| # disallow usage of generic types that do not specify explicit type parameters. | |
| disallow_any_generics = false | |
| # disallow calling functions without type annotations from functions that have type annotations. | |
| disallow_untyped_calls = false | |
| # disallow defining functions without type annotations or with incomplete annotations. | |
| disallow_untyped_defs = false | |
| # disallow defining functions with incomplete type annotations. | |
| disallow_incomplete_defs = false | |
| # type-checks the interior of functions without type annotations. | |
| check_untyped_defs = false | |
| # reports an error whenever a function with type annotations is decorated with a decorator without annotations. | |
| disallow_untyped_decorators = true | |
| # changes the treatment of arguments with a default value of None by not implicitly making their type `typing.Optional`. | |
| no_implicit_optional = true | |
| # warns about casting an expression to it's inferred type. | |
| warn_redundant_casts = true | |
| # warns about unneeded `# type: ignore` comments. | |
| warn_unused_ignores = true | |
| # warns when returning a value with typing.Any from a function with a non typing.Any return type. | |
| warn_return_any = false | |
| # Shows a warning when encountering any code inferred to be unreachable after performing type analysis. | |
| warn_unreachable = true | |
| [[tool.mypy.overrides]] | |
| module = [ | |
| "selenium.webdriver.common.bidi.*", | |
| ] | |
| ignore_errors = true | |
| [tool.ruff] | |
| extend-exclude = [ | |
| "selenium/webdriver/common/devtools/", | |
| "selenium/webdriver/common/bidi/", | |
| "*.md", | |
| ] | |
| line-length = 120 | |
| respect-gitignore = true | |
| target-version = "py310" | |
| [tool.ruff.lint] | |
| # Whole families are listed bare; individually-named rules are families whose | |
| # remaining rules are not enforced yet (see https://github.com/SeleniumHQ/selenium/issues/17989). | |
| select = [ | |
| "B", | |
| "C4", | |
| "D", | |
| "E", | |
| "EXE", | |
| "F", | |
| "FLY", | |
| "FURB", | |
| "G201", | |
| "I", | |
| "PERF102", | |
| "PIE", | |
| "PLE", | |
| "PLR0133", | |
| "PYI041", | |
| "PT", | |
| "RUF", | |
| "SIM102", | |
| "TID252", | |
| "UP", | |
| "W", | |
| ] | |
| fixable = ["ALL"] | |
| extend-ignore = [ | |
| "B007", # Loop control variable not used within loop body | |
| "B024", # Abstract base class without abstract methods | |
| "D100", # Missing docstring in public module | |
| "D101", # Missing docstring in public class | |
| "D102", # Missing docstring in public method | |
| "D103", # Missing docstring in public function | |
| "D104", # Missing docstring in public package | |
| "D105", # Missing docstring in magic method | |
| "D107", # Missing docstring in `__init__` | |
| "D212", # Multi-line docstring summary should start at the first line | |
| "PT011", # Use of `pytest.raises({exception})` is too broad | |
| "PT012", # `pytest.raises()` block should contain a single simple statement | |
| "RUF005", # Uses of the + operator to concatenate collections | |
| "RUF012", # Mutable default values in class attributes | |
| "RUF059", # Unpacked variable is never used | |
| ] | |
| # These globs are matched against paths relative to the working directory, not to | |
| # this file. py/private/ruff.py runs ruff from the workspace root, so they are | |
| # spelled "py/..." -- they silently stop matching if ruff is invoked from py/. | |
| [tool.ruff.lint.per-file-ignores] | |
| # Accessing a property to assert that it raises, inside `with pytest.raises(...)`, | |
| # is the idiomatic spelling; `_ = alert.text` would be strictly worse. | |
| "py/test/**" = ["B018"] | |
| # Same pattern, in a driver-liveness probe rather than a test assertion. | |
| "py/conftest.py" = ["B018"] | |
| [tool.ruff.format] | |
| docstring-code-format = true | |
| docstring-code-line-length = 120 | |
| [tool.ruff.lint.isort] | |
| known-first-party = ["selenium", "test"] | |
| known-third-party = [] | |
| known-local-folder = ["conftest"] | |
| [tool.ruff.lint.pydocstyle] | |
| convention = "google" |