Skip to content

docs: Update Python docs on project management - #8465

Merged
helderco merged 8 commits into
dagger:mainfrom
helderco:helder/dev-4527-update-docs-about-python-project-management
Sep 24, 2024
Merged

helderco merged 8 commits into
dagger:mainfrom
helderco:helder/dev-4527-update-docs-about-python-project-management

Conversation

@helderco

@helderco helderco commented Sep 16, 2024 •

Copy link
Copy Markdown
Contributor

Fixes #8449

Note

This needed to be published with v0.13.0 but I couldn't manage it, so we need these docs asap.

👀 See Preview

Signed-off-by: Helder Correia <[email protected]>
Signed-off-by: Helder Correia <[email protected]>
@helderco
helderco force-pushed the helder/dev-4527-update-docs-about-python-project-management branch 2 times, most recently from b784959 to 6bb5fa9 Compare September 24, 2024 13:17
@helderco
helderco marked this pull request as ready for review September 24, 2024 13:17
@helderco
helderco requested a review from a team as a code owner September 24, 2024 13:17
@helderco
helderco requested review from levlaz and vikram-dagger and removed request for levlaz and vikram-dagger September 24, 2024 13:17
Dagger modules in Python are built to be installed, like libraries. The runtime container installs the module code with:
Dagger modules in Python are built to be installed, like libraries. At module creation time, a `pyproject.toml` and `uv.lock` file will automatically be created that depend on the locally generated client library (in `./sdk`). This dependency is configured to be editable so that changes in the code don't require a re-install.

With the `uv.lock` file, Dagger uses uv's [project management](https://docs.astral.sh/uv/concepts/projects/) capabilites, but it can be opted out by removing this file, in which case Dagger falls back to [the pip interface](https://docs.astral.sh/uv/pip/) instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
With the `uv.lock` file, Dagger uses uv's [project management](https://docs.astral.sh/uv/concepts/projects/) capabilites, but it can be opted out by removing this file, in which case Dagger falls back to [the pip interface](https://docs.astral.sh/uv/pip/) instead.
With the `uv.lock` file, Dagger uses `uv`'s [project management](https://docs.astral.sh/uv/concepts/projects/) capabilites, but it can be opted out by removing this file, in which case Dagger falls back to [the `pip` interface](https://docs.astral.sh/uv/pip/) instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Astral doesn't use the backticks in their documentation: https://docs.astral.sh/uv/getting-started/

  • uv → the cli program
  • uv → the name of the tool

Notice also that even in the start of a phrase, they don't use "Uv". For example:

uv provides a standalone installer to download and install uv:

@helderco helderco Sep 24, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for "the pip interface", it's taken out of the linked page: https://docs.astral.sh/uv/pip/

Doesn't take backticks because it's not referring the pip CLI. It's a compatibility layer that uv has, that can replace pip.

```

Due to [PEP 517](https://peps.python.org/pep-0517/) and [`pip` supporting `pyproject.toml`](https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/), this means that all package managers that support the [build backend](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#declaring-the-build-backend) standard are automatically supported.
Notice that the `./sdk` and `main` (in `.`) packages don't need to be in the `requirements.lock` file, **only the third party dependencies**.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this can be formatted as a note?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't because it's already inside an "info" admonition and docusaurus doesn't render that well.

````

:::note
Uv with `uv.lock` needs to have the SDK library (`dagger-io`, generated in `./sdk`) defined as a **production** dependency, unlike the other installation methods where it should be a development dependency.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comment: if possible, could you please avoid the special formatting like ** or * unless absolutely necessary? Instead, it would be better to use note/tip/warning blocks for highlighting important aspects. The reason is that different authors tend to use this formatting for different purposes, which creates consistency issues, and readers also don't interpret it all the same way, which creates readability issues.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reduced the usage of that formatting.

helderco and others added 4 commits September 24, 2024 14:06
Signed-off-by: Helder Correia <[email protected]>
Co-authored-by: vikram-dagger <[email protected]>
Signed-off-by: Helder Correia <[email protected]>
Signed-off-by: Helder Correia <[email protected]>
@helderco
helderco force-pushed the helder/dev-4527-update-docs-about-python-project-management branch from d26cf00 to cf46a77 Compare September 24, 2024 14:24
@helderco
helderco merged commit a889063 into dagger:main Sep 24, 2024
@helderco
helderco deleted the helder/dev-4527-update-docs-about-python-project-management branch September 24, 2024 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

📖 Update docs about Python project management

2 participants