Please refer to Project Jupyter's Code of Conduct for guidelines on fostering a friendly and collaborative environment.
This project uses the Python package manager uv. Below are the steps to set up a local development environment.
- Clone this repository
git clone https://github.com/2i2c-org/jupyterhub-cost-monitoring.git-
Install
uvcurl -LsSf https://astral.sh/uv/install.sh | sh -
Install project dependencies and source the
.venvenvironmentuv sync source .venv/bin/activate -
Authenticate with AWS credentials (requires AWS CLI installation). This example uses a session token from an MFA code associated with an MFA device:
export AWS_PROFILE=<aws-profile-name>
export CLUSTER_NAME=<cluster-name>
export MFA_DEVICE_ID=<mfa-device-id>
aws sts get-session-token --serial-number $MFA_DEVICE_ID --profile $AWS_PROFILE --token-code ******-
Run the FastAPI web server
cd src/jupyterhub_cost_monitoring fastapi dev app.py --port 8080 -
Visit http://127.0.0.1:8080 to view the application.
If you need to add or update dependencies, follow the guidance in Working on projects | uv
This project uses pre-commit to manage pre-commit hooks. To install the pre-commit hooks, run:
pre-commit installThis will set up the hooks defined in .pre-commit-config.yaml to run automatically on git commit.
Helm charts are automatically published with Chartpress and hosted at 2i2c.org/jupyterhub-cost-monitoring.
Images are hosted at Quay.io.
See the configuration in the chartpress.yaml file for more details.
To run tests, use pytest:
uv run pytestThe documentation is built using MySTMD and hosted at jupyterhub-cost-monitoring.readthedocs.io.
To build the documentation locally, run:
cd docs
uv run myst startTo build the API documentation, download the OpenAPI specification from the FastAPI server default URL /openapi.json and place it in the docs/reference directory.
Install widdershins to convert this to a Markdown and name this docs/reference/api.md:
npm install -g widdershins
widdershins --code --summary true --user_templates api_templates openapi.json -o api.mdThere are custom templates in docs/reference/api_templates to style the output.