-
Notifications
You must be signed in to change notification settings - Fork 510
feat: plaintext support #1499
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
Open
lukastk
wants to merge
10
commits into
AnswerDotAI:main
Choose a base branch
from
lukastk:feature/plaintext-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: plaintext support #1499
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
04fb8f6
fixes #1473
deven367 3208e39
Merge branch 'master' of github.com:deven367/nbdev
deven367 9b18767
Merge pull request #1477 from deven367/master
jph00 c90b425
feat: Added support for plaintext python formats in NBProcessor
lukastk df2005b
test: Demonstration and tests of the plaintext file exporting
lukastk 5ef7892
feat: Can specify the format of the notebook in NBProcessor and nb_ex…
lukastk c7457b0
test: Test for the `fmt` argument in NBProcessor and nb_export
lukastk a235323
feat: Modified nbdev_export to export plaintext formats by default
lukastk fe26497
Merge branch 'main' into feature/plaintext-support
lukastk 6438eef
fix: Make the type notation in nbglob_cli compatible with python3.9
lukastk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
from .maker import * | ||
from .export import * | ||
from .imports import * | ||
from .process import plaintext_file_formats | ||
|
||
from fastcore.script import * | ||
from fastcore.utils import * | ||
|
@@ -116,15 +117,18 @@ def nbglob(path=None, skip_folder_re = '^[_.]', file_glob='*.ipynb', skip_file_r | |
"Find all files in a directory matching an extension given a config key." | ||
path = Path(path or get_config()[key]) | ||
recursive=get_config().recursive | ||
res = globtastic(path, file_glob=file_glob, skip_folder_re=skip_folder_re, | ||
skip_file_re=skip_file_re, recursive=recursive, **kwargs) | ||
if type(file_glob) != list: file_glob = [file_glob] | ||
res = [] | ||
for _file_glob in file_glob: | ||
res += globtastic(path, file_glob=_file_glob, skip_folder_re=skip_folder_re, | ||
skip_file_re=skip_file_re, recursive=recursive, **kwargs) | ||
return res.map(Path) if as_path else res | ||
|
||
# %% ../nbs/api/05_doclinks.ipynb | ||
def nbglob_cli( | ||
path:str=None, # Path to notebooks | ||
symlinks:bool=False, # Follow symlinks? | ||
file_glob:str='*.ipynb', # Only include files matching glob | ||
file_glob:str|List[str]=['*.ipynb'] + [f"*.{ext}" for ext in plaintext_file_formats], # Only include files matching glob | ||
file_re:str=None, # Only include files matching regex | ||
folder_re:str=None, # Only enter folders matching regex | ||
skip_file_glob:str=None, # Skip files matching glob | ||
|
@@ -138,7 +142,7 @@ def nbglob_cli( | |
@call_parse | ||
@delegates(nbglob_cli) | ||
def nbdev_export( | ||
path:str=None, # Path or filename | ||
path:str=None, # Path or filename, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like a mistake? |
||
procs:Param("tokens naming the export processors to use.", nargs="*", choices=optional_procs())="black_format", | ||
**kwargs): | ||
"Export notebooks in `path` to Python modules" | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be a list comprehension.