Skip to main content

Build Status License: MIT PyPI Downloads

PythonAnywhere cli tool

pa is a single command to manage PythonAnywhere services.

It is designed to be run from PythonAnywhere consoles, but many subcommands can be executed directly from your own machine (see usage below).

Installing

On PythonAnywhere

In a PythonAnywhere Bash console, run:

pip3.10 install --user pythonanywhere

If there is no python3.10 on your PythonAnywhere account, you should upgrade your account to the newest system image. See here how to do that. pa works with python 3.8, 3.9, and 3.10 but we recommend using the latest system image.

On your own machine

Install the pythonanywhere package from PyPI. We recommend using pipx if you want to use it only as a cli tool, or a virtual environment if you want to use a programmatic interface in your own code.

Usage

There are two ways to use the package. You can just run the scripts or use the underlying api wrappers directly in your scripts.

Command line interface

pa [OPTIONS] COMMAND [ARGS]...

Options:
  --install-completion  Install completion for the current shell.
  --show-completion     Show completion for the current shell, to copy it or
                        customize the installation.
  -h, --help            Show this message and exit.

Commands:
  django    Makes Django Girls tutorial projects deployment easy
  path      Perform some operations on files
  schedule  Manage scheduled tasks
  students  Perform some operations on students
  webapp    Everything for web apps: use this if you're not using our experimental features 
  website   EXPERIMENTAL: create and manage ASGI websites

Running pa on your local machine

pa expects the presence of some environment variables that are provided when you run your code in a PythonAnywere console. You need to provide them if you run pa on your local machine.

API_TOKEN -- you need to set this to allow pa to connect to the PythonAnywere API. To get an API token, log into PythonAnywhere and go to the "Account" page using the link at the top right. Click on the "API token" tab, and click the "Create a new API token" button to get your token.

PYTHONANYWHERE_SITE is used to connect to PythonAnywhere API and defaults to www.pythonanywhere.com, but you may need to set it to eu.pythonanywhere.com if you use our EU site.

If your username on PythonAnywhere is different from the username on your local machine, you may need to set PYTHONANYWHERE_USERNAME for the environment you run pa in.

Programmatic usage in your code

Take a look at the pythonanywhere.task module and docstrings of pythonanywhere.task.Task class and its methods.

Legacy scripts

Some legacy scripts (separate for each action) are still available.

Contributing

Pull requests are welcome! You'll find tests in the tests folder...

Requires uv.

# prep your dev environment
uv sync --extra test

# running the tests:
uv run pytest

# make sure that the code that you have written is well tested:
uv run pytest --cov=pythonanywhere --cov=scripts

# to just run the fast tests:
uv run pytest -m 'not slowtest' -v

Metadata

Release files for pythonanywhere 0.19.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pythonanywhere 0.19.3
File Size Uploaded
pythonanywhere-0.19.3.tar.gz 56.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pythonanywhere 0.19.3
File Interpreter ABI Platform
pythonanywhere-0.19.3-py3-none-any.whl Python 3 none any Details

Total release size: 103.6 kB

Release files / pythonanywhere-0.19.3.tar.gz

Download URL pythonanywhere-0.19.3.tar.gz
Size 56.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b6dd931b2086c0f38682b5e2323ddd649b4b023809a1aa602bbdc2e5f6003ed4
BLAKE2b-256 checksum
How to use checksums
a39efa3877034cabba34d88ae956c3e0e1071285c1be224cf9849eadc8db4a63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pythonanywhere-0.19.3-py3-none-any.whl

Download URL pythonanywhere-0.19.3-py3-none-any.whl
Size 47.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d780093d36c1dae7f0ab794a661509504b909b25220f89f1db9143d1d6e81b96
BLAKE2b-256 checksum
How to use checksums
0b5cb23f4a91e150182c3cedda1e8e7e245a86497f3994a5f13b74791f705258
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.19.3 This release

2 release files

0.19.2

2 release files

0.19.1

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.5

2 release files

0.15.4

2 release files

0.15.3

1 release file

0.15.2

1 release file

0.15.1

1 release file

0.15.0

1 release file

0.14.1

1 release file

0.14.0

1 release file

0.13.0

1 release file

0.12.2

1 release file

0.12.1

1 release file

0.12.0

1 release file

0.11.0

1 release file

0.10.3

1 release file

0.10.2

1 release file

0.10.1

1 release file

0.10.0

1 release file

0.9.10

1 release file

0.9.9

1 release file

0.9.8

1 release file

0.9.7

1 release file

0.9.6

1 release file

0.9.5

1 release file

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.4

1 release file

0.7.3

1 release file

0.7.2

1 release file

0.7.1

1 release file

0.7

1 release file

0.6

1 release file

0.5.1

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page