Skip to content

EDIT: Update python code guide and include linting, formatting and type checking #22737

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

estebanx64
Copy link
Contributor

@estebanx64 estebanx64 commented Jun 2, 2025

Description

  • I updated the code in the main Python guide. I noticed some deprecations in the libraries. I made a refactor and updated the whole code to be totally up to date with the recent library version
  • I added a section about linting, formatting, and type checking to follow the best practices. I include them in the CI/CD too

@craig-osterhout
@usha-mandya

  • Technical review
  • Editorial review
  • Product review

Copy link

netlify bot commented Jun 2, 2025

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit 6973c8d
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/6852349102ea5b000848df2c
😎 Deploy Preview https://deploy-preview-22737--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@estebanx64 estebanx64 marked this pull request as draft June 2, 2025 02:44
@estebanx64 estebanx64 changed the title EDIT: Update python code guide and include linting, formatting and ty… EDIT: Update python code guide and include linting, formatting and type checking Jun 2, 2025
@estebanx64 estebanx64 marked this pull request as ready for review June 2, 2025 02:46
@craig-osterhout craig-osterhout requested a review from a team June 2, 2025 18:31
@craig-osterhout
Copy link
Contributor

Noting that we'll get #22676 merged first before reviewing as it will cause conflicts.

@craig-osterhout
Copy link
Contributor

Hi @estebanx64, thank you for updating this. The PR mentioned above has been merged and is causing a conflict. Please help resolve the conflicts and let me know if you need any help.

@estebanx64
Copy link
Contributor Author

Hi @craig-osterhout, is yours now

Copy link
Contributor

@craig-osterhout craig-osterhout left a comment

Choose a reason for hiding this comment

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

Thank you for adding this, @estebanx64. It's looking really good. Added a few small style suggestions.

@@ -0,0 +1,122 @@
---
title: Linting, Formatting and Type Checking for Python
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
title: Linting, Formatting and Type Checking for Python
title: Linting, formatting, and type checking for Python

@@ -0,0 +1,122 @@
---
title: Linting, Formatting and Type Checking for Python
linkTitle: Linting and Typing
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
linkTitle: Linting and Typing
linkTitle: Linting and typing

- Static type checking with Pyright
- Automating checks with pre-commit hooks

## Linting and Formatting with Ruff
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## Linting and Formatting with Ruff
## Linting and formatting with Ruff

ruff format .
```

## Type Checking with Pyright
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## Type Checking with Pyright
## Type checking with Pyright


These tools help maintain code quality and catch errors early in development.

## Next Steps
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## Next Steps
## Next steps


## Setting up pre-commit hooks

Pre-commit hooks automatically run checks before each commit. in `.pre-commit-config.yaml` sets up Ruff:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Pre-commit hooks automatically run checks before each commit. in `.pre-commit-config.yaml` sets up Ruff:
Pre-commit hooks automatically run checks before each commit. The following `.pre-commit-config.yaml` snippet sets up Ruff:


## Next Steps

- [Configure Github Actions](configure-github-actions.md) to run these checks automatically
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- [Configure Github Actions](configure-github-actions.md) to run these checks automatically
- [Configure GitHub Actions](configure-github-actions.md) to run these checks automatically

Pre-commit hooks automatically run checks before each commit. in `.pre-commit-config.yaml` sets up Ruff:

```yaml
: https: https://github.com/charliermarsh/ruff-pre-commit
Copy link
Contributor

Choose a reason for hiding this comment

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

The YAML line starts with :. I'm guessing it's a typo, but I'm not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants