Skip to content

Refactor Agent to Eliminate Global Variables and Enhance Readability #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Repsay
Copy link

@Repsay Repsay commented Apr 7, 2025

This pull request introduces a comprehensive refactor of the hashtopolis/agent-python codebase with the following objectives:

  • Elimination of Global Variables: Transitioned from using global variables to encapsulating functionality within an Agent class. This approach enhances modularity and maintainability.
  • Codebase Simplification: Streamlined various components to reduce complexity, resulting in cleaner and more efficient code.
  • Improved Readability: Reorganized and reformatted code to adhere to consistent style guidelines, making it more readable and easier to navigate.

Given the interdependencies among these changes, separating them into distinct pull requests would require significant additional effort. Therefore, they are consolidated here to maintain coherence and ensure stability.

This refactor lays the groundwork for future enhancements and facilitates easier maintenance. Developers are encouraged to review the changes thoroughly and provide feedback or raise concerns as necessary.

Repsay added 3 commits April 7, 2025 13:22
Rewritten the codebase to not work with global variables. Use Agent class. Simplify codebase and readability.
…ing when base file is found (missing .7z for example).
@gluafamichl
Copy link

We tried to get your code running, but there seems to be a problem with the conditional imports for typing. Without typing checks, Agent is always undefined when trying to start.
Could you please check this?

…ations. Due to circular imports, Agent cannot be imported to the submodules.
@Repsay
Copy link
Author

Repsay commented May 19, 2025

@gluafamichl I just pushed an update. The Agent cannot be imported directly as that would result into circular imports. Due to this I had it imported via TYPE_CHECKING, but that didn't seem to work. Now I removed the Agent from the submodules and replaced with Any. This results in less obvious use-ability in the IDE but will make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants