Nebari JupyterHub 主题
项目描述
信息 | 链接 |
---|---|
项目 | |
社区 |
自定义Nebari JupyterHub模板
此存储库包含一个自定义的Nebari JupyterHub模板。此模板覆盖了https://github.com/jupyterhub/jupyterhub/tree/main/share/jupyterhub/templates中的默认JupyterHub模板。
有关JupyterHub模板及其使用方式的更多详细信息,请参阅官方JupyterHub文档。
开发 👩🏻💻
先决条件
-
Python >= 3.8
-
我们使用 Hatch 来开发和发布 Nebari JupyterHub 主题。
建议您通过 pipx 安装 hatch,因为它会修改安装此环境的 Python 环境(更多详情,请参阅 Hatch 文档)。
pipx install hatch
-
hatch-conda 插件。要安装
pipx install hatch-conda
设置您的开发环境
-
在你的个人 GitHub 账户上创建 Nebari JupyterHub 主题仓库的分支
-
将此仓库克隆到您的本地计算机
git clone https://github.com/<your-username>/nebari-jupyterhub-theme.git
-
从项目根目录,使用 hatch 创建一个新的开发环境
hatch env create
这将创建一个新的开发环境,其中包含所有开发所需的依赖项。它还将以开发模式安装
nebari_jupyterhub_theme
。您可以通过运行以下命令来验证您的开发环境是否正确设置:$ hatch env show Standalone ┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┓ ┃ Name ┃ Type ┃ Dependencies ┃ Scripts ┃ ┡━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━┩ │ default │ virtual │ │ │ ├─────────┼─────────┼─────────────────────────┼─────────┤ │ dev │ virtual │ configurable-http-proxy │ render │ │ │ │ jupyterhub │ │ │ │ │ jupyterlab │ │ │ │ │ nodejs │ │ └─────────┴─────────┴─────────────────────────┴─────────┘
-
在开发环境中初始化一个新的 shell
hatch --env dev shell
要离开环境,您可以在终端中输入
exit
。 -
为开发初始化 JupyterHub 实例
hatch run dev:render
此命令将启动 JupyterHub,其中
--config
选项指向test_jupyterhub_config.py
。您应该能够通过您的网页浏览器访问 http://127.0.0.1:8081 并看到正在运行的 JupyterHub 实例。注意 从这里您可以使用任何用户名和在
test_jupyterhub_config.py
中的c.DummyAuthenticator.password
配置选项中设置的密码登录。请注意,并非所有扩展和集成都在此dev
模式下可用。 -
现在您可以修改模板和
style.css
文件,而无需重新启动服务器即可看到 JupyterHub 实例中的更改。
注意 在
c.JupyterHub.template_vars
中指定的值将覆盖在nebari_jupyterhub_theme/templates
中设置的默认值。
此软件包的发布过程在 RELEASE.md
中进行了记录。
在您的JupyterHub实例上使用nebari_jupyterhub_theme
📦
-
安装
nebari_jupyterhub_theme
pip install nebari_jupyterhub_theme
注意 如果您已经有一个 JupyterHub 配置文件,您可以跳到下一步。否则,请按照 JupyterHub 文档 中的说明首先生成一个配置文件。
-
将以下内容添加到您的 JupyterHub 配置文件中,以获取新的
jinja2
模板目录和静态文件from nebari_jupyterhub_theme import theme_extra_handlers, theme_template_paths c.JupyterHub.extra_handlers = theme_extra_handlers c.JupyterHub.template_paths = theme_template_paths
-
可选 - 如果您需要进一步自定义 UI,您可以修改您的 JupyterHub 配置文件中的
template_vars
,通过添加以下行到其中# minimal configuration example overwriting the default values in the nebari_jupyterhub_theme c.JupyterHub.template_vars = { "hub_title": "Welcome to Nebari", "logo": "/hub/custom/images/Nebari-logo-square.svg", "primary_color": "#cb39ed", "secondary_color": "#2bd1c5",
可用的配置变量有
hub_title
:JupyterHub 实例的标题。它将在登录页面的页眉中显示。(H1 标题,默认:欢迎来到 Nebari)hub_subtitle
:在主实例标题下显示的副标题。(H2 标题,默认:"")welcome
:登录页面上的欢迎信息(默认:欢迎来到 Nebari。有关 Nebari 的更多信息,请访问 <a href="https://nebari.dev/">https://nebari.dev</a>)logo
:在导航栏中显示的标志(默认:Nebari 标志)primary_color
:主颜色(默认:#9e17b7)secondary_color
:辅助颜色(默认:#2bd1c5)accent_color
:强调颜色(默认:#eda61d)text_color
:文本颜色(默认:#1c1d26)h1_color
:H1 颜色,登录页面中的主要标题(默认:#0f1015)h2_color
:H2 颜色,登录页面中的副标题(默认:#0f1015)navbar_text_color
:导航栏链接和文本颜色(默认:#1c1d26)navbar_hover_color
: 导航栏链接的悬停颜色(默认:#00a3b0
)display_version
: 在页脚显示 JupyterHub 版本(默认:False)keycloak_realm_name
: Keycloak 域名(默认:"nebari")
注意 默认的颜色、字体和标志是基于 Nebari 品牌选择的。更多关于此信息,请参阅 Nebari 设计仓库。
:computer: 您可以在 test_jupyterhub_config.py
中看到这些变量和配置的示例。
Nebari 内部选项
cdsdashboards_enabled
: 这需要 JupyterHub 环境中存在 cdsdashboards(默认:False)cdsdashboards_restricted
: 这需要 JupyterHub 环境中存在 cdsdashboards(默认:False)nebari_theme_extra_js_urls
架构 🏗
该仓库结构如下
- .github: GitHub Actions 配置文件和仓库模板
- images: 本 README 中使用的图片
- nebari_jupyterhub_theme: 包含
jinja2
模板和静态文件的 Python 包 - pyproject.toml: Python 项目配置文件
- test_jupyterhub_config.py: 示例 JupyterHub 配置文件 - 由
hatch run dev:render
使用来启动本地 JupyterHub 实例进行本地开发。 - RELEASE.md: 发布流程文档
- .pre-commit-config.yaml: pre-commit 工具的配置文件(注意我们使用 pre-commit CI 来自动在所有 PR 上运行 pre-commit 并更新钩子)
为nebari-nebari_jupyterhub_theme
做出贡献👩💻
想要贡献?请查看我们的 贡献指南 以开始。
行为准则 📖
为了确保社区友好和欢迎,我们要求所有社区成员遵守我们的 行为准则。
许可 📄
nebari-nebari_jupyterhub_theme
依据 BSD-3 OSI 许可证 许可。
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。
源代码分发
构建分发
nebari_jupyterhub_theme-2024.7.1.tar.gz 的散列
算法 | 哈希摘要 | |
---|---|---|
SHA256 | b131e520f4df91dc868bddc4467af5667da0dfad1819fb430c84ca5a6dd87e4a |
|
MD5 | 01ed6e24386538a78b7758f4cd2d4ba4 |
|
BLAKE2b-256 | 61bfb3181f3255b11dacde9e2432fa2c9f9b079806e407e2d060e5b385928698 |
nebari_jupyterhub_theme-2024.7.1-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 37985fc75a3723b04368f2e30a12ca164fcb93fd5218c20aecfbe421f3cf153c |
|
MD5 | 6f6435eb8a66ac6e771e944b01134d2d |
|
BLAKE2b-256 | d384a2d7ced096d0c0c16d663fec2da68a13312e2b621fad19fe324f943c1f55 |