Skip to content

Sharing an activity ​

A Basthon activity is shared with a simple link: it opens the console or the notebook with the language, the script or the notebook of the activity, its extra files and its modules (for instance a validation file).

The share button ​

The share button of the console share and of the notebook share creates a link that holds the script or the notebook (compressed, in the script or ipynb URL parameter). It is the simplest for a small content: there is nothing to put on the web, but the bigger the content, the longer the link, and it carries neither extra files nor modules.

Sharing files put on the web ​

For a bigger content, or one that comes with extra files and modules, put the files on the web, for instance on the Forge des communs numériques éducatifs (see Where to put your files?), and give their addresses in the URL parameters:

ParameterRole
fromthe script or the notebook to open (empty, from=, for an empty content instead of the user's last content)
auxan extra file (repeatable)
modulea module (repeatable)
kernelthe language (see Other languages)
extensionsthe extensions of the notebook, separated by commas (see Extensions of the notebook)
langthe language of the notebook's interface

When the link is opened, the student's browser downloads these files, directly from the site that hosts them: this site must allow it (see Where to put your files?).

Exemple

The examples of the gallery are shared this way, from Basthon's site:

https://console.basthon.fr/?from=examples/python3-courbes.py

The link generator ​

Fill in the form below, then copy the link you get or try it.

Where to put your files? ​

The site that hosts the files must allow them to be downloaded from another site (CORS), otherwise the browser refuses to load them. On a forge, not every link to a file is suitable.

The simplest: put your files in a public project of the forge, open the page of the file and copy its address into the generator above. It converts it automatically into an address that works.

Example with the Forge des communs numériques éducatifs

The file tp1/activite.py of the main branch of the dupont/nsi project is shown at

https://forge.apps.education.fr/dupont/nsi/-/blob/main/tp1/activite.py

The generator converts it into the address of the file through the API of the forge:

https://forge.apps.education.fr/api/v4/projects/dupont%2Fnsi/repository/files/tp1%2Factivite.py/raw?ref=main

The details, to write these addresses yourself:

HostingAddressWorks
GitHubpage of the file: https://github.com/<account>/<repository>/blob/<branch>/<file>❌
"raw" file: https://raw.githubusercontent.com/<account>/<repository>/<branch>/<file>✅
Forge des communs numériques éducatifs (and any GitLab: gitlab.com, Framagit…)page of the file: https://forge.apps.education.fr/<group>/<project>/-/blob/<branch>/<file>❌
"raw" file: https://forge.apps.education.fr/<group>/<project>/-/raw/<branch>/<file>❌
file through the API: https://forge.apps.education.fr/api/v4/projects/<group>%2F<project>/repository/files/<file>/raw?ref=<branch>✅
file published by GitLab Pages: https://<group>.forge.apps.education.fr/<project>/<file>✅

In the address of the API, the / of the project's name and of the file's path are written %2F. Written by hand in a Basthon link, this address must be encoded once more (its %2F becomes %252F, its ?%3F and its = %3D), otherwise its ?ref= would be taken for a parameter of Basthon: the generator takes care of it.

Info

If a file cannot be loaded, Basthon shows an error message when the page loads, and the console or the notebook stay usable.