diff --git a/nix/build-all.py b/nix/build-all.py
index 6682a3d279..a39f3e505c 100644
--- a/nix/build-all.py
+++ b/nix/build-all.py
@@ -132,9 +132,9 @@ from collections.abc import Generator, Sequence
from datetime import datetime
from pathlib import Path
from typing import Literal
+from urllib.request import urlretrieve
from typing_extensions import assert_never
-from urllib.request import urlretrieve
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
diff --git a/src/ifc4d/ifc4d/common.py b/src/ifc4d/ifc4d/common.py
index c7efb21189..783680b760 100644
--- a/src/ifc4d/ifc4d/common.py
+++ b/src/ifc4d/ifc4d/common.py
@@ -4,13 +4,13 @@ from datetime import date, datetime, timedelta
from typing import Any, TypedDict, Union
import ifcopenshell
-import ifcopenshell.guid
-import ifcopenshell.util.date
import ifcopenshell.api.control
import ifcopenshell.api.owner
import ifcopenshell.api.pset
import ifcopenshell.api.resource
import ifcopenshell.api.sequence
+import ifcopenshell.guid
+import ifcopenshell.util.date
from typing_extensions import NotRequired
diff --git a/src/ifc5d/ifc5d/ifc5Dspreadsheet.py b/src/ifc5d/ifc5d/ifc5Dspreadsheet.py
index 622fefa211..95194789ef 100644
--- a/src/ifc5d/ifc5d/ifc5Dspreadsheet.py
+++ b/src/ifc5d/ifc5d/ifc5Dspreadsheet.py
@@ -27,13 +27,13 @@ import os
import time
from collections import Counter
from typing import Optional, Union
-from typing_extensions import TypedDict
import ifcopenshell
import ifcopenshell.util.cost
import ifcopenshell.util.date
import ifcopenshell.util.element
import ifcopenshell.util.unit
+from typing_extensions import TypedDict
class CostItem(TypedDict, extra_items=float):
diff --git a/src/ifcopenshell-python/ifcopenshell/__init__.py b/src/ifcopenshell-python/ifcopenshell/__init__.py
index ccf369dff0..0f622cb364 100644
--- a/src/ifcopenshell-python/ifcopenshell/__init__.py
+++ b/src/ifcopenshell-python/ifcopenshell/__init__.py
@@ -62,7 +62,7 @@ import tempfile
import zipfile
from collections.abc import Generator, Sequence
from pathlib import Path
-from typing import TYPE_CHECKING, Literal, Optional, Union, Any, overload
+from typing import TYPE_CHECKING, Any, Literal, Optional, Union, overload
if TYPE_CHECKING:
import ifcopenshell.express.schema_class
@@ -88,11 +88,13 @@ try:
except Exception as e:
raise ImportError("IfcOpenShell not built for '%s' (%s)" % (python_distribution, e)) from e
+from . import file as file_module
from . import guid
from .ifcopenshell_wrapper import entity_instance, file
-from .file import rocksdb_lazy_instance
from .sql import sqlite, sqlite_entity
+rocksdb_lazy_instance = file_module.rocksdb_lazy_instance
+
get_log = ifcopenshell_wrapper.get_log
logger = ifcopenshell_wrapper.logger if hasattr(ifcopenshell_wrapper, "logger") else None
if hasattr(ifcopenshell_wrapper, "logger_or_root"):
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/__init__.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/__init__.py
index e0d5684164..ce0b31da2b 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/__init__.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/__init__.py
@@ -48,8 +48,8 @@ Future versions of this API may support:
"""
from ._get_segment_start_point_label import register_referent_name_callback
-from .add_stationing_referent import add_stationing_referent
from .add_positioning_referent import add_positioning_referent
+from .add_stationing_referent import add_stationing_referent
from .add_vertical_layout import add_vertical_layout
from .add_zero_length_segment import add_zero_length_segment
from .create import create
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_curve.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_curve.py
index 659a3f314b..98a6e1eabf 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_curve.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_curve.py
@@ -17,6 +17,7 @@
# along with IfcOpenShell. If not, see .
from typing import Union
+
import numpy as np
import ifcopenshell
@@ -24,8 +25,6 @@ import ifcopenshell.api.alignment
import ifcopenshell.geom
from ifcopenshell import entity_instance
from ifcopenshell.api.alignment._get_segment_endpoint import _get_segment_endpoint
-from ifcopenshell.api.alignment._update_zero_length_segment_placement import _update_zero_length_segment_placement
-
from ifcopenshell.api.alignment._map_alignment_cant_segment import (
_map_alignment_cant_segment,
)
@@ -38,6 +37,7 @@ from ifcopenshell.api.alignment._map_alignment_vertical_segment import (
from ifcopenshell.api.alignment._update_curve_segment_transition_code import (
_update_curve_segment_transition_code,
)
+from ifcopenshell.api.alignment._update_zero_length_segment_placement import _update_zero_length_segment_placement
def _add_curve_segment_to_composite_curve(
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_layout.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_layout.py
index c143754568..0616091c43 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_layout.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/_add_segment_to_layout.py
@@ -22,11 +22,11 @@ import numpy as np
import ifcopenshell
import ifcopenshell.api.alignment
-from ifcopenshell.api.alignment._update_zero_length_segment_placement import _update_zero_length_segment_placement
import ifcopenshell.api.nest
from ifcopenshell import entity_instance
from ifcopenshell.api.alignment._add_segment_to_curve import _add_segment_to_curve
from ifcopenshell.api.alignment._get_segment_endpoint import _get_segment_endpoint
+from ifcopenshell.api.alignment._update_zero_length_segment_placement import _update_zero_length_segment_placement
def _add_segment_to_layout(
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/_get_segment_endpoint.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/_get_segment_endpoint.py
index 5db57d481e..f32849fc34 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/_get_segment_endpoint.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/_get_segment_endpoint.py
@@ -17,13 +17,15 @@
# along with IfcOpenShell. If not, see .
+import math
+from typing import Union
+
+import numpy as np
+
import ifcopenshell.api.alignment
import ifcopenshell.geom
from ifcopenshell import entity_instance, ifcopenshell_wrapper
from ifcopenshell.api.alignment._map_alignment_segment import _map_alignment_segment
-from typing import Union
-import math
-import numpy as np
def _get_segment_endpoint(file: ifcopenshell.file, segment: entity_instance) -> Union[np.array, None]:
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/_map_alignment_segment.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/_map_alignment_segment.py
index 117bfe10f7..f398d5e4c7 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/_map_alignment_segment.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/_map_alignment_segment.py
@@ -20,7 +20,6 @@ from collections.abc import Sequence
import ifcopenshell
from ifcopenshell import entity_instance
-
from ifcopenshell.api.alignment._map_alignment_cant_segment import (
_map_alignment_cant_segment,
)
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/_update_zero_length_segment_placement.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/_update_zero_length_segment_placement.py
index eb1d57f4e5..4ae272d9a8 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/_update_zero_length_segment_placement.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/_update_zero_length_segment_placement.py
@@ -16,10 +16,11 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import math
+
import numpy as np
import ifcopenshell
-import math
import ifcopenshell.api.alignment
import ifcopenshell.util.unit
from ifcopenshell import entity_instance
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/add_positioning_referent.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/add_positioning_referent.py
index aa1b751707..0bd4f993fc 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/add_positioning_referent.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/add_positioning_referent.py
@@ -18,10 +18,10 @@
import ifcopenshell
import ifcopenshell.api.alignment
-from ifcopenshell.api.alignment.update_fallback_position import update_fallback_position
import ifcopenshell.api.pset
import ifcopenshell.guid
from ifcopenshell import entity_instance
+from ifcopenshell.api.alignment.update_fallback_position import update_fallback_position
def add_positioning_referent(
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/add_stationing_referent.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/add_stationing_referent.py
index 19f13ca904..ad2ed4db03 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/add_stationing_referent.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/add_stationing_referent.py
@@ -20,12 +20,12 @@ from typing import Optional
import ifcopenshell
import ifcopenshell.api.alignment
-from ifcopenshell.api.alignment._sort_nest import _sort_nest
-from ifcopenshell.api.alignment.update_fallback_position import update_fallback_position
import ifcopenshell.api.pset
import ifcopenshell.guid
import ifcopenshell.util.element
from ifcopenshell import entity_instance
+from ifcopenshell.api.alignment._sort_nest import _sort_nest
+from ifcopenshell.api.alignment.update_fallback_position import update_fallback_position
def add_stationing_referent(
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/add_zero_length_segment.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/add_zero_length_segment.py
index cbd19c2d12..aa9d5ca837 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/add_zero_length_segment.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/add_zero_length_segment.py
@@ -20,14 +20,14 @@ import math
import ifcopenshell
import ifcopenshell.api.alignment
-from ifcopenshell.api.alignment._get_segment_endpoint import _get_segment_endpoint
-from ifcopenshell.api.alignment._update_zero_length_segment_placement import _update_zero_length_segment_placement
import ifcopenshell.api.nest
import ifcopenshell.util.unit
from ifcopenshell import entity_instance
+from ifcopenshell.api.alignment._get_segment_endpoint import _get_segment_endpoint
from ifcopenshell.api.alignment._update_curve_segment_transition_code import (
_update_curve_segment_transition_code,
)
+from ifcopenshell.api.alignment._update_zero_length_segment_placement import _update_zero_length_segment_placement
def add_zero_length_segment(file: ifcopenshell.file, layout: entity_instance) -> bool:
diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/get_curve_segment.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/get_curve_segment.py
index 210249f43b..d4ff8592b7 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/alignment/get_curve_segment.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/get_curve_segment.py
@@ -17,10 +17,8 @@
# along with IfcOpenShell. If not, see .
-from ifcopenshell import entity_instance
-
import ifcopenshell.api.alignment
-
+from ifcopenshell import entity_instance
from ifcopenshell.api.alignment.get_mapped_segments import _get_curve_segment_count
diff --git a/src/ifcopenshell-python/ifcopenshell/api/cost/assign_cost_item_quantity.py b/src/ifcopenshell-python/ifcopenshell/api/cost/assign_cost_item_quantity.py
index 7ddfaa2dd0..ddddadc353 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/cost/assign_cost_item_quantity.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/cost/assign_cost_item_quantity.py
@@ -16,8 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
-import ifcopenshell.api.cost
-import ifcopenshell.api.control
import ast
import operator
from typing import Any
diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/__init__.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/__init__.py
index 93a5b8da78..262373d275 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/geometry/__init__.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/__init__.py
@@ -25,10 +25,7 @@ geometry extrusions).
from .. import wrap_usecases
from .add_axis_representation import add_axis_representation
-from .add_topology_representation import add_topology_representation
from .add_boolean import add_boolean
-from .clip_solid import clip_solid
-from .clip_solid_bounded import clip_solid_bounded
from .add_door_representation import add_door_representation
from .add_footprint_representation import add_footprint_representation
from .add_mesh_representation import add_mesh_representation
@@ -41,12 +38,15 @@ from .add_profile_representation import add_profile_representation
# round-tripping through an IFC file. Future add_X_representation work is encouraged
# to follow the same shape — sibling compute_X_geometry function + thin IFC wrapper.
from .add_railing_representation import (
- RailingSupport,
TERMINAL_TYPE,
+ RailingSupport,
WallMountedHandrailGeometry,
add_railing_representation,
compute_wall_mounted_handrail_geometry,
)
+from .add_topology_representation import add_topology_representation
+from .clip_solid import clip_solid
+from .clip_solid_bounded import clip_solid_bounded
try:
from .add_representation import add_representation
@@ -61,12 +61,12 @@ from .assign_representation import assign_representation
from .connect_element import connect_element
from .connect_path import connect_path
from .connect_wall import connect_wall
+from .copy_representation import copy_representation
from .create_2pt_wall import create_2pt_wall
from .disconnect_element import disconnect_element
from .disconnect_path import disconnect_path
from .edit_object_placement import edit_object_placement
from .map_representation import map_representation
-from .copy_representation import copy_representation
from .regenerate_wall_representation import regenerate_wall_representation
from .remove_boolean import remove_boolean
from .remove_representation import remove_representation
diff --git a/src/ifcopenshell-python/ifcopenshell/api/project/append_asset.py b/src/ifcopenshell-python/ifcopenshell/api/project/append_asset.py
index 180dc079e8..f3300079b9 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/project/append_asset.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/project/append_asset.py
@@ -20,6 +20,7 @@ from collections import deque
from collections.abc import Callable
from functools import partial
from typing import Any, Literal, Optional, Union, get_args
+
import ifcopenshell
import ifcopenshell.api.context
import ifcopenshell.api.geometry
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_sequence.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_sequence.py
index 8d3c6e9186..b0f8520189 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_sequence.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_sequence.py
@@ -16,10 +16,11 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+from typing import Optional
+
import ifcopenshell
import ifcopenshell.api.sequence
import ifcopenshell.util.element
-from typing import Optional
def unassign_sequence(
diff --git a/src/ifcopenshell-python/ifcopenshell/geom/main.py b/src/ifcopenshell-python/ifcopenshell/geom/main.py
index 096acef400..875fd2799d 100644
--- a/src/ifcopenshell-python/ifcopenshell/geom/main.py
+++ b/src/ifcopenshell-python/ifcopenshell/geom/main.py
@@ -25,9 +25,7 @@ from typing import TYPE_CHECKING, Any, Literal, Optional, TypeVar, Union, cast,
import ifcopenshell
-from .. import ifcopenshell_wrapper, open
-from .. import entity_instance
-from .. import file
+from .. import entity_instance, file, ifcopenshell_wrapper, open
from . import has_occ
if TYPE_CHECKING:
diff --git a/src/ifcopenshell-python/ifcopenshell/sql.py b/src/ifcopenshell-python/ifcopenshell/sql.py
index ae4cdebdea..2e57f6dc81 100644
--- a/src/ifcopenshell-python/ifcopenshell/sql.py
+++ b/src/ifcopenshell-python/ifcopenshell/sql.py
@@ -30,8 +30,7 @@ import ifcopenshell
import ifcopenshell.util.attribute
import ifcopenshell.util.schema
-from . import ifcopenshell_wrapper
-from . import file, entity_instance
+from . import entity_instance, file, ifcopenshell_wrapper
if TYPE_CHECKING:
import sqlite3
diff --git a/src/ifcopenshell-python/ifcopenshell/stream.py b/src/ifcopenshell-python/ifcopenshell/stream.py
index f39029b1ac..ae6651852f 100644
--- a/src/ifcopenshell-python/ifcopenshell/stream.py
+++ b/src/ifcopenshell-python/ifcopenshell/stream.py
@@ -28,8 +28,7 @@ try:
import ifcopenshell.util.attribute
import ifcopenshell.util.schema
- from . import ifcopenshell_wrapper
- from . import file
+ from . import file, ifcopenshell_wrapper
class StreamTransformer(Transformer):
file: file
diff --git a/src/ifcopenshell-python/ifcopenshell/template.py b/src/ifcopenshell-python/ifcopenshell/template.py
index 357f7088b6..2df804f2fe 100644
--- a/src/ifcopenshell-python/ifcopenshell/template.py
+++ b/src/ifcopenshell-python/ifcopenshell/template.py
@@ -22,6 +22,7 @@ import uuid
from typing import Optional
from ifcopenshell import file
+
from .guid import compress
from .ifcopenshell_wrapper import version
diff --git a/src/ifcopenshell-python/ifcopenshell/validate.py b/src/ifcopenshell-python/ifcopenshell/validate.py
index 4bfd6787dc..564e6c7872 100644
--- a/src/ifcopenshell-python/ifcopenshell/validate.py
+++ b/src/ifcopenshell-python/ifcopenshell/validate.py
@@ -57,8 +57,9 @@ from collections.abc import Iterator
from logging import Handler, Logger
from pathlib import Path
from types import EllipsisType
-from typing import TYPE_CHECKING, Any, Optional, Union, TypeAlias, Literal
-from typing_extensions import TypedDict, NotRequired
+from typing import TYPE_CHECKING, Any, Literal, Optional, TypeAlias, Union
+
+from typing_extensions import NotRequired, TypedDict
import ifcopenshell
import ifcopenshell.express.rule_executor
diff --git a/src/ifcopenshell-python/test/api/alignment/test_create_representation.py b/src/ifcopenshell-python/test/api/alignment/test_create_representation.py
index 663d4500ac..b3ee95c4c2 100644
--- a/src/ifcopenshell-python/test/api/alignment/test_create_representation.py
+++ b/src/ifcopenshell-python/test/api/alignment/test_create_representation.py
@@ -20,6 +20,7 @@
import math
import pytest
+
import ifcopenshell
import ifcopenshell.api.aggregate
import ifcopenshell.api.alignment
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_00.py b/src/ifcopenshell-python/test/fixtures/rules/generate_00.py
index 2460a2cd37..95b3acb5a4 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_00.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_00.py
@@ -1,6 +1,7 @@
import time
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
for i in range(3):
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_01.py b/src/ifcopenshell-python/test/fixtures/rules/generate_01.py
index b3dc34408a..fa00bed905 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_01.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_01.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
for i, box_alignment in enumerate(["top-left", "center", "invalid", "CENTER"]):
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_02.py b/src/ifcopenshell-python/test/fixtures/rules/generate_02.py
index f4f9ebd4f4..041bc481d8 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_02.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_02.py
@@ -1,6 +1,7 @@
import time
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
latitudes = [
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_03.py b/src/ifcopenshell-python/test/fixtures/rules/generate_03.py
index 4ce7e50f95..bbcc7121cc 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_03.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_03.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
for depth in (-1.0, 0.0, 1.0):
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_04.py b/src/ifcopenshell-python/test/fixtures/rules/generate_04.py
index 2f64e38fa2..2dadc57bff 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_04.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_04.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import fail_if, normalize_header, write_fixture
for i, (r1, r2) in enumerate(
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_05.py b/src/ifcopenshell-python/test/fixtures/rules/generate_05.py
index ad6ebcdb2f..fac397758f 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_05.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_05.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
options = {
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_06.py b/src/ifcopenshell-python/test/fixtures/rules/generate_06.py
index 718ce10bc2..ab0855417f 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_06.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_06.py
@@ -2,6 +2,7 @@ import itertools
import time
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
for pty, ety in itertools.product(("GRILLE", "USERDEFINED"), (None, "Something")):
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_07.py b/src/ifcopenshell-python/test/fixtures/rules/generate_07.py
index 02d19de3c5..bb005b3143 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_07.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_07.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import fail_if, normalize_header, write_fixture
create_none = lambda f: None
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_08.py b/src/ifcopenshell-python/test/fixtures/rules/generate_08.py
index 9e2f935c47..141d897e69 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_08.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_08.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import fail_if, normalize_header, write_fixture
create_plane = lambda f: f.createIfcPlane(f.createIfcAxis2Placement3D(f.createIfcCartesianPoint((0.0, 0.0, 0.0))))
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_09.py b/src/ifcopenshell-python/test/fixtures/rules/generate_09.py
index 6a98196102..eaee5c1240 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_09.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_09.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
pts = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0)]
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_10.py b/src/ifcopenshell-python/test/fixtures/rules/generate_10.py
index b2cfdfca7d..94586ce8a5 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_10.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_10.py
@@ -1,6 +1,7 @@
import itertools
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
defaults = {"Girth": 1.0, "WallThickness": 0.11}
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_11.py b/src/ifcopenshell-python/test/fixtures/rules/generate_11.py
index 37768412fd..3aac368058 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_11.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_11.py
@@ -1,5 +1,6 @@
import ifcopenshell
import ifcopenshell.util.schema
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
depth = 1.0
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_12.py b/src/ifcopenshell-python/test/fixtures/rules/generate_12.py
index 77136e803b..15cf181819 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_12.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_12.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, write_fixture
coords = [(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0)]
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_13.py b/src/ifcopenshell-python/test/fixtures/rules/generate_13.py
index 200ffcf2cf..fbbeb1c2ab 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_13.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_13.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, write_fixture
coords = [(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0)]
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_14.py b/src/ifcopenshell-python/test/fixtures/rules/generate_14.py
index 1d82f570fd..b4281f7d0b 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_14.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_14.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
dims = [
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_15.py b/src/ifcopenshell-python/test/fixtures/rules/generate_15.py
index 3bb91bab55..f7d96a0884 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_15.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_15.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
coords = [(0.0, 0.0), (10.0, 0.0)]
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_16.py b/src/ifcopenshell-python/test/fixtures/rules/generate_16.py
index a22ec7163e..de97542184 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_16.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_16.py
@@ -1,6 +1,7 @@
import time
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
names = [("Same", "Same"), ("Different", "SomethingElse")]
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_17.py b/src/ifcopenshell-python/test/fixtures/rules/generate_17.py
index d67799cd1d..daa3373e53 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_17.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_17.py
@@ -1,6 +1,7 @@
import time
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
for i, nm in enumerate(("no-mls", "mls", "mlsu")):
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_18.py b/src/ifcopenshell-python/test/fixtures/rules/generate_18.py
index 637e1dbbd1..a4e89d6d62 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_18.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_18.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
for i, type_decl in enumerate(("IfcLengthMeasure", "IfcPlaneAngleMeasure")):
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_19.py b/src/ifcopenshell-python/test/fixtures/rules/generate_19.py
index 327e0da7fb..7d54fd4065 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_19.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_19.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
make_nd = lambda d: lambda *c: (c + (0.0,)) if d == 3 else c
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_20.py b/src/ifcopenshell-python/test/fixtures/rules/generate_20.py
index 2c0ac7bd8f..9a4be3c34c 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_20.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_20.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
task = lambda f: f.createIfcTask(ifcopenshell.guid.new(), None, "sleep", IsMilestone=True)
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_21.py b/src/ifcopenshell-python/test/fixtures/rules/generate_21.py
index 8e87988546..8aeb0896bc 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_21.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_21.py
@@ -1,6 +1,7 @@
import itertools
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_22.py b/src/ifcopenshell-python/test/fixtures/rules/generate_22.py
index 800e0e2a46..6a1f165baf 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_22.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_22.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
for cnt in range(0, 3):
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_23.py b/src/ifcopenshell-python/test/fixtures/rules/generate_23.py
index a415f32fa6..0bdc630d41 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_23.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_23.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
fns = [
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_24.py b/src/ifcopenshell-python/test/fixtures/rules/generate_24.py
index 022762512b..fc77cc38bb 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_24.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_24.py
@@ -1,6 +1,7 @@
import time
import ifcopenshell
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
for ents in [
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_25.py b/src/ifcopenshell-python/test/fixtures/rules/generate_25.py
index 9901a83635..fbf4857ba6 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_25.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_25.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import fail_if, normalize_header, write_fixture
segs = [
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_26.py b/src/ifcopenshell-python/test/fixtures/rules/generate_26.py
index 1154bad08a..cc5fd0a476 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_26.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_26.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, write_fixture
cases = (
diff --git a/src/ifcopenshell-python/test/fixtures/rules/generate_27.py b/src/ifcopenshell-python/test/fixtures/rules/generate_27.py
index b82c078a29..5181219280 100644
--- a/src/ifcopenshell-python/test/fixtures/rules/generate_27.py
+++ b/src/ifcopenshell-python/test/fixtures/rules/generate_27.py
@@ -1,4 +1,5 @@
import ifcopenshell
+
from ...fixture_generate import normalize_header, write_fixture
ifc_file = ifcopenshell.file(schema="IFC2X3")
diff --git a/src/ifcopenshell-python/test/fixtures/validate/generate_00.py b/src/ifcopenshell-python/test/fixtures/validate/generate_00.py
index 5b0e363b3e..058cb5b693 100644
--- a/src/ifcopenshell-python/test/fixtures/validate/generate_00.py
+++ b/src/ifcopenshell-python/test/fixtures/validate/generate_00.py
@@ -1,6 +1,7 @@
import ifcopenshell
import ifcopenshell.api.owner
import ifcopenshell.api.root
+
from ...fixture_generate import normalize_header, pass_if, write_fixture
guid1 = "3pdqyORIn8KBHZAhhtJ72T"
diff --git a/src/ifcopenshell-python/test/test_entity_instance.py b/src/ifcopenshell-python/test/test_entity_instance.py
index e0e83ee7e1..2bfa910e87 100644
--- a/src/ifcopenshell-python/test/test_entity_instance.py
+++ b/src/ifcopenshell-python/test/test_entity_instance.py
@@ -16,8 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
-import ifcopenshell
import pytest
+
+import ifcopenshell
import test.bootstrap
diff --git a/src/ifcopenshell-python/test/test_rules.py b/src/ifcopenshell-python/test/test_rules.py
index 7bb12dd211..615fe1f06c 100644
--- a/src/ifcopenshell-python/test/test_rules.py
+++ b/src/ifcopenshell-python/test/test_rules.py
@@ -5,6 +5,7 @@ import tabulate
import ifcopenshell.express.rule_executor
import ifcopenshell.validate
+
from .fixture_generate import FailObj, Result, parse_result
diff --git a/src/ifcopenshell-python/test/test_shape_stats.py b/src/ifcopenshell-python/test/test_shape_stats.py
index 6cc67fbb7e..4988ff65be 100644
--- a/src/ifcopenshell-python/test/test_shape_stats.py
+++ b/src/ifcopenshell-python/test/test_shape_stats.py
@@ -1,4 +1,5 @@
import csv
+from pathlib import Path
import pytest
@@ -6,8 +7,6 @@ import ifcopenshell
import ifcopenshell.geom
import ifcopenshell.util.shape
-from pathlib import Path
-
repo_root = Path(__file__).resolve().parent.parent.parent.parent
test_files = repo_root / "test" / "input" / "tests"
diff --git a/src/ifcopenshell-python/test/test_validate.py b/src/ifcopenshell-python/test/test_validate.py
index 4dd42a7a05..e5ad8efdcd 100644
--- a/src/ifcopenshell-python/test/test_validate.py
+++ b/src/ifcopenshell-python/test/test_validate.py
@@ -22,6 +22,7 @@ import pytest
import tabulate
import ifcopenshell.validate
+
from .fixture_generate import FailObj, Result, parse_result
_filepaths = list((Path(__file__).parent / "fixtures/validate").glob("*.ifc"))
diff --git a/src/ifcopenshell-python/test/util/test_cost.py b/src/ifcopenshell-python/test/util/test_cost.py
index d0f9612673..7e9c65885e 100644
--- a/src/ifcopenshell-python/test/util/test_cost.py
+++ b/src/ifcopenshell-python/test/util/test_cost.py
@@ -19,10 +19,9 @@
import ifcopenshell.api.control
import ifcopenshell.api.cost
-import test.bootstrap
import ifcopenshell.api.root
-
import ifcopenshell.util.cost as subject
+import test.bootstrap
class TestGetCostItemForProduct(test.bootstrap.IFC4):
diff --git a/src/ifcopenshell-python/test/util/test_element.py b/src/ifcopenshell-python/test/util/test_element.py
index 9ec355f7fe..d148fbaf5a 100644
--- a/src/ifcopenshell-python/test/util/test_element.py
+++ b/src/ifcopenshell-python/test/util/test_element.py
@@ -38,7 +38,6 @@ import ifcopenshell.api.sequence
import ifcopenshell.api.spatial
import ifcopenshell.api.style
import ifcopenshell.api.type
-import ifcopenshell.api.feature
import ifcopenshell.guid
import ifcopenshell.util.element as subject
import test.bootstrap
diff --git a/src/ifcpatch/ifcpatch/recipes/FixArchiCADToRevitSpaces.py b/src/ifcpatch/ifcpatch/recipes/FixArchiCADToRevitSpaces.py
index 612026f8b1..9006621a24 100644
--- a/src/ifcpatch/ifcpatch/recipes/FixArchiCADToRevitSpaces.py
+++ b/src/ifcpatch/ifcpatch/recipes/FixArchiCADToRevitSpaces.py
@@ -19,12 +19,6 @@
import logging
from typing import TypeVar, Union
-import numpy as np
-import numpy.typing as npt
-import shapely
-import shapely.ops
-from shapely.geometry.polygon import orient
-
import ifcopenshell
import ifcopenshell.api.geometry
import ifcopenshell.geom
@@ -33,7 +27,12 @@ import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.shape
import ifcopenshell.util.unit
+import numpy as np
+import numpy.typing as npt
+import shapely
+import shapely.ops
from ifcopenshell.util.shape_builder import ShapeBuilder
+from shapely.geometry.polygon import orient
import ifcpatch
diff --git a/src/ifcpatch/ifcpatch/recipes/FixRevit2025TINs.py b/src/ifcpatch/ifcpatch/recipes/FixRevit2025TINs.py
index 8cb68c3dfc..9ece436bbe 100644
--- a/src/ifcpatch/ifcpatch/recipes/FixRevit2025TINs.py
+++ b/src/ifcpatch/ifcpatch/recipes/FixRevit2025TINs.py
@@ -19,8 +19,7 @@
from __future__ import annotations
import logging
-from typing import Optional, TYPE_CHECKING
-
+from typing import TYPE_CHECKING, Optional
import ifcopenshell
import ifcopenshell.util.shape_builder
diff --git a/src/ifcpatch/ifcpatch/recipes/MergeProjects.py b/src/ifcpatch/ifcpatch/recipes/MergeProjects.py
index 9d20164424..1539b28659 100644
--- a/src/ifcpatch/ifcpatch/recipes/MergeProjects.py
+++ b/src/ifcpatch/ifcpatch/recipes/MergeProjects.py
@@ -20,7 +20,6 @@ from collections.abc import Sequence
from logging import Logger
from typing import Union
-import ifcpatch
import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.geolocation
diff --git a/src/ifcpatch/test/test_FixArchiCADToRevitSpaces.py b/src/ifcpatch/test/test_FixArchiCADToRevitSpaces.py
index 7041efa814..3c8a103087 100644
--- a/src/ifcpatch/test/test_FixArchiCADToRevitSpaces.py
+++ b/src/ifcpatch/test/test_FixArchiCADToRevitSpaces.py
@@ -16,9 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
-import numpy as np
-import pytest
-
import ifcopenshell.api.aggregate
import ifcopenshell.api.context
import ifcopenshell.api.geometry
@@ -28,6 +25,8 @@ import ifcopenshell.geom
import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.shape
+import numpy as np
+import pytest
from ifcopenshell.util.shape_builder import ShapeBuilder
import ifcpatch
diff --git a/src/ifcpatch/test/test_Migrate.py b/src/ifcpatch/test/test_Migrate.py
index 23930e6283..cb6edbb596 100644
--- a/src/ifcpatch/test/test_Migrate.py
+++ b/src/ifcpatch/test/test_Migrate.py
@@ -17,9 +17,9 @@
# along with IfcOpenShell. If not, see .
+import ifcopenshell.api.project
import pytest
-import ifcopenshell.api.project
import ifcpatch
import test.bootstrap
diff --git a/src/ifcpatch/test/test_Optimise.py b/src/ifcpatch/test/test_Optimise.py
index aa6352e937..d0700af4f9 100644
--- a/src/ifcpatch/test/test_Optimise.py
+++ b/src/ifcpatch/test/test_Optimise.py
@@ -22,10 +22,9 @@ import logging
import sys
from unittest import mock
-import pytest
-
import ifcopenshell
import ifcopenshell.guid
+import pytest
import ifcpatch
import test.bootstrap
diff --git a/src/ifctester/ifctester/reporter.py b/src/ifctester/ifctester/reporter.py
index 762144e60f..399ba8eab3 100644
--- a/src/ifctester/ifctester/reporter.py
+++ b/src/ifctester/ifctester/reporter.py
@@ -24,12 +24,12 @@ import os
import re
import sys
from typing import Literal, Optional, TypedDict, Union
-from typing_extensions import NotRequired
import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.placement
import ifcopenshell.util.unit
+from typing_extensions import NotRequired
from .facet import Facet, FacetFailure
from .ids import Ids, Specification