Metadata-Version: 2.4
Name: glicid-spawner
Version: 1.5
Summary: JupyterHub Batch Spawner for GLiCID
License: BSD 3-Clause License
License-File: LICENSE.md
Author: Benoit Seignovert
Author-email: benoit.seignovert@univ-nantes.fr
Requires-Python: >=3.10,<4.0
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: batchspawner (>=1.3.0,<2.0.0)
Requires-Dist: jinja2 (>=3.1.3,<4.0.0)
Requires-Dist: jupyterhub (>=4.0,<5.0)
Requires-Dist: oauthenticator (>=17.4,<18.0)
Project-URL: Repository, https://gitlab.univ-nantes.fr/glicid/jupyter/spawner
Description-Content-Type: text/markdown

JupyterHub Batch Spawner for GLiCID
===================================

[![Gitlab CI](https://gitlab.univ-nantes.fr/glicid/jupyter/spawner/badges/main/pipeline.svg)](https://gitlab.univ-nantes.fr/glicid/jupyter/spawner/pipelines/main/latest)
[![Test coverage](https://gitlab.univ-nantes.fr/glicid/jupyter/spawner/badges/main/coverage.svg)](https://gitlab.univ-nantes.fr/glicid/jupyter/spawner/pipelines/main/latest)

![Spawner form](img/spawner_form.png)


JupyterHub spawner config
-------------------------

In `jupyterhub_config.py`, add:
```py
c.JupyterHub.spawner_class = "glicid-spawner"
```

Custom parameters can be added with `c.GlicidSpawner.req_<my_parameter> = ...`.
The complete list of configurable parameters are available in [spawner.py](src/glicid_spawner/spawner.py).

JupyterHub authenticator config
-------------------------------
The spawner also contains a custom Authentik authenticator based on [Jupyter generic OAuth authenticator](https://github.com/jupyterhub/oauthenticator/blob/main/oauthenticator/oauth2.py).
This configuration is optional but can be setup like this:

```python
c.JupyterHub.authenticator_class = "authentik"

c.AuthentikAuthenticator.base_url = "https://authentik.example.org"
c.AuthentikAuthenticator.client_id = "abcdef"
c.AuthentikAuthenticator.client_secret = "xxxxxx"
c.AuthentikAuthenticator.callback_base_url = "https://jupyter.example.org"
c.AuthentikAuthenticator.allowed_groups = { "jupyter-users" }
c.AuthentikAuthenticator.admin_groups = { "jupyter-admins" }
```

Contribution
------------
This package is managed by [Poetry](https://python-poetry.org/):
```bash
git clone https://gitlab.univ-nantes.fr/glicid/jupyter/spawner glicid-spawner
cd glicid-spawner
poetry install
poetry run pre-commit install
```

To test the spawner:
```bash
poetry run pytest
```

To lint and format the source code:
```bash
poetry run ruff check . --fix
poetry run ruff format
```

To render the form template (with live reload):
```bash
poetry run python -m render [--single-cluster]
```

To activate the virtual environement globally:
```bash
source .venv/bin/activate
```

Bump to a new version:
```bash
poetry run tbump Major.Patch
```

External resources
------------------
- https://jupyterhub.readthedocs.io/en/stable/reference/spawners.html
- https://github.com/jupyterhub/batchspawner
- https://gitlab.com/idris-cnrs/jupyter/jupyter-jeanzay-spawner/
- https://gitlab.com/ifb-elixirfr/cluster/utils/slurmspawner/
- https://getbootstrap.com/docs/3.4/

