Python help

Hi @jeremy

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.

What do you think of it? Thanks!

1 Like

That seems reasonable. Would you like to submit a PR with that change?

1 Like

Thanks Jeremy, I will give it try to submit a PR with it.

I tried PR but have a few issues and posted here.

I was curious what was going on here. Just sharing some articles I found useful:

1 Like

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.

Hi Daniel, FYI The APL study nbdev project is also down. Jeremy is aware of this. So, don’t stress.


1 Like

Thank you so much Sarada! It’s so nice of you. I was feeling stressed about it.

However, I don’t know whether I am having the same issue though, as I can’t even do nbdev_preview.

Currently, I deleted my base and I am reinstall everything to see whether it solves my problem.

Reinstalling everything doesn’t solve the problem.

1 Like

When I am exploring FixSigMeta examples in fastcore.meta, I noticed a difference result:

The official 07_meta.ipynb has the example output as below:

But when I run the code, I got

Is it just my environment producing this different result?

I tried the code above on Kaggle and Try jupyter, and they give me different results too. And the reason for the difference is the python version.

I have pushed a PR, and I realised I need to make a few more changes to make the PR right

  1. I need to change my current python 3.9 to become fastcore’s python>=3.7
  2. 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?

1 Like

How to setup base environment and install fastai with python>=3.7?

The steps I took to setup everything are:
0. remove mambaforge folder

  1. bash Mambaforge-*.sh -b and ~/mambaforge/bin/conda init $SHELL_NAME
  2. 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
  3. mamba install jupyter
    Note: up to this point, the python is version 3.9 in ipython too, and fastai is available in ipython
  4. mamba install -c fastai nbdev
  5. pip install jupyter_contrib_nbextensions

How do I get my python version to 3.7 for fastai and fastcore developement?

1 Like

Python 3.9 is >=3.7, so you don’t need to change that.

1 Like

If I don’t need to change the version of python, and the TOC has been removed, then what else should I do about the PR?

I’ve done a code review on it to let you know what’s needed.

1 Like

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 :
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.

Tutorials on metaclass

  • a lengthy and comprehensive one
  • a shorter and simpler one

A basic tutorial on static, class, instance, cls and self.

A tutorial on super

1 Like