mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-05 23:41:44 +00:00
5994fbde27
Had to bump `ty`, because 0.0.61 added support for `value in [A, B, C]` pattern for type narrowing.
221 lines
6.6 KiB
TOML
221 lines
6.6 KiB
TOML
[project]
|
|
name = "IfcOpenShell"
|
|
version = "0.0.0"
|
|
# Don't provide requires-python explicitly
|
|
# allowing pyprojects to set their own (e.g. bonsai and general ifcopenshell version differ).
|
|
|
|
[tool.black]
|
|
line-length = 120
|
|
include = '''
|
|
src/.*.pyi?$
|
|
|nix/.*.pyi?$
|
|
'''
|
|
extend-exclude = '''
|
|
src/ifcopenshell-python/ifcopenshell/express/rules/*
|
|
|src/ifcopenshell-python/ifcopenshell/express/express_parser.py
|
|
|src/ifcopenshell-python/ifcopenshell/mvd/*
|
|
|src/ifcopenshell-python/ifcopenshell/simple_spf/*
|
|
|src/ifc2ca/templates/*
|
|
|src/svgfill
|
|
|src/exterior-shell-extractor
|
|
'''
|
|
|
|
[tool.pyright]
|
|
reportInvalidTypeForm = false
|
|
disableBytesTypePromotions = true
|
|
reportUnnecessaryTypeIgnoreComment = true
|
|
reportRedeclaration = false
|
|
# Ignore warnings from bpy stubs missing actual source files.
|
|
reportMissingModuleSource = false
|
|
# Pylance doesn't respect gitignore, so we have to exclude files manually here
|
|
# to avoid VS Code slowing down.
|
|
# https://github.com/microsoft/pylance-release/issues/5169
|
|
exclude = [
|
|
"_deps",
|
|
]
|
|
|
|
# Define here general ruff settings,
|
|
# then they will be inherited by projects' .toml files.
|
|
# This allows using assuming different Python version for different projects.
|
|
[tool.ruff]
|
|
line-length = 120
|
|
exclude = [
|
|
# Submodules.
|
|
"src/ifcopenshell-python/ifcopenshell/express",
|
|
"src/ifcopenshell-python/ifcopenshell/mvd",
|
|
"src/ifcopenshell-python/ifcopenshell/simple_spf",
|
|
"src/svgfill",
|
|
#
|
|
# Unformatted.
|
|
"src/exterior-shell-extractor",
|
|
# Incompatible with linter.
|
|
"src/ifc2ca/templates",
|
|
]
|
|
[tool.ruff.lint]
|
|
preview = true
|
|
select = [
|
|
# Default Ruff rules.
|
|
# "E4", # imports
|
|
# "E7", # statements
|
|
"E9", # io errors
|
|
# "F", # pyflakes
|
|
#
|
|
"FA", # future annotations
|
|
"UP", # pyupgrade
|
|
"RUF015", # next() > list_comprehension[0]
|
|
"RUF022", # sort __all__
|
|
"I", # import sorting
|
|
]
|
|
ignore = [
|
|
"FA100", # Conflicts with Blender using annotations for props definitions.
|
|
# Maybe will enable later:
|
|
"UP007", # Optional to X | Y
|
|
"UP045", # Optional to X | None
|
|
"UP015", # Unnecessary mode argument
|
|
"UP028", # yield for -> yield from
|
|
"UP030", # implicit references for positional format fields
|
|
"UP031", # Replace % with .format
|
|
"UP032", # Replace .format with f-string
|
|
]
|
|
|
|
[tool.ty.rules]
|
|
all = "error"
|
|
|
|
# Structural rules (no deep type inference needed, easier to adapt).
|
|
# Has false positives due to ty walrus operator bug.
|
|
possibly-unresolved-reference = "ignore"
|
|
# Maybe later, requires to specify element types for all generics.
|
|
missing-type-argument = "ignore"
|
|
# Conflicts with `bpy` props defined using annotations.
|
|
invalid-type-form = "ignore"
|
|
|
|
# Non-structural rules:
|
|
# Conflicts with `ifcopenshell.api.geometry.add_representation` type of callables we have, confusing them with a module.
|
|
call-non-callable = "ignore"
|
|
# bpy is missing some context manager implementations.
|
|
invalid-context-manager = "ignore"
|
|
# Doesn't go well with `bpy.ops.xxx.yyy`.
|
|
unresolved-attribute = "ignore"
|
|
# Too many false positives.
|
|
invalid-argument-type = "ignore"
|
|
invalid-method-override = "ignore"
|
|
invalid-assignment = "ignore"
|
|
invalid-parameter-default = "ignore"
|
|
missing-override-decorator = "ignore"
|
|
invalid-yield = "ignore"
|
|
invalid-return-type = "ignore"
|
|
non-callable-init-subclass = "ignore"
|
|
not-iterable = "ignore"
|
|
possibly-missing-attribute = "ignore"
|
|
no-matching-overload = "ignore"
|
|
not-subscriptable = "ignore"
|
|
unsupported-dynamic-base = "ignore"
|
|
unsupported-operator = "ignore"
|
|
|
|
[tool.ty.environment]
|
|
extra-paths = [
|
|
"src/bonsai/external_dependencies",
|
|
"src/bcf",
|
|
"src/bsdd",
|
|
"src/bonsai",
|
|
"src/ifc4d",
|
|
"src/ifc5d",
|
|
"src/ifccityjson",
|
|
"src/ifcclash",
|
|
"src/ifccsv",
|
|
"src/ifcdiff",
|
|
"src/ifcfm",
|
|
"src/ifcopenshell-python",
|
|
"src/ifcpatch",
|
|
"src/ifctester",
|
|
]
|
|
|
|
[tool.ty.src]
|
|
exclude = [
|
|
# External dependencies cloned for type checking only.
|
|
"src/bonsai/external_dependencies",
|
|
# Submodules.
|
|
"src/ifcopenshell-python/ifcopenshell/express",
|
|
"src/ifcopenshell-python/ifcopenshell/mvd",
|
|
"src/ifcopenshell-python/ifcopenshell/simple_spf",
|
|
"src/svgfill/3rdparty",
|
|
# Has special dependencies.
|
|
"src/ifcopenshell-python/ifcopenshell/geom/app.py",
|
|
"src/ifcopenshell-python/ifcopenshell/geom/code_editor_pane.py",
|
|
"src/ifcopenshell-python/ifcopenshell/util/doc.py",
|
|
"src/ifcopenshell-python/ifcopenshell/util/generate_pset_templates.py",
|
|
"src/ifcopenshell-python/ifcopenshell/util/ifc4x3dev_scrape_data_for_docs.py",
|
|
# Too esoteric.
|
|
"src/ifcopenshell-python/ifcopenshell/ifcopenshell_wrapper.py",
|
|
"src/ifc2ca/templates",
|
|
# Too dev.
|
|
"src/bcf/setup.py",
|
|
"src/bsdd/yml_to_classes.py",
|
|
# Deprecated.
|
|
"src/ifc2ca/_deprecated",
|
|
]
|
|
|
|
[tool.poe.tasks]
|
|
|
|
dev-setup.sequence = [
|
|
{cmd = "uv sync"},
|
|
{cmd = "uv pip install -e ./src/bsdd/"},
|
|
{cmd = "uv pip install -e ./src/ifcopenshell-python/[advanced,dev]"},
|
|
{cmd = "uv pip install -e ./src/ifcedit/"},
|
|
{cmd = "uv pip install -e ./src/ifcpatch/"},
|
|
{cmd = "uv pip install -e ./src/ifcquery/"},
|
|
{cmd = "uv pip install -e './src/ifcmcp/[mcp]'"},
|
|
{cmd = "uv pip install -r src/bonsai/requirements-dev.txt"},
|
|
]
|
|
dev-setup.help = "Install repo packages in editable mode"
|
|
|
|
ruff = "ruff check"
|
|
|
|
black = "black ."
|
|
|
|
ty.sequence = ["ty-bonsai", "ty-ios"]
|
|
ty.help = "Run ty type checker. Requires ty-venv to be set up first."
|
|
ty-bonsai = "ty check src/bonsai --python=src/bonsai/.venv"
|
|
|
|
ty-venv.sequence = ["bonsai-deps", "ty-venv-bonsai", "ty-venv-ios"]
|
|
|
|
ty-venv-bonsai.sequence = [
|
|
{cmd = "uv venv src/bonsai/.venv --python=3.11 --allow-existing"},
|
|
{cmd = "uv pip install -r src/bonsai/type-check-requirements.txt --python=src/bonsai/.venv"},
|
|
]
|
|
|
|
ty-venv-ios.sequence = [
|
|
{cmd = "uv venv src/ifcopenshell-python/.venv --python=3.10 --allow-existing"},
|
|
{cmd = "uv pip install -r src/ifcopenshell-python/type-check-requirements.txt --python=src/ifcopenshell-python/.venv"},
|
|
]
|
|
|
|
format.sequence = ["black", "ruff"]
|
|
|
|
cmake-format = "gersemi . --in-place"
|
|
|
|
[tool.poe.tasks.ty-ios]
|
|
# --ignore unresolved-reference: walrus operator false positives in ty.
|
|
cmd = """
|
|
ty check
|
|
nix/
|
|
src/bcf
|
|
src/bsdd
|
|
src/ifc2ca
|
|
src/ifc4d
|
|
src/ifc5d
|
|
src/ifccityjson
|
|
src/ifcclash
|
|
src/ifccsv
|
|
src/ifcdiff
|
|
src/ifcfm
|
|
src/ifcopenshell-python
|
|
src/ifcpatch
|
|
src/ifctester
|
|
--python=src/ifcopenshell-python/.venv
|
|
--ignore unresolved-reference
|
|
"""
|
|
|
|
[tool.poe.tasks.bonsai-deps]
|
|
help = "Clone or update Bonsai external dependencies."
|
|
cmd = "python src/bonsai/scripts/bonsai_deps.py"
|