> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hop.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Python

> Deploy Python applications with Hop

<Snippet file="nixpacks-notice.mdx" />

Python is detected when you have one of the following files in your codebase:

* `main.py`
* `requirements.txt`
* `pyproject.toml`

## Build Command

Depending on the dependency file detected in your project, a different command will be used to build your image.

> [accordion] requirements.txt
>
> ```shell theme={null}
> pip install -r requirements.txt
> ```

> [accordion] pyproject.toml
>
> ```shell theme={null}
> pip install --upgrade build setuptools && pip install .
> ```
>
> If a poetry.lock file is also detected, this will be ran instead:
>
> ```shell theme={null}
> poetry install --no-dev --no-interactive --no-ansi
> ```

> [accordion] Pipfile
>
> ```shell theme={null}
> PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy
> ```

## Start Command

> [accordion] Django
>
> If Django is detected, the following command will be used:
>
> ```shell theme={null}
> python manage.py migrate && gunicorn {app_name}.wsgi
> ```

> [accordion] pyproject.toml
>
> ```shell theme={null}
> python -m {module}
> ```

> [accordion] Otherwise
>
> ```shell theme={null}
> python main.py
> ```

Depending on files detected within your project, a different start command (entrypoint) will be used to run your application.

## Versions

The following Python versions are available:

* 3.11
* 3.10
* 3.9
* 3.8 (**default**)
* 3.7
* 2.7

### Specifying a version

The version can be overridden by:

* Setting the `NIXPACKS_PYTHON_VERSION` environment variable, or
* Specifying the version in a `.python-version` file


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.