after posting a problem here about the source links on Gitlab pages (link), i thought maybe I can share my current setup for nbdev on Gitlab:
- There is also this post from @rjohnson with a blog post where he describes his setup for Gitlab
- And there is already an issue Support GitLab · Issue #945 · fastai/nbdev · GitHub
I created a new empty repo, cloned it and set up a venv with pipenv. Then I installed nbdev and all other necessary packages.
After that I ran
nbdev_new (with some warning messages because the default github stuff is not available)
Then I changed
_quarto.yml for the use with gitlab
Changes made in
doc_path = public
branch = maininstead of master
doc_hostto your gitlab pages url, e.g.
git_urlto your gitlab repo url, e.g.
site-urlsame as above e.g.
Note: I just blindly changed every line containing “github”, I really don’t know which of these is relevant. But it works
And to use Gitlab pages you need to adapt the CI-pipeline, here is my (very simple)
gitlab-ci.yml. I am using pipenv here, so you may have to remove/adapt the pipenv related statements.
# The Docker image that will be used to build your app image: python:3.8-bullseye # Functions that should be executed before the build script is run before_script: - apt install wget - wget "https://github.com/quarto-dev/quarto-cli/releases/download/v1.1.149/quarto-1.1.149-linux-amd64.deb" - dpkg -i quarto-1.1.149-linux-amd64.deb - pip3 install pipenv - pipenv install --dev pages: script: - pipenv run nbdev_install - pipenv run nbdev_docs artifacts: paths: # The folder that contains the files to be exposed at the Page URL - public rules: # This ensures that only pushes to the default branch will trigger # a pages deploy - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
The nbdev command
nbdev_publish doesn’t work here, you can simply push your changes and the docs will be build by the CI-pipeline.
So, I hope this helps maybe one or the other