Skip to content

Commit 91de38a

Browse files
authored
Merge pull request #125919 from madebygps/main
Add pyproject.toml conversion guidance for App Service
2 parents 5a79187 + f5e37da commit 91de38a

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

articles/app-service/configure-language-python.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This article describes how [Azure App Service](overview.md) runs Python apps, ho
2020
The App Service deployment engine automatically activates a virtual environment and runs `pip install -r requirements.txt` for you when you deploy a [Git repository](deploy-local-git.md), or when you deploy a [zip package](deploy-zip.md) [with build automation enabled](deploy-zip.md#enable-build-automation-for-zip-deploy).
2121

2222
> [!NOTE]
23-
> Currently App Service requires `requirements.txt` in your project's root directory, even if you're using modern Python packaging tools such as `pyproject.toml`.
23+
> Currently App Service requires `requirements.txt` in your project's root directory even if you have a `pyproject.toml`. See [Generate requirements.txt from pyproject.toml](#generate-requirementstxt-from-pyprojecttoml) for recommended approaches.
2424
2525
This guide provides key concepts and instructions for Python developers who use a built-in Linux container in App Service. If you've never used Azure App Service, first follow the [Python quickstart](quickstart-python.md) and [Flask](tutorial-python-postgresql-app-flask.md), [Django](tutorial-python-postgresql-app-django.md), or [FastAPI](tutorial-python-postgresql-app-fastapi.md) with PostgreSQL tutorial.
2626

@@ -101,6 +101,30 @@ For more information on how App Service runs and builds Python apps in Linux, se
101101
> [!NOTE]
102102
> Always use relative paths in all pre- and post-build scripts because the build container in which Oryx runs is different from the runtime container in which the app runs. Never rely on the exact placement of your app project folder within the container (for example, that it's placed under *site/wwwroot*).
103103
104+
## Generate requirements.txt from pyproject.toml
105+
106+
App Service does not directly support `pyproject.toml` at the moment. If you're using tools like Poetry or uv, the recommended approach is to generate a compatible `requirements.txt` before deployment in your project's root:
107+
108+
### Using Poetry
109+
110+
Using [Poetry](https://python-poetry.org/) with the [export plugin](https://github.com/python-poetry/poetry-plugin-export):
111+
112+
```sh
113+
114+
poetry export -f requirements.txt --output requirements.txt --without-hashes
115+
116+
```
117+
118+
### Using uv
119+
120+
Using [uv](https://docs.astral.sh/uv/concepts/projects/sync/#exporting-the-lockfile):
121+
122+
```sh
123+
124+
uv export --format requirements-txt --no-hashes --output-file requirements.txt
125+
126+
```
127+
104128
## Migrate existing applications to Azure
105129

106130
Existing web applications can be redeployed to Azure as follows:

0 commit comments

Comments
 (0)