Skip to content

Commit

Permalink
make mypy run properly, add pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Nov 27, 2024
1 parent 78f8677 commit 3aa39c2
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions py-rattler-build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Python bindings to rattler-build
4 changes: 4 additions & 0 deletions py-rattler-build/examples/basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import rattler_build

if __name__ == "__main__":
print(rattler_build.rattler_build_version())
54 changes: 54 additions & 0 deletions py-rattler-build/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[build-system]
requires = ["maturin~=1.2.1"]
build-backend = "maturin"

[project]
name = "py-rattler-build"
requires-python = ">=3.8"
description = "The fastest way to build conda packages programatically"
readme = "README.md"
authors = [
{ name = "Wolf Vollprecht", email = "[email protected]" }
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Typing :: Typed",
]
license = "BSD-3-Clause"

[project.urls]
Homepage = "https://github.com/prefix-dev/rattler-build"
Repository = "https://github.com/prefix-dev/rattler-build"
Issues = "https://github.com/prefix-dev/rattler-build/labels/python-bindings"

[tool.maturin]
features = ["pyo3/extension-module"]

[tool.ruff]
line-length = 120
target-version = "py38"

[tool.mypy]
python_version = "3.8"
files = ["rattler_build", "tests", "examples"]
strict = true
enable_error_code = ["redundant-expr", "truthy-bool", "ignore-without-code"]
disable_error_code = ["empty-body"]

[[tool.mypy.overrides]]
module = ["rattler_build.rattler_build"]
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = ["rattler_build.*"]
# We exclude the rattler module from warn_return_any, because the PyO3 api does not have Python
# type annotations. See https://github.com/PyO3/pyo3/issues/1112 for a discussion on adding
# this capability. We could add a stub file for rattler_build.rattler_build (the PyO3 api), but that
# amounts to duplicating almost all type annotations on our api, as the Python api itself is a
# thin wrapper around the PyO3 api to start with.
warn_return_any = false

0 comments on commit 3aa39c2

Please sign in to comment.