Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update instructions on how to export py generated symbols to IDE #21639

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion docs/docs/python/integrations/protobuf-and-grpc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,17 @@ from project.example.f_pb2_grcp import GreeterServicer

You do not need to run this goal for codegen to work when using Pants; `export-codegen` is only for external consumption outside of Pants.

Note: You can also export the generated sources using the [`--export-py-generated-sources` option](../../../reference/goals/export#py_generated_sources) to the [`pants export` goal](../../../reference/goals/export). This is useful when you want to provide an IDE with third-party dependencies and generated sources in a single place.
Note: You can also export the generated sources using the [`--export-py-generated-sources-in-resolve`](../../..//reference/goals/export#py_generated_sources_in_resolve) option to the [`pants export`](../../../reference/goals/export) goal. This is useful when you want to provide an IDE with third-party dependencies and generated sources in a single place.

For example,

```bash
❯ pants export \
--resolve=python-default \
--export-py-generated-sources-in-resolve=python-default
```

This assumes that you have a `resolve` named `python-default` (see [Getting started with resolves](../overview/lockfiles.mdx#getting-started-with-resolves)). For a concrete example of a project that sets a resolve named `python-default` see this [example `pants.toml`](https://github.com/pantsbuild/example-python/blob/main/pants.toml).
:::

:::caution You likely need to add empty `__init__.py` files
Expand Down
12 changes: 11 additions & 1 deletion docs/docs/python/integrations/thrift.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,17 @@ For example, compare `import user.ttypes` to `import codegen.models.user.ttypes`

You do not need to run this goal for codegen to work when using Pants; `export-codegen` is only for external consumption outside of Pants.

Note: You can also export the generated sources using the [`--export-py-generated-sources` option](../../../reference/goals/export#py_generated_sources) to the [`pants export` goal](../../../reference/goals/export). This is useful when you want to provide an IDE with third-party dependencies and generated sources in a single place.
Note: You can also export the generated sources using the `--export-py-generated-sources-in-resolve` option to the `pants export` goal. This is useful when you want to provide an IDE with third-party dependencies and generated sources in a single place.

For example,

```bash
❯ pants export \
--resolve=python-default \
--export-py-generated-sources-in-resolve=python-default
```

This assumes that you have a `resolve` named `python-default` (see [Getting started with resolves](../overview/lockfiles.mdx#getting-started-with-resolves)). For a concrete example of a project that sets a resolve named `python-default` see this [example `pants.toml`](https://github.com/pantsbuild/example-python/blob/main/pants.toml).
:::

## Multiple resolves
Expand Down