Skip to content

Various updates build_file_generation example - #869

Merged
alexeagle merged 4 commits into
bazel-contrib:mainfrom
lionkube:example-updates
Dec 21, 2022
Merged

Various updates build_file_generation example#869
alexeagle merged 4 commits into
bazel-contrib:mainfrom
lionkube:example-updates

Conversation

@chrislovecnm

@chrislovecnm chrislovecnm commented Oct 25, 2022

Copy link
Copy Markdown
Contributor

This PR covers various updates and addition to the example. I am writing a python tutorial much like the go tutorial.

Updating the WORKSPACE file and BUILD file inline documentation.
Added new source code
Added new unit test

@chrislovecnm
chrislovecnm force-pushed the example-updates branch 3 times, most recently from 6099634 to a80dc3c Compare October 27, 2022 19:09
@chrislovecnm
chrislovecnm marked this pull request as ready for review December 6, 2022 18:56
@chrislovecnm
chrislovecnm marked this pull request as draft December 6, 2022 18:57
@chrislovecnm
chrislovecnm marked this pull request as ready for review December 6, 2022 19:01
@chrislovecnm
chrislovecnm force-pushed the example-updates branch 2 times, most recently from be0739e to bc9c36f Compare December 6, 2022 21:18
@chrislovecnm

Copy link
Copy Markdown
Contributor Author

@alexeagle @f0rmiga @rickeylev PTAL

@chrislovecnm
chrislovecnm force-pushed the example-updates branch 2 times, most recently from 6201f9b to 47a04ae Compare December 6, 2022 21:35
@f0rmiga
f0rmiga requested review from f0rmiga and removed request for rickeylev December 7, 2022 00:33
f0rmiga
f0rmiga previously requested changes Dec 7, 2022
Comment thread examples/build_file_generation/BUILD Outdated
Comment thread examples/build_file_generation/WORKSPACE Outdated
Comment thread examples/build_file_generation/WORKSPACE Outdated
Comment thread examples/build_file_generation/WORKSPACE Outdated
Comment thread examples/build_file_generation/WORKSPACE Outdated
Comment thread examples/build_file_generation/WORKSPACE Outdated
Comment thread examples/build_file_generation/WORKSPACE Outdated
Comment thread examples/build_file_generation/WORKSPACE Outdated
Comment thread examples/build_file_generation/gazelle_python.yaml Outdated
Comment thread examples/build_file_generation/__main__.py Outdated
@chrislovecnm

chrislovecnm commented Dec 9, 2022

Copy link
Copy Markdown
Contributor Author

@f0rmiga I have made the updates you requested and reformatted the example code. I am hitting a weird thing though.

$ bazel run //:gazelle -- update
INFO: Analyzed target //:gazelle (1 packages loaded, 2 targets configured).
INFO: Found 1 target...
Target //:gazelle up-to-date:
  bazel-bin/gazelle-runner.bash
  bazel-bin/gazelle
INFO: Elapsed time: 3.373s, Critical Path: 0.04s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
gazelle: ERROR: failed to validate dependencies for target "@build_file_generation_example//random_number_generator:random_number_generator_test": "generate_random_number" at line 16 from "random_number_generator/__test__.py" is an invalid dependency: possible solutions:
	1. Add it as a dependency in the requirements.txt file.
	2. Instruct Gazelle to resolve to a known dependency using the gazelle:resolve directive.
	3. Ignore it with a comment '# gazelle:ignore generate_random_number' in the Python file

But unit test will run and is working fine. The dependencies are not wrong. Thoughts?

@f0rmiga

f0rmiga commented Dec 9, 2022

Copy link
Copy Markdown
Member

Add an __init__.py file under the random_number_generator folder.

@chrislovecnm

Copy link
Copy Markdown
Contributor Author

Add an __init__.py file under the random_number_generator folder.

This is not working. Let me know if you have any ideas.

Updating the WORKSPACE file and BUILD file inline documentation.
Added new code and new directories for example.  Added new
unit test for example.
Added license headers.
- updating gazelle version to 0.28
- updating go version to 1.19.4
- added requirements_windows.txt from running //:requirements.update on
windows
- modified WORKSPACE and BUILD files to include different
requirements.update when running the build on Windows

@generated by rules_python pip_parse repository rule
from //:requirements.txt
from @//:requirements.txt

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 had to do update this to get CI to pass

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.

I believe it is related to Bazel 6 #938

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.

@groodt yep

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.

That is spooky that our CI uses a floating version of bazel rather than what's pinned in our .bazelversion file - I think we ought to fix that along with updating that golden file.

@chrislovecnm

Copy link
Copy Markdown
Contributor Author

@alexeagle this got log jammed on @f0rmiga review which I addressed. Any ideas?

@alexeagle
alexeagle dismissed f0rmiga’s stale review December 21, 2022 23:48

Is on vacation

@alexeagle
alexeagle merged commit fcd0328 into bazel-contrib:main Dec 21, 2022
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