I am exploring the source on _mk_param and use_kwargs_dic of fastcore, and like the idea of forcing Parameter to change kind from POSITIONAL_OR_KEYWORD to KEYWORD_ONLY. I think this may help to solve a tiny problem of fastcore.meta.delegates I noticed when exploring it.
The problem is presented in the first image below, and the solution learnt from _mk_param and use_kwargs_dict is in the second image.
Thanks for the sharing! They seem very helpful. I will look into them later.
At the moment, my nbdev project is broken and I can’t update the site for you to read the experiment I was doing. I will update the link here as soon as I fix it.
I have pushed a PR, and I realised I need to make a few more changes to make the PR right
I need to change my current python 3.9 to become fastcore’s python>=3.7
remove the table of content of 07_meta.ipynb
Besides nbdev_prepare and nbdev_preview, should I run the 07_meta.ipynb to update all the outputs? When I check the PR for difference, there are many other files have been changed as a result, should I be worried about them?
How to setup base environment and install fastai with python>=3.7?
The steps I took to setup everything are:
0. remove mambaforge folder
bash Mambaforge-*.sh -b and ~/mambaforge/bin/conda init $SHELL_NAME
mamba install -c fastchan fastai
Note: up to this point, the python is version 3.9 in base env and 3.7 in ipython, and fastai is not available in ipython
mamba install jupyter
Note: up to this point, the python is version 3.9 in ipython too, and fastai is available in ipython
mamba install -c fastai nbdev
pip install jupyter_contrib_nbextensions
How do I get my python version to 3.7 for fastai and fastcore developement?
Thank you Jeremy! Your code review is very helpful, and I have shortened the code with your recommendation, and pushed again without rerunning all the cells so that it didn’t generate all the differences in cell outputs.
For total bigginer I recommend this course : https://www.py4e.com
Everything is free and it is more practical than other bigger friendly courses.
I have flashcard for this book and some of python documentation. Feel free to contact me I will share it with you.However I put sometime way more stuff in one card than I should. (I did not obey flashcard rule).
If you ever read the source code of fastcore and have found concepts like metaclass, super, __new__, __call__ intimidating. The following tutorials should give you a good understanding to move on in reading the source, as they did for me.
Here is the code I use to achieve the incorrectly aligned version. Could anyone help me to get the alignment right? Thanks
blocks = """
if to is None:
to_f,from_f = f.__base__.__init__,f.__init__
else:
to_f,from_f = to.__init__ if isinstance(to,type) else to,f
"""
lst = blocks.split('\n')
for l in lst:
print('{:>157}'.format(l))
The word “without” in description “2.” makes me unsure whether that is exactly the output you want, or if you are commenting how its not quite right. Two other interpretations could be: you want the “1.” code to keep its indentation but slide as far right as possible until the longest line hits the margin; or, you want all lines right-aligned as far as possible.