Skip to content

PythonVersions audit: test mixed runtime dependencies#18552

Closed
scpeters wants to merge 1 commit intoHomebrew:masterfrom
scpeters:audit_python_depends_mixed_runtime
Closed

PythonVersions audit: test mixed runtime dependencies#18552
scpeters wants to merge 1 commit intoHomebrew:masterfrom
scpeters:audit_python_depends_mixed_runtime

Conversation

@scpeters
Copy link
Copy Markdown
Contributor

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

I have been updating a formula in a 3rd-party tap that currently has a runtime dependency on python@3.12 (no :build or :test annotations), and I'd like to update it to depend on multiple python versions in order to build bindings against multiple versions but still depend on one version as a runtime dependency, like the following:

  depends_on "python@3.12" => [:build, :test]
  depends_on "python@3.13"

The PythonVersions audit currently complains about this:

C: [Correctable] FormulaAudit/PythonVersions: References to python@3.12 should match the specified python dependency (python@3.13)
  depends_on "python@3.12" => [:build, :test]
             ^^^^^^^^^^^^^

If there isn't a problem with depending on a mix of runtime and non-runtime versions of python, I'd like to update the audit to allow this. I've opened this as a draft PR with a failing test that should pass once the audit is updated. Please let me know if this obviously won't be accepted before I spend time to try to update the audit.

The PythonVersions cop currently complains if a formula
depends on a mixed combination of runtime and non-runtime
python versions. This adds a test to demonstrate the
behavior.
@cho-m
Copy link
Copy Markdown
Member

cho-m commented Oct 12, 2024

I had an old PR on this where general opinion was against: #16119

EDIT: Though if the usage is only 3rd party tap, it could be up for discussion on whether some checks could be made core only.

@MikeMcQuaid
Copy link
Copy Markdown
Member

it could be up for discussion on whether some checks could be made core only.

I'd be fine with this 👍🏻

@scpeters
Copy link
Copy Markdown
Contributor Author

I've thought about it, and I'll switch our formulae

I had an old PR on this where general opinion was against: #16119

thanks for the reference to the prior discussion here. In the short-term, I'll just use [:build, :test] for all python versions in our tap.

it could be up for discussion on whether some checks could be made core only.

I'd be fine with this 👍🏻

thanks for the feedback. For now I will close this since I'm not planning to work on it immediately, but I will come back to it if it seems useful to our users

@scpeters scpeters closed this Oct 14, 2024
@scpeters scpeters deleted the audit_python_depends_mixed_runtime branch March 11, 2026 03:11
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.

3 participants