A JupyterLab extension to manage HydroShare resource files in JupyterLab
Project description
hsfiles_jupyter
A JupyterLab extension for managing HydroShare resource files in JupyterLab. This extension assumes that the user has loaded a HydroShare resource to a JupyterHub environment using the 'Open with' functionality in HydroShare.
Installation
# Create and activate python environment, requires python >= 3.9
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --upgrade pip
# Install
python3 -m pip install hsfiles_jupyter
# Link extension to JupyterLab
python3 -m hsfiles_jupyter
# Launch JupyterLab and access the functionality of this extension from the JupyterLab file browser menu!
python3 -m jupyter lab
Setup for Development
- Clone the repository:
git clone https://github.com/hydroshare/hsfiles_jupyter.git - Navigate to the project root directory:
cd hsfiles_jupyter - Create a branch:
git checkout -b my-branch - Create a virtual environment:
python3 -m venv .venv - Activate the virtual environment:
source .venv/bin/activate - Install dependencies using
pip install -e .[dev]
Frontend
- Navigate to the
frontenddirectory. - Run
npm installto install dependencies. - Run
npm run buildto compile the TypeScript code. - Run
jupyter lab buildto build the frontend assets. - Run
jupyter labextension install .to install the extension.
Backend
- Navigate to the
hsfiles_jupyterdirectory (project root). - Run
python3 -m hsfiles_jupyterto link extension to JupyterLab.
Usage
-
Setup a notebook dir to be used as the root directory in JupyterLab. Example: ~/Documents/hsfiles_jupyter
1.1. Create a directory called "Downloads" under the notebook root directory. Example: ~/Documents/hsfiles_jupyter/Downloads
1.2. Download a HydroShare resource that you own and extract the contents to the "Downloads" directory.
-
Export your HydroShare credentials as environment variables. This is needed for local development only:
export HS_USER=your_hydroshare_username
export HS_PASS=your_hydroshare_password
- Start JupyterLab:
jupyter lab --debug --notebook-dir=~/Documents/hsfiles_jupyter - This will open the JupyterLab in browser. Open the "Downloads" directory in the file browser and navigate to data/contents folder, and you should see the contents of the resource your downloaded. Right-click on any of the resource files, and you should see HydroShare specific file action menu options".
Create distribution package to publish to PyPI
- Clone the repository:
git clone https://github.com/hydroshare/hsfiles_jupyter.git - Navigate to the project root directory:
cd hsfiles_jupyter - Checkout the main branch:
git checkout -b main origin/main - Create a virtual environment:
python3 -m venv .venv - Activate the virtual environment:
source .venv/bin/activate - Install dependencies using
pip install .[dev] - Navigate to frontend directory:
cd frontend - Run
npm installto install dependencies. - Run
npm run buildto compile the TypeScript code. - Navigate to the project root directory:
cd .. - Run
python3 -m buildto create the distribution package. - Run
twine upload dist/*to publish the package to PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hsfiles_jupyter-0.1.0.tar.gz.
File metadata
- Download URL: hsfiles_jupyter-0.1.0.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34fc05298f65ed014e52a5b1fab6ef80a9b45bac9a4517337ce5a711dff57c09
|
|
| MD5 |
33eff2ff910b7e7b77dd19c1a2bc4f75
|
|
| BLAKE2b-256 |
81a6dac2ddf731dadf6e2159051ef1aa4fcb787f6ada6092805c407b6b0ef871
|
File details
Details for the file hsfiles_jupyter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hsfiles_jupyter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdd43566cfc21dae6c83840c70b8bd58d10c167d949166089c0aaa28cdf21351
|
|
| MD5 |
e775bc071c699d3c0909426a038dc947
|
|
| BLAKE2b-256 |
77cf521b49b977dad6f213503c17012fb0ea9e5542bcabfb04607c607590554a
|