Create Photon from github

You can also create a photon from a Github repository. This is useful when you want to create a photon from a repository without cloning it to your local machine.

Step 1: Generate a token

Go to Github Personal Access Tokens Page, click Generate new token. Make the following changes based on your requirements:

  • Resource Owner: Change it to the owner of the repo from which you will be creating the photon.

  • Repository access: For security purposes, only select the repo you'd like to be used.

  • Permissions:

    • Contents: Give read-only permission.

Then click Generate token.

Step 2: Set up the environment variable for CLI to pull the repo

In the terminal, type in the following commands:

export GITHUB_USER={YOUR_GITHUB_USERNAME}
export GITHUB_TOKEN={THE_TOKEN_GENERATED_FROM_STEP_1}

Step 3: Create photon via lepton cli

lep photon create -n {PHOTON_NAME} -m py:{GIT_REPO_URL}:{PATH_TO_SCRIPT}:{CLASS_NAME}
KeyDescriptionExample
PHOTON_NAMEThe name of the photonmy-fs-counter
GIT_REPO_URLThe URL for the repogithub.com/leptonai/examples.git
PATH_TO_SCRIPTThe file extends the runner classgetting-started/counter/counter.py
CLASS_NAMEThe class extends the runner class inside the scriptCounter