-
Notifications
You must be signed in to change notification settings - Fork 9
add requirements deps automatically #10
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
# Marker that this is the root of a Bazel workspace. | ||
workspace("rules_python_pytest") |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ See https://docs.bazel.build/versions/main/skylark/deploying.html#dependencies | |
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_archive = "http_archive") | ||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") | ||
load("@rules_python//python:pip.bzl", "pip_parse") | ||
|
||
def http_archive(name, **kwargs): | ||
maybe(_http_archive, name = name, **kwargs) | ||
|
@@ -34,3 +35,11 @@ def rules_python_pytest_dependencies(): | |
strip_prefix = "rules_python-0.6.0", | ||
url = "https://github.com/bazelbuild/rules_python/archive/0.6.0.tar.gz", | ||
) | ||
|
||
def setup_pytest_requirements(interpreter): | ||
pip_parse( | ||
name = "pytest_requirements", | ||
python_interpreter_target = interpreter, | ||
quiet = False, | ||
requirements_lock = "@rules_python_pytest//:e2e/smoke/requirements.txt", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we want production code depending on test code. Are these requirements something we can bring into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, we don't. This proves the concept. Can certainly reshape this to be its own target. Any suggestions? |
||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a bzlmod example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have to cook one up. Haven't done much with bazelmod yet. It's been high friction so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a bad idea for requirements to be installed by external packages. They aren't constraint-solved with the user's app code, they don't see the lockfile, and they don't have control over the version.
Just expect the user to provide a pytest label (can default to
@pip//pytest
for convenience)