Skip to content
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

Remove config import from init to fix scaffold usage #372

Merged
merged 3 commits into from
May 30, 2024

Conversation

pjbull
Copy link
Member

@pjbull pjbull commented May 30, 2024

  • Remove config import from __init__.py (not needed and also breaks since it is there in non-scaffold scenario)
  • Refactor some repeated code
  • Add import and import config tests
  • Add changelog

Closes #370

@pjbull pjbull requested a review from chrisjkuch May 30, 2024 15:50
@jayqi
Copy link
Member

jayqi commented May 30, 2024

not needed

The main thing that happens in config right now that is valuable to auto-execute is this bit:

# If tqdm is installed, configure loguru with tqdm.write
# https://github.com/Delgan/loguru/issues/135
try:
from tqdm import tqdm
logger.remove(0)
logger.add(lambda msg: tqdm.write(msg, end=""), colorize=True)
except ModuleNotFoundError:
pass

@pjbull
Copy link
Member Author

pjbull commented May 30, 2024

The main thing that happens in config right now that is valuable to auto-execute is this bit:

Ah, that's a good point. Added back in.

Copy link
Contributor

@chrisjkuch chrisjkuch left a comment

Choose a reason for hiding this comment

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

LGTM!

Just summarizing for my own understanding / posterity:

  • We weren't appropriately removing import config from __init__.py when we removed all the boilerplate code, which failed at import time because config.py no longer existed
  • When the boilerplate was present, we weren't importing config from the right place leading to an import error
  • We now import the config from the right place and remove it when boilerplate is removed, and we test that both of those work as expected in the live tests

@pjbull
Copy link
Member Author

pjbull commented May 30, 2024

Just summarizing for my own understanding / posterity:

Nailed it! 🔨

@pjbull pjbull merged commit df254bc into master May 30, 2024
16 checks passed
@pjbull pjbull deleted the 370-config-imports branch May 30, 2024 18:44
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.

config import fails when using V2 scaffolding
3 participants