deploy

Deploy a repository as a new app in one call: a public one on any git host, or one of your own repos.

noclick.deploy copies the repository (or takes your repo as it is), makes the app, sets the secrets it reads, gives it the key to your account it asks for (or has the deploy ask the account's owner), and deploys production. Ask with dry_run=True first to see what it would do, what it would cost a month and what it asks of you, with nothing made.

plan = noclick.deploy("https://github.com/acme/console", dry_run=True)
print(plan.runtime, f"${plan.estimate.monthly_usd:.2f} a month", plan.missing_secrets)

app = noclick.deploy("https://github.com/acme/console", secrets={"STRIPE_SECRET_KEY": "sk_live_..."}).wait()
print(app.url)
noclick.deploy(
    source, *, dry_run=False, ref=None, name=None, secrets=None, account_key=None,
    key_spend_cap_usd_per_month=None, user=..., client=None
) -> DeployPlan | RepoDeploy

Deploy source as a new app of yours: a public git repository's https URL, on any host (copied into a new repo of yours, the one branch it deploys), or one of your own repos (a Repo, its id or its name, deployed as it is). ref names a branch, tag or full commit sha (the default branch otherwise).

It makes the app (name, or the repository's own name, or the first of name-2, name-3... free), sets the secrets its noclick.json says its code reads (NoClick makes the ones marked generate; secrets brings the rest, by name), gives the app the key to your account it asks for when account_key names exactly its scopes (only you signed in, or a key holding keys:create; otherwise the deploy asks the account's owner, as every deploy does), and deploys production.

Never a private repository, a URL with a login, an ssh:// or git@ address, or another account's repo: push a private one to a repo of yours with git and deploy that. What can't deploy is refused before anything is made. Needs the apps and repos scopes.

Parameters
sourceAnyrequired
dry_runbooldefault False
refstr | Nonedefault None
namestr | Nonedefault None
secretsMapping[str, str] | Nonedefault None
account_keySequence[str] | Nonedefault None
key_spend_cap_usd_per_monthfloat | Nonedefault None
userAny

Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).

(defaults to the current user)
clientClient | None

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

(default None)
Returns
DeployPlan | RepoDeploy

A RepoDeploy operation whose wait() gives a DeployResult (the app's url, where its key stands, the passwords to read once); with dry_run=True, a DeployPlan of what it would do, what it would cost a month and what it asks of you, with nothing made.

Usage

See what it would do first:

plan = noclick.deploy("https://github.com/acme/console", dry_run=True)
print(plan.runtime, f"${plan.estimate.monthly_usd:.2f} a month")
if plan.account_key:
    for line in plan.account_key.can:
        print("its key can", line["can"])
print("you set:", plan.missing_secrets)

Then deploy it, bringing the secrets you set, and read the password NoClick made once:

done = noclick.deploy("https://github.com/acme/console",
                      secrets={"STRIPE_SECRET_KEY": "sk_live_..."}).wait()
print(done.url)
app = noclick.Project.from_id(done.project_id)
for name in done.to_reveal:
    print(name, app.secrets.reveal(name))

One of your own repos, as it is:

done = noclick.deploy("console", name="console-live").wait()

DeployPlan

class DeployPlan

What a deploy would do, with nothing made: noclick.deploy(..., dry_run=True).

Attributes
sourcedict[str, Any]

What it read: kind (url or repo), the url or repo_id, and the commit and branch.

namestr

The app's name (and its copy's): the one you gave, or the first free one from the repository's.

runtimestr | None

Where the app would run (edge or container), and why; None when it won't run as it stands.

frameworkstr | None
reasonstr | None
noclick_jsonbool

Whether the repository has a noclick.json.

account_keyDeployKeyAsk | None
secretslist[DeploySecret]
missing_secretslist[str]

The secrets you set that the call would have to bring: a deploy without them is refused.

refuseddict[str, str] | None

Why it won't deploy as it stands (message, next_step); None when it will.

estimateEstimate

What it would cost a month, priced for your account (usage-based: what's charged is what's used).

fundsdict[str, Any]

Whether your account can pay to run it now (ok); if not, the refusal a deploy would meet.

makeslist[str]

What it makes: repo (a copy) and project (the app).

rawdict[str, Any]

The response JSON exactly as the API sent it.

DeployResult

class DeployResult

A deploy that ended live: what RepoDeploy.wait() gives.

Attributes
project_idstr
namestr
urlstr | None

Where production serves it.

repo_idstr | None
deployment_idstr | None
commitstr | None
account_keydict[str, Any] | None

Where its key to the account stands (status: granted, waiting for the owner, declined...), None when the repository asks for none.

to_reveallist[str]

The passwords NoClick made that nobody has read yet: read each once with app.secrets.reveal(name).

rawdict[str, Any]

The response JSON exactly as the API sent it.

DeploySecret

class DeploySecret

A secret the repository's noclick.json says its code reads.

Attributes
namestr
generatestr | None

What NoClick makes for it (secret or password); None for one you set.

descriptionstr | None

What it is, in the repository's words.

requiredbool

For one you set: whether a deploy without it is refused. One NoClick makes is always there.

givenbool

For one you set: whether the call brought its value.

shown_oncebool

For one NoClick makes: whether it's a password you read once (app.secrets.reveal).

DeployKeyAsk

class DeployKeyAsk

The key to your account the repository asks for, as you're shown it before you agree.

Attributes
scopeslist[str]
canlist[dict[str, Any]]

What the key can do, a line per scope (scope, can, reads_secrets).

cannotlist[str]

What no app's key can do, whatever it holds.

notestr

That whoever can change the app's code acts with the key.

given_bystr

you: you give it in the call (send account_key with these scopes); deploy: the deploy asks for it.

at_deploystr | None

When the deploy asks: asks_owner (the account's owner approves it from a link), given or denied, as the account's app_key approval setting decides.

RepoDeploy

class RepoDeploy(Operation)

A repository being deployed as a new app: the operation noclick.deploy returns. wait() gives a DeployResult once it's live; progress shows each stage (copying, making the app, setting its secrets and key, building and deploying). A deploy that fails after the copy keeps the app and its repo, and its error says how to go on.

Attributes
project_idstr | None

The new app's id, once it's made.

repo_idstr | None

The repo it deploys: the copy, or yours.

deployment_idstr | None

The production deployment, once it's started.