|
| 1 | +--- |
| 2 | +title: "Export plugin" |
| 3 | +draft: false |
| 4 | +type: docs |
| 5 | +layout: single |
| 6 | + |
| 7 | +menu: |
| 8 | + docs: |
| 9 | + weight: 1001 |
| 10 | +--- |
| 11 | + |
| 12 | +# Export plugin |
| 13 | + |
| 14 | +The export plugin allows the export of locked packages to various formats. |
| 15 | + |
| 16 | +{{% note %}} |
| 17 | +Only the `requirements.txt` format is currently supported. |
| 18 | +{{% /note %}} |
| 19 | + |
| 20 | +## Exporting packages |
| 21 | + |
| 22 | +The plugin provides an `export` command to export the locked packages to |
| 23 | +various formats. |
| 24 | + |
| 25 | +The default export format is the `requirements.txt` format which is currently |
| 26 | +the most compatible one. You can specify a format with the `--format (-f)` option: |
| 27 | + |
| 28 | +```bash |
| 29 | +poetry export -f requirements.txt |
| 30 | +``` |
| 31 | + |
| 32 | +By default, the `export` command will export to the standard output. |
| 33 | +You can specify a file to export to with the `--output (-o)` option: |
| 34 | + |
| 35 | +```bash |
| 36 | +poetry export --output requirements.txt |
| 37 | +``` |
| 38 | + |
| 39 | +Similarly to the [`install`]({{< relref "../cli#install" >}}) command, you can control |
| 40 | +which [dependency groups]({{< relref "managing-dependencies#dependency-groups" >}}) |
| 41 | +need to be exported. |
| 42 | + |
| 43 | +If you want to exclude one or more dependency group from the export, you can use |
| 44 | +the `--without` option. |
| 45 | + |
| 46 | +```bash |
| 47 | +poetry export --without test,docs |
| 48 | +``` |
| 49 | + |
| 50 | +You can also select optional dependency groups with the `--with` option. |
| 51 | + |
| 52 | +```bash |
| 53 | +poetry export --with test,docs |
| 54 | +``` |
| 55 | + |
| 56 | +{{% note %}} |
| 57 | +The `--dev` option is now deprecated. You should use the `--with dev` notation instead. |
| 58 | +{{% /note %}} |
| 59 | + |
| 60 | +It's also possible to only export specific dependency groups by using the `only` option. |
| 61 | + |
| 62 | +```bash |
| 63 | +poetry export --only test,docs |
| 64 | +``` |
| 65 | + |
| 66 | +### Available options |
| 67 | + |
| 68 | +* `--format (-f)`: The format to export to (default: `requirements.txt`). Currently, only `requirements.txt` is supported. |
| 69 | +* `--output (-o)`: The name of the output file. If omitted, print to standard output. |
| 70 | +* `--without`: The dependency groups to ignore when exporting. |
| 71 | +* `--with`: The optional dependency groups to include when exporting. |
| 72 | +* `--only`: The only dependency groups to include when exporting. |
| 73 | +* `--default`: Only export the default dependencies. |
| 74 | +* {{< option name="dev" deprecated=true >}}Include development dependencies.{{< /option >}} |
| 75 | +* `--extras (-E)`: Extra sets of dependencies to include. |
| 76 | +* `--without-hashes`: Exclude hashes from the exported file. |
| 77 | +* `--with-credentials`: Include credentials for extra indices. |
0 commit comments