Skip to content

Commit

Permalink
PR - Beta release v0.5.0-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
MaelImhof authored Aug 4, 2024
2 parents ba842b4 + ca032c7 commit f388451
Show file tree
Hide file tree
Showing 20 changed files with 1,308 additions and 202 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/dependency-review.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Dependency Review'

on:
pull_request:
branches:
- release
- dev

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
97 changes: 97 additions & 0 deletions .github/workflows/draft-beta-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# ======================================================================================================================================================
# Custom GitHub Action to draft a pre-release
#
# A GitHub draft pre-release is automatically created when the plugin's
# `manifest-beta.json` is updated on the `release` branch.
#
# Based on :
# - [Obsidian developers docs](https://docs.obsidian.md/Plugins/Releasing/Release+your+plugin+with+GitHub+Actions)
# - [BRAT docs for developers](https://tfthacker.com/brat-developers)
# - [Excellent tutorial for multiline strings in GitHub Actions by Thomas Stringer](https://trstringer.com/github-actions-multiline-strings/)
# ======================================================================================================================================================
name: "Create a draft Beta pre-release"

on:
# The workflow can be run manually
workflow_dispatch:
# The workflow is also triggered automatically when a push
# happens where the plugin's `manifest-beta.json` is modified
push:
branches:
- release
paths:
- 'manifest-beta.json'

jobs:
create-draft-release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"

- name: Build plugin
run: |
npm install
npm run build
# To easily read JSON files and extract the version from the manifest
- name: Install jq
uses: dcarbone/[email protected]

- name: Extract tag from manifest
# Extract the tag to use from the beta manifest file
run: |
tag=$(jq -r '.version' manifest-beta.json)
echo "Extracted tag: $tag"
echo "TAG=$tag" >> $GITHUB_ENV
# Prepare a release notes template
- name: Prepare generic release notes
run: |
notes=$(cat <<EOF
Open \`.ipynb\` files, edit them and run them directly inside of Obsidian without the need to open a terminal or a browser.
Obsidian Jupyter is a plugin for [Obsidian](https://obsidian.md) that offers [Jupyter](https://jupyter.org/) Notebook and Lab integration directly into Obsidian.
## How to install
Interested? Please follow the instructions of the [documentation](https://jupyter.mael.im) and let me hear your feedback, it enables me to keep improve the plugin. Thank you in advance !
## Change Log
### Features
### Bug fixes
### Documentation
### Logistic
### Development
EOF
)
# Thank you Thomas Stringer for this : https://trstringer.com/github-actions-multiline-strings/
echo "NOTES<<EOF" >> $GITHUB_ENV
echo "$notes" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create draft release
env:
# Extract the variables set previously from the environment
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ env.TAG }}
NOTES: ${{ env.NOTES }}
# Create a draft release with GitHub CLI
run: |
gh release create "$TAG" \
--title="Obsidian Jupyter v$TAG" \
--draft \
--prerelease \
--notes "$NOTES" \
--generate-notes \
main.js manifest-beta.json styles.css
95 changes: 95 additions & 0 deletions .github/workflows/draft-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# ======================================================================================================================================================
# Custom GitHub Action to draft a release
#
# A GitHub draft release is automatically created when the plugin's `manifest.json`
# is updated on the `release` branch.
#
# Based on :
# - [Obsidian developers docs](https://docs.obsidian.md/Plugins/Releasing/Release+your+plugin+with+GitHub+Actions)
# - [Excellent tutorial for multiline strings in GitHub Actions by Thomas Stringer](https://trstringer.com/github-actions-multiline-strings/)
# ======================================================================================================================================================
name: "Create a draft pre-release"

on:
# The workflow can be run manually
workflow_dispatch:
# The workflow is also triggered automatically when a push
# happens where the plugin's `manifest.json` is modified
push:
branches:
- release
paths:
- 'test-vault/.obsidian/plugins/jupyter/manifest.json'

jobs:
create-draft-release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"

- name: Build plugin
run: |
npm install
npm run build
# To easily read JSON files and extract the version from the manifest
- name: Install jq
uses: dcarbone/[email protected]

- name: Extract tag from manifest
# Extract the tag to use from the manifest file
run: |
tag=$(jq -r '.version' manifest.json)
echo "Extracted tag: $tag"
echo "TAG=$tag" >> $GITHUB_ENV
# Prepare a release notes template
- name: Prepare generic release notes
run: |
notes=$(cat <<EOF
Open \`.ipynb\` files, edit them and run them directly inside of Obsidian without the need to open a terminal or a browser.
Obsidian Jupyter is a plugin for [Obsidian](https://obsidian.md) that offers [Jupyter](https://jupyter.org/) Notebook and Lab integration directly into Obsidian.
## How to install
Interested? Please follow the instructions of the [documentation](https://jupyter.mael.im) and let me hear your feedback, it enables me to keep improve the plugin. Thank you in advance !
## Change Log
### Features
### Bug fixes
### Documentation
### Logistic
### Development
EOF
)
# Thank you Thomas Stringer for this : https://trstringer.com/github-actions-multiline-strings/
echo "NOTES<<EOF" >> $GITHUB_ENV
echo "$notes" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create draft release
env:
# Extract the variables set previously from the environment
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ env.TAG }}
NOTES: ${{ env.NOTES }}
# Create a draft release with GitHub CLI
run: |
gh release create "$TAG" \
--title="Obsidian Jupyter v$TAG" \
--draft \
--notes "$NOTES" \
--generate-notes \
main.js manifest.json styles.css
51 changes: 39 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# =========================
# Generic
# =========================

# vscode
.vscode

Expand All @@ -8,29 +12,52 @@
# npm
node_modules

# Don't include the compiled main.js file in the repo.
# They should be uploaded to GitHub releases instead.
main.js
!test-vault/.obsidian/plugins/hot-reload/main.js

# Don't include the generate Jupyter configuration file
test-vault/.obsidian/plugins/jupyter/jupyter_lab_config.py
# Exclude macOS Finder (System Explorer) View States
.DS_Store

# Exclude sourcemaps
*.map

# obsidian
# =========================
# Docs
# =========================

# Exclude generated docs
docs/public
docs/quartz/.quartz-cache

# =========================
# Obsidian
# =========================

# Do not include generic Obsidian files
app.json
appearance.json
core-plugins.json
core-plugins-migration.json
workspace.json

# Do not include plugins settings
data.json

# Ignore files that are copied by npm run build
main.js
styles.css
manifest.json
versions.json
!test-obsidian-vault/.obsidian/plugins/hot-reload/main.js
.ipynb_checkpoints

# Exclude macOS Finder (System Explorer) View States
.DS_Store
# But include the hot-reload plugin's files
!test-vault/.obsidian/plugins/hot-reload/main.js
!test-vault/.obsidian/plugins/hot-reload/manifest.json
!test-vault/.obsidian/plugins/hot-reload/LICENSE

# Also include the styles, manifest and versions in the test vault
!test-vault/.obsidian/plugins/jupyter/styles.css
!test-vault/.obsidian/plugins/jupyter/manifest.json
!test-vault/.obsidian/plugins/jupyter/versions.json

# Ignore the generate Jupyter configuration file
test-vault/.obsidian/plugins/jupyter/jupyter_lab_config.py

# Ignore the generated Jupyter checkpoints
.ipynb_checkpoints
15 changes: 15 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Security Policy

## Reporting a Vulnerability

People being able to use this Obsidian plugin with peace of mind and in a safe manner is a top priority.

If you discover a security vulnerability within this repository, please follow these steps:

1. **Do no report security vulnerabilities through public mediums** such as GitHub issues and discussions.

2. **Use [GitHub Security Advisories](https://github.com/MaelImhof/obsidian-jupyter/security)** instead. Click `Report a vulnerability` and write your report. I (the maintainer) will answer you as soon as I can before looking into your discovery.

3. **Provide detailed information**, such as how it can be reproduced, the potential impact, and any other information that might be helpful to understand the vulnerability.

Thank you very much for your support in keeping this project secure ! Your efforts to responsibly disclose your findings are greatly appreciated and will of course be acknowledged.
54 changes: 51 additions & 3 deletions docs/content/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,69 @@ If enabled, Jupyter checkpoints will be moved to the system trash instead of bei
This setting has no effect if [[#Delete Jupyter checkpoints]] is disabled.

By default, Jupyter checkpoints are moved to trash (enabled).

Note that if checkpoints are stored outside of the vault folder (see [[#Jupyter checkpoints folder|Jupyter checkpoints folder]] setting), moving them to trash won't work and will display an error notice without deleting or moving the checkpoints. In this case, this setting can be disabled to delete the checkpoints permanently, which will still work.
#### Jupyter checkpoints folder

Defines where to store the checkpoints generated by Jupyter. **Has no effect if [[#Delete Jupyter checkpoints]] is not enabled**.

- **By default**, the checkpoints are not deleted and stored in the same folder as the corresponding `.ipynb` file.
- **If [[#Delete Jupyter checkpoints|deletion]] is enabled**, but this setting is empty, checkpoints are stored in a default location, inside of the plugin's Obsidian directory, and deleted when Jupyter exits.
- **If [[#Delete Jupyter checkpoints|deletion]] is enabled** and this setting is set to a path, a `.ipynb_checkpoints` directory will be created as a sub-folder of the indicated folder, and all checkpoints will be stored inside of it. This can be useful if you do not want checkpoints to be inside of your vault's directory, to avoid syncing them for example.

Note that if the Jupyter server is running while you change this setting, you will need to stop it and start it again for the new value to take effect.

By default, this setting is blank (no path set, see the list above for what this implies).

Relative paths are accepted and will be resolved relative to the Jupyter's root folder (meaning the root folder of the vault).

This setting allows to store the checkpoints **outside of the vault** using an absolute path. This is particularly useful if some automatic backup system is set up on the vault, and the user does not want to backup the Jupyter checkpoints. In this case, checkpoints can be stored outside of the vault in a user-defined location. However, note that **if checkpoints are stored outside the vault, [[#Move Jupyter checkpoints to trash|trashing]] no longer works**. This means that if checkpoints are outside the vault, having the [[#Move Jupyter checkpoints to trash|Move Jupyter checkpoints to trash]] setting enabled will display an error notice and won't delete the checkpoints. Deleting the checkpoints permanently still works.
### Plugin customization
#### Display ribbon icon
#### Update popup

When the plugin gets an update, a popup will show to tell the user that a new version of Jupyter for Obsidian was installed with links to the GitHub releases and a list of the changes that were performed.

This popup is enabled by default but can be disabled using this setting.
#### Ribbon icon for server status

Whether to display the plugin's ribbon icon or not. Can help if you find the ribbon icon unnecessary and want to get rid of it.
Jupyter for Obsidian can display a ribbon icon that adapts based on the Jupyter server status (running, exited or starting). This setting defines whether that ribbon icon should be drawn.

The setting is thought for users who have many plugins installed who do not want to crowd their ribbon icons bar too much.

![[ribbon-icon.png]]

Default value is yes (the ribbon icon is displayed).
#### Display status notices

Whether to display status notices when the Jupyter server state updates. A notice will appear every time the server is started, running, or exits.
Whether to display status notices when the Jupyter server state updates. A notice will appear every time the server is started, running, or exits.

![[status-notices.png]]

Default value is yes (the status notices are displayed).
#### Ribbon icon for new notebooks

Defines whether another ribbon icon (different from [[#Ribbon icon for server status|the one for server status]]) is drawn. This second ribbon icon allows the user to create a new Jupyter notebook file at the root of the vault.

This ribbon icon is independent from the server status one, meaning that it can be enabled whether the ribbon icon for server status is enabled or not, and vice-versa.

Default value is yes (the ribbon icon is displayed).
#### Folder context menu for new notebooks

When right-clicking on a file or folder, Obsidian will offer some actions to the user that can be performed on this item. This setting defines whether Jupyter for Obsidian should add its own custom action to the list and offer the user to create a new Jupyter notebook when the user right-clicks on a folder.

Default value is yes (the Jupyter context menu item will be available).
#### Open created notebooks

Defines whether to immediately open new notebook files when they are created, and how to open them (in a new tab, in a detached window).

Possible values are
- **Do not open**, simply create the file without opening it
- **Open in the current tab**, like the general behavior in Obsidian, replace the currently active document (if any) with the newly created notebook
- **Open in a new tab**, create the file and then open it in a new tab, without replacing the active file
- **Open in a new split tab**, create the file, split the current workspace and open the new notebook in the new split tab
- **Open in a detached window**, create the file and open it in a detached window

By default, new notebooks are opened in a new tab.
### Advanced
#### Jupyter starting timeout

Expand Down
Loading

0 comments on commit f388451

Please sign in to comment.