nathanwilliams-ct commented on code in PR #2167:
URL: https://github.com/apache/buildstream/pull/2167#discussion_r3765323937


##########
src/buildstream/_loader/loadcontext.py:
##########
@@ -14,23 +14,31 @@
 #  Authors:
 #        Tristan Van Berkom <[email protected]>
 
+
+from typing import Callable, Optional, TYPE_CHECKING
+
+
 from .._exceptions import LoadError
 from ..exceptions import LoadErrorReason
 from ..types import _ProjectInformation
 
+if TYPE_CHECKING:
+    from .._context import Context
+    from .._loader.loader import Loader
+
 
 # ProjectLoaders()
 #
 # An object representing all of the loaders for a given project.
 #
 class ProjectLoaders:
-    def __init__(self, project_name):
+    def __init__(self, project_name: str):
 
         # The project name
         self._name = project_name
 
         # A list of all loaded loaders for this project
-        self._collect = []
+        self._collect: list["Loader"] = []

Review Comment:
   I went with the Manual String annotations as that is what is used elsewhere 
in the codebase at the moment.
   
   Rabbit hole of documentation:
   - https://docs.python.org/3/library/__future__.html#future__.annotations
   - https://docs.python.org/3/reference/compound_stmts.html#annotations
   - https://peps.python.org/pep-0749/
   - https://docs.python.org/3/library/annotationlib.html#module-annotationlib
   
   Which summarises to:
   - For 3.14 annotations will be lazily evaluated.
   - `from __future__ import annotations` sticks around until 3.13 reaches end 
of life.
   - `from __future__ import annotations` has been around since 3.7
   
   Buildstream currently supports the following python versions: 
310,311,312,313,314
   
   Using `from __future__ import annotations` would mean a simple find and 
replace could remove it in future. Using manual quotes like this would be a lot 
of manual re-work..
   
   I think I will switch to `from __future__ import annotations` for this PR to 
reduce future work...?
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to