Skip to content

fix: create singleton decorator - #100

Closed
aviatco wants to merge 17 commits into
mainfrom
dev/aviatcohen/avoidReLoginWhenSwitchingToInteractiveMode
Closed

fix: create singleton decorator#100
aviatco wants to merge 17 commits into
mainfrom
dev/aviatcohen/avoidReLoginWhenSwitchingToInteractiveMode

Conversation

@aviatco

@aviatco aviatco commented Dec 24, 2025

Copy link
Copy Markdown
Collaborator

📥 Pull Request

✨ Description of new changes

To enable reuse, refactor the singleton logic currently in fab_context into a decorator and apply that decorator within fab_interactive.

@aviatco
aviatco requested a review from a team as a code owner December 24, 2025 08:59
Comment thread src/fabric_cli/core/fab_decorators.py Outdated
instances[class_] = class_(*args, **kwargs)
return instances[class_]

# Add a reset method to the decorator function for testing purposes

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if looks like we don't use reset_instance in code, only in tests. if so, let's remove it :) if necessary we will add in the future

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use it in the tests: test_config and test_fab_interactiveCLI

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was only used in tests, so I removed it. I don’t think the code should contain test‑specific logic.

@aviatco aviatco closed this Dec 25, 2025
@ayeshurun
Alon Yeshurun (ayeshurun) deleted the dev/aviatcohen/avoidReLoginWhenSwitchingToInteractiveMode branch January 1, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants