You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just importing repository_tool affects all of tuf logging (because it runs add_console_handler() and set_console_log_level()).
Probably because of this many tests and repo.py call some version of disable_console_log_messages().
This feels fragile and easy to accidentally misuse. I think the idea is that repository_tool.py is intended for "devops" use in an interactive python session... but then the same script is used in e.g. tests very much like a normal library.
If the interactive helper functionality is seen as important, I wonder if we should separate the use cases: keep the "library functionality" (that would not modify logging or even provide functions for doing that) and then provide a separate tool for interactive use, maybe something like this
repo_tool:
#!/bin/sh
python3 -i repo_tool_helper.py
repo_tool_helper.py
import tuf.repository_tool as repo_tool
import tuf.log
# setup tuf logging here as appropriate for this tool
now running repo_tool would give you an interactive python session with modules imported and logging setup appropriately.
The text was updated successfully, but these errors were encountered:
Closing this issue as it was filed against (what is now known as) the legacy codebase: issue seems to not be relevant anymore. Please re-open or file a new issue if you feel that the issue is revelant to current python-tuf.
More details
Current source code (and upcoming 1.0 release) only contains the modern components
a low-level Metadata API (tuf.api) and
tuf.ngclient that implements the client workflow,
Legacy components (e.g. tuf.client, tuf.repository_tool, tuf.repository_lib as well as the repo and client scripts) are no longer included. See announcement and API reference for more details.
Just importing repository_tool affects all of tuf logging (because it runs
add_console_handler()
andset_console_log_level()
).Probably because of this many tests and repo.py call some version of
disable_console_log_messages()
.This feels fragile and easy to accidentally misuse. I think the idea is that repository_tool.py is intended for "devops" use in an interactive python session... but then the same script is used in e.g. tests very much like a normal library.
If the interactive helper functionality is seen as important, I wonder if we should separate the use cases: keep the "library functionality" (that would not modify logging or even provide functions for doing that) and then provide a separate tool for interactive use, maybe something like this
repo_tool:
repo_tool_helper.py
now running
repo_tool
would give you an interactive python session with modules imported and logging setup appropriately.The text was updated successfully, but these errors were encountered: