nbdevAuto 0.3.26__tar.gz → 0.3.61__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {nbdevauto-0.3.26 → nbdevauto-0.3.61}/MANIFEST.in +0 -2
  2. nbdevauto-0.3.61/PKG-INFO +134 -0
  3. nbdevauto-0.3.61/README.md +105 -0
  4. nbdevauto-0.3.61/nbdevAuto/__init__.py +1 -0
  5. {nbdevauto-0.3.26 → nbdevauto-0.3.61}/nbdevAuto/_modidx.py +30 -1
  6. {nbdevauto-0.3.26 → nbdevauto-0.3.61}/nbdevAuto/automate.py +18 -14
  7. {nbdevauto-0.3.26 → nbdevauto-0.3.61}/nbdevAuto/functions.py +18 -14
  8. nbdevauto-0.3.61/nbdevAuto/github.py +380 -0
  9. {nbdevauto-0.3.26 → nbdevauto-0.3.61}/nbdevAuto/pdf.py +6 -2
  10. nbdevauto-0.3.61/nbdevAuto.egg-info/PKG-INFO +134 -0
  11. {nbdevauto-0.3.26 → nbdevauto-0.3.61}/nbdevAuto.egg-info/SOURCES.txt +2 -3
  12. {nbdevauto-0.3.26 → nbdevauto-0.3.61}/nbdevAuto.egg-info/entry_points.txt +1 -0
  13. nbdevauto-0.3.61/nbdevAuto.egg-info/requires.txt +5 -0
  14. nbdevauto-0.3.61/pyproject.toml +67 -0
  15. nbdevauto-0.3.26/PKG-INFO +0 -29
  16. nbdevauto-0.3.26/README.md +0 -6
  17. nbdevauto-0.3.26/nbdevAuto/__init__.py +0 -1
  18. nbdevauto-0.3.26/nbdevAuto.egg-info/PKG-INFO +0 -29
  19. nbdevauto-0.3.26/nbdevAuto.egg-info/not-zip-safe +0 -1
  20. nbdevauto-0.3.26/nbdevAuto.egg-info/requires.txt +0 -3
  21. nbdevauto-0.3.26/settings.ini +0 -58
  22. nbdevauto-0.3.26/setup.py +0 -57
  23. {nbdevauto-0.3.26 → nbdevauto-0.3.61}/LICENSE +0 -0
  24. {nbdevauto-0.3.26 → nbdevauto-0.3.61}/nbdevAuto/core.py +0 -0
  25. {nbdevauto-0.3.26 → nbdevauto-0.3.61}/nbdevAuto.egg-info/dependency_links.txt +0 -0
  26. {nbdevauto-0.3.26 → nbdevauto-0.3.61}/nbdevAuto.egg-info/top_level.txt +0 -0
  27. {nbdevauto-0.3.26 → nbdevauto-0.3.61}/setup.cfg +0 -0
@@ -1,5 +1,3 @@
1
- include settings.ini
2
1
  include LICENSE
3
- include CONTRIBUTING.md
4
2
  include README.md
5
3
  recursive-exclude * __pycache__
@@ -0,0 +1,134 @@
1
+ Metadata-Version: 2.4
2
+ Name: nbdevAuto
3
+ Version: 0.3.61
4
+ Summary: automating nbdev
5
+ Author-email: Benedict Thekkel <bthekkel1@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Repository, https://github.com/bthek1/nbdevAuto
8
+ Project-URL: Documentation, https://bthek1.github.io/nbdevAuto
9
+ Project-URL: Issues, https://github.com/bthek1/nbdevAuto/issues
10
+ Keywords: nbdev,jupyter,notebook,python
11
+ Classifier: Natural Language :: English
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: graphviz
25
+ Requires-Dist: fastcore
26
+ Provides-Extra: gh
27
+ Requires-Dist: githubkit>=0.12; extra == "gh"
28
+ Dynamic: license-file
29
+
30
+ # nbdevAuto
31
+
32
+
33
+ <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
34
+
35
+ Unlike most sites in this collection, this one documents an
36
+ **installable library** rather than a topic. `nbdevAuto` exists because
37
+ the nbdev release cycle is a fixed sequence of commands typed in the
38
+ same order every time: export the notebooks, run the tests, clean them,
39
+ bump the version, commit, push, build the docs. Each step is one nbdev
40
+ call, and forgetting one produces a confusing failure two steps later.
41
+
42
+ The library collapses that sequence into single-word shell commands. It
43
+ is what `just upload` and `just full_upload` invoke under the hood for
44
+ every submodule in the parent Knowledge repo.
45
+
46
+ ------------------------------------------------------------------------
47
+
48
+ ## Install
49
+
50
+ ``` sh
51
+ pip install nbdevAuto
52
+ ```
53
+
54
+ ## Use
55
+
56
+ Every exported function is also a console script, so the common case is
57
+ a bare word in the terminal at the root of an nbdev project:
58
+
59
+ ``` sh
60
+ upload -m "commit message" # export, test, clean, then add/commit/push
61
+ ```
62
+
63
+ Or import the helpers into a notebook:
64
+
65
+ ``` python
66
+ from nbdevAuto.functions import download_search_images, classify_images
67
+ from nbdevAuto.pdf import PDFreader
68
+ ```
69
+
70
+ ------------------------------------------------------------------------
71
+
72
+ ## Contents
73
+
74
+ | Page | Covers |
75
+ |----|----|
76
+ | [Functions](00_Functions.ipynb) | Dataset and image helpers: reading a list out of a text file, downloading single images or whole search-driven datasets, verifying and resizing what came back, building the folder layout a classifier expects, running a fastai learner over one image, Kaggle competition and dataset shortcuts, and [`graph`](https://bthek1.github.io/nbdevAuto/functions.html#graph), a `graphviz.Digraph` subclass preloaded with a rounded, filled style |
77
+ | [Automate](01_Automate.ipynb) | The command line surface: the prep/commit/push pipeline, GitHub and PyPI releases, reinstall and update, conda environment creation, and the help output that lists them all |
78
+ | [PDF Reader](02_PDF_reader.ipynb) | [`PDFreader`](https://bthek1.github.io/nbdevAuto/pdf_reader.html#pdfreader), a class that converts a PDF through `pdf2image` and renders page ranges inline when you slice it (`pdf[0:5]`) |
79
+
80
+ ------------------------------------------------------------------------
81
+
82
+ ## The Command Line Surface
83
+
84
+ Installing the package puts these on your `PATH`. They are ordinary
85
+ functions in [Automate](01_Automate.ipynb), exposed as scripts through
86
+ `[project.scripts]`.
87
+
88
+ | Command | Does |
89
+ |----|----|
90
+ | [`prep`](https://bthek1.github.io/nbdevAuto/automate.html#prep) | Export, test, and clean the notebooks, rendering the README if it needs it |
91
+ | [`gacp`](https://bthek1.github.io/nbdevAuto/automate.html#gacp) | git add, commit, and push, with `-m` for the message |
92
+ | [`status`](https://bthek1.github.io/nbdevAuto/automate.html#status) | Show the working tree state |
93
+ | [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) | [`prep`](https://bthek1.github.io/nbdevAuto/automate.html#prep) then [`gacp`](https://bthek1.github.io/nbdevAuto/automate.html#gacp), the one you actually type |
94
+ | [`release`](https://bthek1.github.io/nbdevAuto/automate.html#release) | Bump the version, then release to both GitHub and PyPI |
95
+ | `gitrelease` / `piprelease` | The two halves of [`release`](https://bthek1.github.io/nbdevAuto/automate.html#release), separately |
96
+ | [`reinstall`](https://bthek1.github.io/nbdevAuto/automate.html#reinstall) / [`update`](https://bthek1.github.io/nbdevAuto/automate.html#update) | Reinstall or update the package locally |
97
+ | [`everything`](https://bthek1.github.io/nbdevAuto/automate.html#everything) | [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload), [`update`](https://bthek1.github.io/nbdevAuto/automate.html#update), [`release`](https://bthek1.github.io/nbdevAuto/automate.html#release), [`reinstall`](https://bthek1.github.io/nbdevAuto/automate.html#reinstall), in that order |
98
+ | [`create_env`](https://bthek1.github.io/nbdevAuto/automate.html#create_env) | Create a conda environment for AI work, named `fast` by default |
99
+ | `h` | Print the list of available commands |
100
+
101
+ Both [`prep`](https://bthek1.github.io/nbdevAuto/automate.html#prep) and
102
+ [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) take
103
+ `-p` to choose which version part to increment.
104
+
105
+ ------------------------------------------------------------------------
106
+
107
+ ## Where It Is Used
108
+
109
+ The parent Knowledge repo’s `justfile` calls
110
+ [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) once
111
+ per submodule. `just upload` runs it only where the working tree is
112
+ dirty, `just full_upload` runs it everywhere. That is the main consumer,
113
+ so a change to `automate.py` affects the publish path for every site in
114
+ the collection.
115
+
116
+ ------------------------------------------------------------------------
117
+
118
+ ## Not Covered Yet
119
+
120
+ - **No test notebook.** The functions are exercised only by being used,
121
+ so a broken helper surfaces in a downstream repo rather than here.
122
+ - **Undeclared dependencies.** `pyproject.toml` lists only `graphviz`,
123
+ but the image helpers import `fastai`, the Kaggle shortcuts need the
124
+ Kaggle CLI and its credentials, and
125
+ [`PDFreader`](https://bthek1.github.io/nbdevAuto/pdf_reader.html#pdfreader)
126
+ needs `pdf2image` with poppler behind it, plus matplotlib. Install
127
+ those yourself.
128
+ - **`core.py` is an empty nbdev stub** (a single
129
+ [`foo`](https://bthek1.github.io/nbdevAuto/core.html#foo)), with no
130
+ notebook behind it.
131
+ - The docstrings are one-liners, so the rendered API pages are thin. The
132
+ notebooks carry the real explanation.
133
+
134
+ ------------------------------------------------------------------------
@@ -0,0 +1,105 @@
1
+ # nbdevAuto
2
+
3
+
4
+ <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
5
+
6
+ Unlike most sites in this collection, this one documents an
7
+ **installable library** rather than a topic. `nbdevAuto` exists because
8
+ the nbdev release cycle is a fixed sequence of commands typed in the
9
+ same order every time: export the notebooks, run the tests, clean them,
10
+ bump the version, commit, push, build the docs. Each step is one nbdev
11
+ call, and forgetting one produces a confusing failure two steps later.
12
+
13
+ The library collapses that sequence into single-word shell commands. It
14
+ is what `just upload` and `just full_upload` invoke under the hood for
15
+ every submodule in the parent Knowledge repo.
16
+
17
+ ------------------------------------------------------------------------
18
+
19
+ ## Install
20
+
21
+ ``` sh
22
+ pip install nbdevAuto
23
+ ```
24
+
25
+ ## Use
26
+
27
+ Every exported function is also a console script, so the common case is
28
+ a bare word in the terminal at the root of an nbdev project:
29
+
30
+ ``` sh
31
+ upload -m "commit message" # export, test, clean, then add/commit/push
32
+ ```
33
+
34
+ Or import the helpers into a notebook:
35
+
36
+ ``` python
37
+ from nbdevAuto.functions import download_search_images, classify_images
38
+ from nbdevAuto.pdf import PDFreader
39
+ ```
40
+
41
+ ------------------------------------------------------------------------
42
+
43
+ ## Contents
44
+
45
+ | Page | Covers |
46
+ |----|----|
47
+ | [Functions](00_Functions.ipynb) | Dataset and image helpers: reading a list out of a text file, downloading single images or whole search-driven datasets, verifying and resizing what came back, building the folder layout a classifier expects, running a fastai learner over one image, Kaggle competition and dataset shortcuts, and [`graph`](https://bthek1.github.io/nbdevAuto/functions.html#graph), a `graphviz.Digraph` subclass preloaded with a rounded, filled style |
48
+ | [Automate](01_Automate.ipynb) | The command line surface: the prep/commit/push pipeline, GitHub and PyPI releases, reinstall and update, conda environment creation, and the help output that lists them all |
49
+ | [PDF Reader](02_PDF_reader.ipynb) | [`PDFreader`](https://bthek1.github.io/nbdevAuto/pdf_reader.html#pdfreader), a class that converts a PDF through `pdf2image` and renders page ranges inline when you slice it (`pdf[0:5]`) |
50
+
51
+ ------------------------------------------------------------------------
52
+
53
+ ## The Command Line Surface
54
+
55
+ Installing the package puts these on your `PATH`. They are ordinary
56
+ functions in [Automate](01_Automate.ipynb), exposed as scripts through
57
+ `[project.scripts]`.
58
+
59
+ | Command | Does |
60
+ |----|----|
61
+ | [`prep`](https://bthek1.github.io/nbdevAuto/automate.html#prep) | Export, test, and clean the notebooks, rendering the README if it needs it |
62
+ | [`gacp`](https://bthek1.github.io/nbdevAuto/automate.html#gacp) | git add, commit, and push, with `-m` for the message |
63
+ | [`status`](https://bthek1.github.io/nbdevAuto/automate.html#status) | Show the working tree state |
64
+ | [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) | [`prep`](https://bthek1.github.io/nbdevAuto/automate.html#prep) then [`gacp`](https://bthek1.github.io/nbdevAuto/automate.html#gacp), the one you actually type |
65
+ | [`release`](https://bthek1.github.io/nbdevAuto/automate.html#release) | Bump the version, then release to both GitHub and PyPI |
66
+ | `gitrelease` / `piprelease` | The two halves of [`release`](https://bthek1.github.io/nbdevAuto/automate.html#release), separately |
67
+ | [`reinstall`](https://bthek1.github.io/nbdevAuto/automate.html#reinstall) / [`update`](https://bthek1.github.io/nbdevAuto/automate.html#update) | Reinstall or update the package locally |
68
+ | [`everything`](https://bthek1.github.io/nbdevAuto/automate.html#everything) | [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload), [`update`](https://bthek1.github.io/nbdevAuto/automate.html#update), [`release`](https://bthek1.github.io/nbdevAuto/automate.html#release), [`reinstall`](https://bthek1.github.io/nbdevAuto/automate.html#reinstall), in that order |
69
+ | [`create_env`](https://bthek1.github.io/nbdevAuto/automate.html#create_env) | Create a conda environment for AI work, named `fast` by default |
70
+ | `h` | Print the list of available commands |
71
+
72
+ Both [`prep`](https://bthek1.github.io/nbdevAuto/automate.html#prep) and
73
+ [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) take
74
+ `-p` to choose which version part to increment.
75
+
76
+ ------------------------------------------------------------------------
77
+
78
+ ## Where It Is Used
79
+
80
+ The parent Knowledge repo’s `justfile` calls
81
+ [`upload`](https://bthek1.github.io/nbdevAuto/automate.html#upload) once
82
+ per submodule. `just upload` runs it only where the working tree is
83
+ dirty, `just full_upload` runs it everywhere. That is the main consumer,
84
+ so a change to `automate.py` affects the publish path for every site in
85
+ the collection.
86
+
87
+ ------------------------------------------------------------------------
88
+
89
+ ## Not Covered Yet
90
+
91
+ - **No test notebook.** The functions are exercised only by being used,
92
+ so a broken helper surfaces in a downstream repo rather than here.
93
+ - **Undeclared dependencies.** `pyproject.toml` lists only `graphviz`,
94
+ but the image helpers import `fastai`, the Kaggle shortcuts need the
95
+ Kaggle CLI and its credentials, and
96
+ [`PDFreader`](https://bthek1.github.io/nbdevAuto/pdf_reader.html#pdfreader)
97
+ needs `pdf2image` with poppler behind it, plus matplotlib. Install
98
+ those yourself.
99
+ - **`core.py` is an empty nbdev stub** (a single
100
+ [`foo`](https://bthek1.github.io/nbdevAuto/core.html#foo)), with no
101
+ notebook behind it.
102
+ - The docstrings are one-liners, so the rendered API pages are thin. The
103
+ notebooks carry the real explanation.
104
+
105
+ ------------------------------------------------------------------------
@@ -0,0 +1 @@
1
+ __version__ = "0.3.61"
@@ -18,7 +18,6 @@ d = { 'settings': { 'branch': 'main',
18
18
  'nbdevAuto.automate.status': ('automate.html#status', 'nbdevAuto/automate.py'),
19
19
  'nbdevAuto.automate.update': ('automate.html#update', 'nbdevAuto/automate.py'),
20
20
  'nbdevAuto.automate.upload': ('automate.html#upload', 'nbdevAuto/automate.py')},
21
- 'nbdevAuto.core': {'nbdevAuto.core.foo': ('core.html#foo', 'nbdevAuto/core.py')},
22
21
  'nbdevAuto.functions': { 'nbdevAuto.functions.classify_images': ('functions.html#classify_images', 'nbdevAuto/functions.py'),
23
22
  'nbdevAuto.functions.create_data_folder': ( 'functions.html#create_data_folder',
24
23
  'nbdevAuto/functions.py'),
@@ -38,6 +37,36 @@ d = { 'settings': { 'branch': 'main',
38
37
  'nbdevAuto.functions.read_from_file': ('functions.html#read_from_file', 'nbdevAuto/functions.py'),
39
38
  'nbdevAuto.functions.resize_pics': ('functions.html#resize_pics', 'nbdevAuto/functions.py'),
40
39
  'nbdevAuto.functions.verify_pics': ('functions.html#verify_pics', 'nbdevAuto/functions.py')},
40
+ 'nbdevAuto.github': { 'nbdevAuto.github._gitmodules_kv': ('github.html#_gitmodules_kv', 'nbdevAuto/github.py'),
41
+ 'nbdevAuto.github._have': ('github.html#_have', 'nbdevAuto/github.py'),
42
+ 'nbdevAuto.github._latest_run': ('github.html#_latest_run', 'nbdevAuto/github.py'),
43
+ 'nbdevAuto.github._missing': ('github.html#_missing', 'nbdevAuto/github.py'),
44
+ 'nbdevAuto.github._pages_build': ('github.html#_pages_build', 'nbdevAuto/github.py'),
45
+ 'nbdevAuto.github._remote_sha': ('github.html#_remote_sha', 'nbdevAuto/github.py'),
46
+ 'nbdevAuto.github._state': ('github.html#_state', 'nbdevAuto/github.py'),
47
+ 'nbdevAuto.github._wrap': ('github.html#_wrap', 'nbdevAuto/github.py'),
48
+ 'nbdevAuto.github.add_local': ('github.html#add_local', 'nbdevAuto/github.py'),
49
+ 'nbdevAuto.github.ahead_behind': ('github.html#ahead_behind', 'nbdevAuto/github.py'),
50
+ 'nbdevAuto.github.api_error': ('github.html#api_error', 'nbdevAuto/github.py'),
51
+ 'nbdevAuto.github.audit_result': ('github.html#audit_result', 'nbdevAuto/github.py'),
52
+ 'nbdevAuto.github.failures': ('github.html#failures', 'nbdevAuto/github.py'),
53
+ 'nbdevAuto.github.find_root': ('github.html#find_root', 'nbdevAuto/github.py'),
54
+ 'nbdevAuto.github.format_audit': ('github.html#format_audit', 'nbdevAuto/github.py'),
55
+ 'nbdevAuto.github.format_report': ('github.html#format_report', 'nbdevAuto/github.py'),
56
+ 'nbdevAuto.github.format_table': ('github.html#format_table', 'nbdevAuto/github.py'),
57
+ 'nbdevAuto.github.gather_audit': ('github.html#gather_audit', 'nbdevAuto/github.py'),
58
+ 'nbdevAuto.github.gather_status': ('github.html#gather_status', 'nbdevAuto/github.py'),
59
+ 'nbdevAuto.github.ghstatus': ('github.html#ghstatus', 'nbdevAuto/github.py'),
60
+ 'nbdevAuto.github.git': ('github.html#git', 'nbdevAuto/github.py'),
61
+ 'nbdevAuto.github.has_failure': ('github.html#has_failure', 'nbdevAuto/github.py'),
62
+ 'nbdevAuto.github.local_sha': ('github.html#local_sha', 'nbdevAuto/github.py'),
63
+ 'nbdevAuto.github.local_state': ('github.html#local_state', 'nbdevAuto/github.py'),
64
+ 'nbdevAuto.github.owned_repos': ('github.html#owned_repos', 'nbdevAuto/github.py'),
65
+ 'nbdevAuto.github.parse_gitmodules': ('github.html#parse_gitmodules', 'nbdevAuto/github.py'),
66
+ 'nbdevAuto.github.repo_status': ('github.html#repo_status', 'nbdevAuto/github.py'),
67
+ 'nbdevAuto.github.resolve_token': ('github.html#resolve_token', 'nbdevAuto/github.py'),
68
+ 'nbdevAuto.github.self_repo': ('github.html#self_repo', 'nbdevAuto/github.py'),
69
+ 'nbdevAuto.github.stale_sections': ('github.html#stale_sections', 'nbdevAuto/github.py')},
41
70
  'nbdevAuto.pdf': { 'nbdevAuto.pdf.PDFreader': ('pdf_reader.html#pdfreader', 'nbdevAuto/pdf.py'),
42
71
  'nbdevAuto.pdf.PDFreader.__call__': ('pdf_reader.html#pdfreader.__call__', 'nbdevAuto/pdf.py'),
43
72
  'nbdevAuto.pdf.PDFreader.__getitem__': ('pdf_reader.html#pdfreader.__getitem__', 'nbdevAuto/pdf.py'),
@@ -1,10 +1,14 @@
1
+ """Automate
2
+
3
+ Docs: https://bthek1.github.io/nbdevAuto/automate.html.md"""
4
+
1
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/01_Automate.ipynb.
2
6
 
3
- # %% auto 0
7
+ # %% auto #0
4
8
  __all__ = ['prep', 'gacp', 'status', 'upload', 'reinstall', 'update', 'release_git', 'release_pypi', 'release', 'help_output',
5
9
  'everything', 'create_env', 'hello']
6
10
 
7
- # %% ../nbs/01_Automate.ipynb 6
11
+ # %% ../nbs/01_Automate.ipynb #6d1499d1-aa55-47d8-92fd-fa056b1fb135
8
12
  from fastcore.script import *
9
13
 
10
14
  @call_parse
@@ -30,7 +34,7 @@ def prep(
30
34
  nbdev.quarto.nbdev_readme.__wrapped__(chk_time=True)
31
35
  print(f'### nbdev_readme finished ###')
32
36
 
33
- # %% ../nbs/01_Automate.ipynb 7
37
+ # %% ../nbs/01_Automate.ipynb #f66ef35f-b7fa-4039-aa07-e9b782d204bb
34
38
  @call_parse
35
39
  def gacp(
36
40
  m:str = '', # Commit message
@@ -52,13 +56,13 @@ def gacp(
52
56
  subprocess.run(["git", "push"])
53
57
  print(f'### git pushed ###')
54
58
 
55
- # %% ../nbs/01_Automate.ipynb 8
59
+ # %% ../nbs/01_Automate.ipynb #88017a1b-55c1-4833-aeb6-277a7e5b6314
56
60
  def status():
57
61
  "git status"
58
62
  import subprocess
59
63
  subprocess.run(["git", "status"])
60
64
 
61
- # %% ../nbs/01_Automate.ipynb 9
65
+ # %% ../nbs/01_Automate.ipynb #8d777a41-0160-47f8-b51c-b14360b62da4
62
66
  @call_parse
63
67
  def upload(
64
68
  m:str = '', # Commit message
@@ -68,51 +72,51 @@ def upload(
68
72
  prep(p)
69
73
  gacp(m)
70
74
 
71
- # %% ../nbs/01_Automate.ipynb 10
75
+ # %% ../nbs/01_Automate.ipynb #0f096fc0-0e97-4592-975f-e81e583b2adb
72
76
  def reinstall():
73
77
  "runs pip install -e ."
74
78
  import subprocess
75
79
  subprocess.run(["pip", "install", "-e", "."])
76
80
 
77
- # %% ../nbs/01_Automate.ipynb 11
81
+ # %% ../nbs/01_Automate.ipynb #fa41bc21-ba9f-4097-8c70-4fc1404d325c
78
82
  def update():
79
83
  "prep, then reinstall"
80
84
  prep()
81
85
  reinstall()
82
86
 
83
- # %% ../nbs/01_Automate.ipynb 13
87
+ # %% ../nbs/01_Automate.ipynb #dee37b06-c946-4b40-be0f-056e133751ea
84
88
  def release_git():
85
89
  "release to git"
86
90
  import nbdev.release
87
91
  nbdev.release.nbdev_bump_version(1)
88
92
  nbdev.release.release_git()
89
93
 
90
- # %% ../nbs/01_Automate.ipynb 14
94
+ # %% ../nbs/01_Automate.ipynb #288708c6-194a-4059-9ff0-ae330079c199
91
95
  def release_pypi():
92
96
  "release to pypi"
93
97
  import nbdev.release
94
98
  nbdev.release.release_pypi()
95
99
 
96
- # %% ../nbs/01_Automate.ipynb 15
100
+ # %% ../nbs/01_Automate.ipynb #dd798178-9d58-457e-969a-d86a5e8bf875
97
101
  def release():
98
102
  "release to github and pip"
99
103
  release_git()
100
104
  release_pypi()
101
105
 
102
- # %% ../nbs/01_Automate.ipynb 18
106
+ # %% ../nbs/01_Automate.ipynb #c4d2bd52-04c4-43fe-890b-b4cb5da8d206
103
107
  def help_output():
104
108
  "Show help for all console scripts"
105
109
  from fastcore.xtras import console_help
106
110
  console_help('nbdevAuto')
107
111
 
108
- # %% ../nbs/01_Automate.ipynb 20
112
+ # %% ../nbs/01_Automate.ipynb #3606bcc9-57b1-42e7-842a-5c889485cf88
109
113
  def everything():
110
114
  "prep, gacp, release, reinstall"
111
115
  upload()
112
116
  update()
113
117
  release()
114
118
 
115
- # %% ../nbs/01_Automate.ipynb 22
119
+ # %% ../nbs/01_Automate.ipynb #8ca135ed-6377-4da1-98e8-fdab288921fb
116
120
  @call_parse
117
121
  def create_env(
118
122
  n:str = 'fast', #Name of the environment
@@ -127,7 +131,7 @@ def create_env(
127
131
  # subprocess.run(["pip", "install", "fastai", "fastcore"])
128
132
 
129
133
 
130
- # %% ../nbs/01_Automate.ipynb 23
134
+ # %% ../nbs/01_Automate.ipynb #16615f52-30f8-4a42-8d73-52355f2c574a
131
135
  def hello():
132
136
  import argparse
133
137
  parser = argparse.ArgumentParser(description='My CLI function.')
@@ -1,11 +1,15 @@
1
+ """Useful functions
2
+
3
+ Docs: https://bthek1.github.io/nbdevAuto/functions.html.md"""
4
+
1
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_Functions.ipynb.
2
6
 
3
- # %% auto 0
7
+ # %% auto #0
4
8
  __all__ = ['read_from_file', 'download_pic', 'create_searches_folder', 'download_search_image', 'download_search_images',
5
9
  'verify_pics', 'resize_pics', 'create_data_folder', 'classify_images', 'kaggle_competition_download',
6
10
  'kaggle_dataset_download', 'graph']
7
11
 
8
- # %% ../nbs/00_Functions.ipynb 5
12
+ # %% ../nbs/00_Functions.ipynb #85afb2c0-5023-4bcb-858b-e29057b63158
9
13
  def read_from_file(file_path):
10
14
  from fastbook import search_images_ddg
11
15
  from fastdownload import download_url
@@ -22,7 +26,7 @@ def read_from_file(file_path):
22
26
 
23
27
  return countries
24
28
 
25
- # %% ../nbs/00_Functions.ipynb 7
29
+ # %% ../nbs/00_Functions.ipynb #463b602d-cc71-416e-89f5-1d6adfaedf67
26
30
  def download_pic(
27
31
  image:str, #image description
28
32
  n_images:int=1,
@@ -77,7 +81,7 @@ def download_pic(
77
81
 
78
82
  return Image.open(image_path).to_thumb(256,256)
79
83
 
80
- # %% ../nbs/00_Functions.ipynb 10
84
+ # %% ../nbs/00_Functions.ipynb #8500fd62-6460-4419-8720-af3d4cf6ac6e
81
85
  def create_searches_folder(folder_path, searches, show_progress:bool=False):
82
86
  from tqdm.notebook import tqdm
83
87
  print("Create folder")
@@ -86,7 +90,7 @@ def create_searches_folder(folder_path, searches, show_progress:bool=False):
86
90
  dest.mkdir(exist_ok=True, parents=True)
87
91
  if show_progress == True: print(f'created {i} folder')
88
92
 
89
- # %% ../nbs/00_Functions.ipynb 11
93
+ # %% ../nbs/00_Functions.ipynb #4fec0420-ac17-4ec5-ab5d-c491eeb3dc41
90
94
  def download_search_image(folder_path,
91
95
  item,
92
96
  before,
@@ -116,7 +120,7 @@ def download_search_image(folder_path,
116
120
 
117
121
 
118
122
 
119
- # %% ../nbs/00_Functions.ipynb 12
123
+ # %% ../nbs/00_Functions.ipynb #8b911135-20e5-44ba-b016-e7d1667706a1
120
124
  def download_search_images(folder_path,
121
125
  searches,
122
126
  before,
@@ -131,7 +135,7 @@ def download_search_images(folder_path,
131
135
 
132
136
 
133
137
 
134
- # %% ../nbs/00_Functions.ipynb 13
138
+ # %% ../nbs/00_Functions.ipynb #a0c904d2-7f9b-42dd-a54c-037b430f7857
135
139
  def verify_pics(folder_path,
136
140
  ):
137
141
  from fastai.vision.all import verify_images, get_image_files
@@ -142,7 +146,7 @@ def verify_pics(folder_path,
142
146
  failed.map(Path.unlink)
143
147
  print(f"Number of images failed: {len(failed)}")
144
148
 
145
- # %% ../nbs/00_Functions.ipynb 14
149
+ # %% ../nbs/00_Functions.ipynb #f3db75e4-0ee5-46ff-9f99-f1cfa49b059b
146
150
  def resize_pics(folder_path,
147
151
  searches,
148
152
  max_size=400,
@@ -160,7 +164,7 @@ def resize_pics(folder_path,
160
164
  )
161
165
  if show == True: print(f"resizing images for: {k}")
162
166
 
163
- # %% ../nbs/00_Functions.ipynb 15
167
+ # %% ../nbs/00_Functions.ipynb #dc9ea14d-375f-4c64-a4ba-ab1aef29f575
164
168
  def create_data_folder(
165
169
  folder_path:str,
166
170
  searches:tuple,
@@ -200,7 +204,7 @@ def create_data_folder(
200
204
 
201
205
 
202
206
 
203
- # %% ../nbs/00_Functions.ipynb 18
207
+ # %% ../nbs/00_Functions.ipynb #c3720a92-eccc-425b-a319-4da71275812b
204
208
  def classify_images(learn, img):
205
209
  'image classifer'
206
210
  from fastai.vision.all import PILImage
@@ -210,7 +214,7 @@ def classify_images(learn, img):
210
214
  rounded_probs = [round(float(prob*100), 5) for prob in probs]
211
215
  return dict(zip(categories, rounded_probs))
212
216
 
213
- # %% ../nbs/00_Functions.ipynb 20
217
+ # %% ../nbs/00_Functions.ipynb #074ae456-8b23-4730-aa4a-decc66a6a4f4
214
218
  def kaggle_competition_download(name:str, folderpath:str = './Data'):
215
219
  'download competition files from kaggle'
216
220
  import os
@@ -228,7 +232,7 @@ def kaggle_competition_download(name:str, folderpath:str = './Data'):
228
232
  kaggle.api.competition_download_cli(competition = name, path = path)
229
233
  zipfile.ZipFile(f'{path}/{name}.zip').extractall(path)
230
234
 
231
- # %% ../nbs/00_Functions.ipynb 21
235
+ # %% ../nbs/00_Functions.ipynb #bbdd0646-c994-4562-9f38-8413cca1a605
232
236
  def kaggle_dataset_download(user:str,
233
237
  name:str,
234
238
  folderpath:str = './Data'):
@@ -247,10 +251,10 @@ def kaggle_dataset_download(user:str,
247
251
  kaggle.api.dataset_download_files(dataset = f'{user}/{name}', path = path)
248
252
  zipfile.ZipFile(f'{path}/{name}.zip').extractall(path)
249
253
 
250
- # %% ../nbs/00_Functions.ipynb 23
254
+ # %% ../nbs/00_Functions.ipynb #bafdec57-812c-40e6-b6c5-5e19f7f7015e
251
255
  from graphviz import Digraph
252
256
 
253
- # %% ../nbs/00_Functions.ipynb 24
257
+ # %% ../nbs/00_Functions.ipynb #55dd758b-f205-4c59-9d76-ce528a23060a
254
258
  class graph(Digraph):
255
259
  def __init__(self, *args, **kwargs):
256
260
  # Call the superclass's __init__ method using super() and pass all arguments