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

Format default-python template #2110

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

Conversation

kanterov
Copy link
Contributor

@kanterov kanterov commented Jan 9, 2025

Changes

Format code in default-python template, so it's already pre-formatted.

Tests

$ databricks bundle init libs/template/templates/default-python
$ ruff format --diff my_project     
6 files already formatted

Copy link
Contributor

@shreyas-goenka shreyas-goenka left a comment

Choose a reason for hiding this comment

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

Thanks!

@kanterov
Copy link
Contributor Author

kanterov commented Jan 9, 2025

Looks like the same problem exists in libs/template/templates/default-python/template/{{.project_name}}/scratch/exploration.ipynb.tmpl, not sure why I haven't caught it, possibly it isn't included by default

version={{.project_name}}.__version__ + "+" + datetime.datetime.utcnow().strftime("%Y%m%d.%H%M%S"),
version={{.project_name}}.__version__
+ "+"
+ datetime.datetime.utcnow().strftime("%Y%m%d.%H%M%S"),
Copy link
Contributor

Choose a reason for hiding this comment

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

could you increase line width? This should fit in one line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't fit with the default formatting settings, that I believe the majority of developers use. We can extract the version suffix into a separate variable to avoid breaking the line. WDYT?

Copy link

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 2110
  • Commit SHA: 6f4ba743510f4eecaff9b8885e30fa4272306246

Checks will be approved automatically on success.

@kanterov
Copy link
Contributor Author

@denik Updated using a new variable, PTAL

Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

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

@denik @kanterov We should also have test coverage for this and other templates. Formatting will regress without it.

@denik
Copy link
Contributor

denik commented Jan 10, 2025

@pietern @kanterov I agree, we should add 'ruff' to CI and 'make ruff'.

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.

4 participants