blender_maxwell/pyproject.toml

146 lines
4.6 KiB
TOML
Raw Normal View History

[project]
name = "blender_maxwell"
version = "0.0.1"
description = "Real-time design and visualization of Maxwell simulations in Blender 3D, with deep Tidy3D integration. "
authors = [
{ name = "Sofus Albert Høgsbro Rose", email = "blender-maxwell@sofusrose.com" }
]
dependencies = [
2024-04-07 18:39:27 +02:00
"tidy3d>=2.6.3",
"pydantic==2.6.*",
"sympy==1.12",
"scipy==1.12.*",
"trimesh==4.2.*",
"networkx==3.2.*",
"rich==12.5.*",
"rtree==1.2.*",
2024-04-17 16:03:15 +02:00
"jax[cpu]==0.4.26",
"msgspec[toml]==0.18.6",
"numba==0.59.1",
"jaxtyping==0.2.28",
# Pin Blender 4.1.0-Compatible Versions
## The dependency resolver will report if anything is wonky.
"urllib3==1.26.8",
"requests==2.27.1",
"numpy==1.24.3",
"idna==3.3",
"charset-normalizer==2.0.10",
"certifi==2021.10.8",
]
readme = "README.md"
requires-python = "~= 3.11"
license = { text = "AGPL-3.0-or-later" }
####################
# - Tooling: Rye
####################
[tool.rye]
managed = true
virtual = true
dev-dependencies = [
"ruff>=0.3.2",
"fake-bpy-module-4-0>=20231118", ## TODO: Update to Blender 4.1.0
]
[tool.rye.scripts]
dev = "python ./src/scripts/dev.py"
pack = "python ./src/scripts/pack.py"
####################
# - Tooling: Ruff
####################
[tool.ruff]
target-version = "py311"
line-length = 88
pycodestyle.max-doc-length = 120
[tool.ruff.lint]
task-tags = ["TODO"]
select = [
"E", # pycodestyle ## General Purpose
"F", # pyflakes ## General Purpose
"PL", # Pylint ## General Purpose
## Code Quality
"TCH", # flake8-type-checking ## Type Checking Block Validator
"C90", # mccabe ## Avoid Too-Complex Functions
"ERA", # eradicate ## Ban Commented Code
"TRY", # tryceratops ## Exception Handling Style
"B", # flake8-bugbear ## Opinionated, Probable-Bug Patterns
"N", # pep8-naming
"D", # pydocstyle
"SIM", # flake8-simplify ## Sanity-Check for Code Simplification
"SLF", # flake8-self ## Ban Private Member Access
"RUF", # Ruff-specific rules ## Extra Good-To-Have Rules
## Style
"I", # isort ## Force import Sorting
"UP", # pyupgrade ## Enforce Upgrade to Newer Python Syntaxes
"COM", # flake8-commas ## Enforce Trailing Commas
"Q", # flake8-quotes ## Finally - Quoting Style!
"PTH", # flake8-use-pathlib ## Enforce pathlib usage
"A", # flake8-builtins ## Prevent Builtin Shadowing
"C4", # flake9-comprehensions ## Check Compehension Appropriateness
"DTZ", # flake8-datetimez ## Ban naive Datetime Creation
"EM", # flake8-errmsg ## Check Exception String Formatting
"ISC", # flake8-implicit-str-concat ## Enforce Good String Literal Concat
"G", # flake8-logging-format ## Enforce Good Logging Practices
"INP", # flake8-no-pep420 ## Ban PEP420; Enforce __init__.py.
"PIE", # flake8-pie ## Misc Opinionated Checks
"T20", # flake8-print ## Ban print()
"RSE", # flake8-raise ## Check Niche Exception Raising Pattern
"RET", # flake8-return ## Enforce Good Returning
"ARG", # flake8-unused-arguments ## Ban Unused Arguments
# Specific
"PT", # flake8-pytest-style ## pytest-Specific Checks
]
ignore = [
"COM812", # Conflicts w/Formatter
"ISC001", # Conflicts w/Formatter
"Q000", # Conflicts w/Formatter
"Q001", # Conflicts w/Formatter
"Q002", # Conflicts w/Formatter
"Q003", # Conflicts w/Formatter
2024-04-01 16:48:56 +02:00
"D206", # Conflicts w/Formatter
"B008", # FastAPI uses this for Depends(), Security(), etc. .
"E701", # class foo(Parent): pass or if simple: return are perfectly elegant
"ERA001", # 'Commented-out code' seems to be just about anything to ruff
"F722", # jaxtyping uses type annotations that ruff sees as "syntax error"
feat: Safe, practical BLField. BLField has gotten a huge facelift, to make it practical to wrangle properties without the sharp edges. - All the "special" UI-exposed property types can now be directly constructed in a BLField marked with 'prop_ui'. - The most appropriate internal representation will be chosen to represent the attribute based on its type annotation, including sized vector-like `bool`, `int`, `float` for `tuple[...]`. - Static EnumProperties can now be derived from a special `StrEnum`, to which a `to_name` and `to_icon` method is attached. - Dynamic `EnumProperty` can now be used safely, with builtin workarounds to the real-world reference-loss-crash (realized in the Tidy3D Cloud Task node) and jankiness like empty enum. - The update method is now fully managed, negating all bugs related to improper update callback naming. - Python-side getter caching is preserved for ui-exposed properties, with the help of node/socket base class support for passing a `Signal.InvalidateCache` to BLFields that are altered in the UI. The cost to all this niceness is rather low, and arguably, positive: - Dynamic Enum/String searchers no longer "magically" invoke all the time, since the values seen by Blender are cached by the BLField. - To regenerate the searcher output, an `@on_value_changed` should be made by the user to pass `Signal.ResetEnumItems` or `Signal.ResetStrSearch` to the `BLField`. - Since searching is no longer eager, there is no danger of out-of-reference strings (which crash Blender from EnumProperty), but also a greatly reduced performance problems associated with the hot-loop regeneration of EnumProperty strings. - The base classes are now involved with BLField invalidation, to ensure that the getter caches are cleared up when the UI changes. For the price of that small indirection (done cheaply with set lookup), all attribute lookups are generally done in a single lookup, completely avoiding Blender until needed. - This does represent another increase in confidence wrt. the event system's integrity, but so far, that has been a very productive direction. **NOTE**: The entire feature set of BLField is not well tested, and will likely need adjustments as the codebase is converted to use them.
2024-04-23 07:55:54 +02:00
"N806", # Sometimes we like using types w/uppercase in functions, sue me
"RUF001", # We use a lot of unicode, yes, on purpose!
# Line Length - Controversy Incoming
## Hot Take: Let the Formatter Worry about Line Length
## - Yes dear reader, I'm with you. Soft wrap can go too far.
## - ...but also, sometimes there are real good reasons not to split.
## - Ex. I think 'one sentence per line' docstrings are a valid thing.
## - Overlong lines tend to be be a code smell anyway
## - We'll see if my hot takes survive the week :)
"E501", # Let Formatter Worry about Line Length
]
####################
# - Tooling: Ruff Sublinters
####################
[tool.ruff.lint.flake8-bugbear]
extend-immutable-calls = []
[tool.ruff.lint.pycodestyle]
ignore-overlong-task-comments = true
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.pylint]
max-args = 6
####################
# - Tooling: Ruff Formatter
####################
[tool.ruff.format]
quote-style = "single"
indent-style = "tab"
docstring-code-format = false