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

[Python] Run acceptance tests against the latest snapshot #2523

Merged

Conversation

kanterov
Copy link
Collaborator

@kanterov kanterov commented Mar 19, 2025

Changes

Run acceptance tests against the latest snapshot. We add matrix tests, including both the latest snapshot and the latest release, so we don't break compatibility.

We prebuild a wheel with the latest code and reuse it across acceptance tests. The approach of installing from the source directory doesn't work:

  1. uv doesn't have a build tool, so it takes 10 seconds for setuptools
  2. we can't reuse the same directory and cache, because setuptools can't be used concurrently

@kanterov kanterov changed the title Kanterov/python acceptance tests pt2 [Python] Run acceptance tests against the latest snapshot Mar 19, 2025
@kanterov kanterov force-pushed the kanterov/python-acceptance-tests-pt2 branch 3 times, most recently from 89518e2 to ac772cd Compare March 20, 2025 16:56
@kanterov kanterov marked this pull request as ready for review March 20, 2025 18:58
@denik
Copy link
Contributor

denik commented Mar 21, 2025

uv doesn't have a build tool, so it takes 10 seconds for setuptools

Would it make sense / is it possible to switch backend to something more lightweight? e.g. flir_core is 50KB vs 1.4MB setuptools.

Can we vendor build backend in acceptance folder specifically so that we don't need to download anything?

10s is a lot of waiting time for a case when I want to run specific test cases that has nothing to do with python mutator. This is something I do many times per day.

Related to this, can we only build it if we see that there are tests that are going to be using it? We know parse the config before starting a test, so we can have RequiresPythonBuild option to signal to test runner that we need to build it beforehand.

we can't reuse the same directory and cache, because setuptools can't be used concurrently

when are we using it concurrently? C

@kanterov
Copy link
Collaborator Author

@denik

when are we using it concurrently?
Because we run tests concurrently

I've experimented with flit:

  • with setuptools build takes ~1 second (cold cache)
  • with flit build takes ~100ms (cold cache)

There are slight differences in metadata:

  1. databricks/__init__.py wasn't included with setuptools, it's a bug
  2. flit doesn't set License field in METADATA, only License-File. Setuptools inlines license text into License field in addition to specifying License-File
  3. flit doesn't create top_level.txt with "databricks" in it. From what I know, it's very intentional because top_level.txt is only used by legacy tools.

Do you think we can switch to flit and resolve the problem this way? I'm not a big fan of setuptools overall

@kanterov
Copy link
Collaborator Author

@denik can you please take a look?

@kanterov kanterov closed this Mar 25, 2025
@kanterov kanterov reopened this Mar 25, 2025
Copy link
Contributor

@denik denik left a comment

Choose a reason for hiding this comment

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

Seems fast enough: "took 513.060481ms"

If it stays under 1s, then we can keep on critical path, otherwise let's think about optimizations I mentioned.

Should we run "uv build" with "-q" or is the output below something you want to see every time?

      acceptance_test.go:782: [uv build --wheel --out-dir /home/runner/work/cli/cli/acceptance/build/linux_amd64] took 513.060481ms
      acceptance_test.go:786: [uv build --wheel --out-dir /home/runner/work/cli/cli/acceptance/build/linux_amd64] output: Building wheel...
          Version number normalised: '0.243.0-dev' -> '0.243.0.dev0' (see PEP 440)
          Version number normalised: '0.243.0-dev' -> '0.243.0.dev0' (see PEP 440)
          Successfully built /home/runner/work/cli/cli/acceptance/build/linux_amd64/databricks_bundles-0.243.0.dev0-py3-none-any.whl
      acceptance_test.go:115: Writing coverage to /home/runner/work/cli/cli/acceptance/build/cover
      acceptance_test.go:782: [go build -mod vendor -o /home/runner/work/cli/cli/acceptance/build/linux_amd64/databricks -cover] took 25.826919651s
      acceptance_test.go:136: $TMPHOME=/tmp/TestAccept4161202475/001
      acceptance_test.go:237: Summary: 126/133/133 run/selected/total, 7 skipped


@kanterov kanterov force-pushed the kanterov/python-acceptance-tests-pt2 branch from 5939b43 to f68a8ab Compare March 25, 2025 09:02
@kanterov kanterov force-pushed the kanterov/python-acceptance-tests-pt2 branch from da7b80f to fade5f4 Compare March 25, 2025 09:15
Copy link

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

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 2523
  • Commit SHA: fade5f451b589d9a115cef9dffb5daf03bfae7c3

Checks will be approved automatically on success.

@kanterov
Copy link
Collaborator Author

flit doesn't like symlink we have added for LICENSE file to avoid duplication

@kanterov kanterov requested a review from pietern March 25, 2025 09:28
@kanterov
Copy link
Collaborator Author

@pietern do you think it's ok to change like that?

@kanterov kanterov enabled auto-merge March 25, 2025 10:19
@kanterov kanterov added this pull request to the merge queue Mar 25, 2025
Merged via the queue into databricks:main with commit 4c5711d Mar 25, 2025
15 checks passed
@kanterov kanterov deleted the kanterov/python-acceptance-tests-pt2 branch March 25, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants