Skip to content

Commit a278b26

Browse files
committed
Import default nox sessions by default
Since now we are not importing the modules into the packages, just by doing: ```py from frequenz.repo.config import nox from frequenz.repo.config.nox import default nox.configure(default.actor_config) ``` The `frequenz.repo.config.nox.session` module won't be imported, so the default sessions will not be loaded by `nox`. Now `configure()` will import this module internally unless the new option `import_default_sessions` is set to `False`. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent e8beb6b commit a278b26

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/frequenz/repo/config/nox/config.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,19 @@ def get() -> Config:
177177
return _config
178178

179179

180-
def configure(conf: Config, /) -> None:
180+
def configure(conf: Config, /, *, import_default_sessions: bool = True) -> None:
181181
"""Configure nox using the provided configuration.
182182
183183
Args:
184184
conf: The configuration to use to configure nox.
185+
import_default_sessions: Whether to import the default sessions or not.
186+
This is only necessary if you want to avoid using the default provided
187+
sessions and use your own.
185188
"""
189+
# We need to make sure sessions are imported, otherwise they won't be visible to nox.
190+
if import_default_sessions:
191+
# pylint: disable=import-outside-toplevel,cyclic-import
192+
from . import session as _
186193
global _config # pylint: disable=global-statement
187194
_config = conf
188195
_nox.options.sessions = _config.sessions

0 commit comments

Comments
 (0)