Nbdev for private pypi repositories and poetry package management

At our company, we’re using a private PyPI server and managing dependencies using poetry. Has anyone managed to get either one of those working with nbdev?

I’m particularly concerned about the CI/CD pipelines as the installation steps are specified in fastai/workflows, it looks like specifying a different installation procedure would either require creating a modified local copy of the original action or to make a contribution to nbdev source.

1 Like

Is there a better way to structure the workflows for your use-case? How does yours need to be different? Specific flags used by pip, or different commands?

2 Likes

There are two issues that I conflated in my original post: private PyPI and poetry package manager instead of pip.

I’ll experiment more with this today. Do you think poetry support would be a welcome contribution?

Private PyPi

Installing dependencies from a private PyPi repository requires only an additional flag to pip and some secrets being passed.

So the following:

test -f setup.py && pip install -e ".[dev]"

Becomes:

test -f setup.py && pip install --extra-index-url https://$PYPIUSER:$PYPIPASSWORD@$PYPISERVER -e ".[dev]"

Poetry

The above would not suffice for our use case as we’re using poetry.
Installing dependencies with poetry would require using entirely different commands.

On the initial scan of the nbdev-ci workflow, it looks that the following commands would need to be replaced by their poetry equivalents. But there might be more.

        python -m pip install --upgrade pip
        if [ $USE_PRE ]; then
          pip install -U git+https://github.com/fastai/fastcore.git
          pip install -U git+https://github.com/fastai/ghapi.git
          pip install -U git+https://github.com/fastai/execnb.git
          pip install -U git+https://github.com/fastai/nbdev.git
        else
          pip install -U nbdev
        fi
        echo "Doing editable install..."
        test -f setup.py && pip install -e ".[dev]"
1 Like