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

test if in nbdev_repo & improve nbdev_export err message #1448

Merged
merged 5 commits into from
Sep 17, 2024
Merged

Conversation

hamelsmu
Copy link
Contributor

@hamelsmu hamelsmu commented Sep 17, 2024

@jph00 IIUC you suggested making this function public

def _nbdev_config_file(cfg_name=_nbdev_cfg_name, path=None):
    cfg_path = path = Path.cwd() if path is None else Path(path)
    while cfg_path != cfg_path.parent and not (cfg_path/cfg_name).exists(): cfg_path = cfg_path.parent
    if not (cfg_path/cfg_name).exists(): cfg_path = path
    return cfg_path/cfg_name

But you still have to check if that path exists. The way to check if nbdev exists might not be as apparent to users so maybe a simple function that helps you check (which is named appropriately) is better, given its usefulness?

Also, I improved the error message with nbdev_export

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@hamelsmu
Copy link
Contributor Author

hamelsmu commented Sep 17, 2024

maybe you just want to use nbdev_config_file().exists() directly instead?

@hamelsmu hamelsmu marked this pull request as ready for review September 17, 2024 23:21
@hamelsmu hamelsmu requested a review from jph00 September 17, 2024 23:22
@hamelsmu hamelsmu changed the title add pub func to test if in nbdev_repo test if in nbdev_repo Sep 17, 2024
@hamelsmu hamelsmu changed the title test if in nbdev_repo test if in nbdev_repo & improve nbdev_export err message Sep 17, 2024
@jph00
Copy link
Contributor

jph00 commented Sep 17, 2024

Looks like CI problems @hamelsmu ! :D

@jph00
Copy link
Contributor

jph00 commented Sep 17, 2024

@hamelsmu did you want to mark this draft, or is it ready?

if procs:
import nbdev.export
procs = [getattr(nbdev.export, p) for p in L(procs)]
import nbdev.export
Copy link
Contributor Author

Choose a reason for hiding this comment

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

My jupyter notebook got angry with the indentation here. So I fixed it FYI

@hamelsmu
Copy link
Contributor Author

@jph00 it is ready now 😄

@jph00 jph00 merged commit b95cd3e into master Sep 17, 2024
8 checks passed
@jph00 jph00 deleted the is_nbdev branch September 17, 2024 23:45
@jph00 jph00 added the enhancement New feature or request label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants