-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
add --version option to pybind11-config #4526
Conversation
aed312d
to
030aefb
Compare
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.
Didn't realize we didn't already have this!
What about about a -v
shortcut? Not as important as -h
, as it sometimes is a verbosity flag. Maybe not a good idea for a new flag, just a thought.
9f9ee15
to
5440951
Compare
BTW, I need this because I'm adding a meson
Yeah, neither did I. :/
I don't think this is necessary, no one currently depends on it and the main use case is for compatibility with classic Unix foobar-config shell scripts, which tend to have --version and not -v. They also tend to use --cflags instead of --includes, but that is not so important, some of them also use |
pybind11/__main__.py
Outdated
@@ -25,6 +26,7 @@ def print_includes() -> None: | |||
|
|||
def main() -> None: | |||
parser = argparse.ArgumentParser() | |||
parser.add_argument("--version", action="version", version=__version__) |
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.
Could you please add help="Prints version and exits."
(This is almost straight from the argparse
docs for action
version
, but I didn't know, and had to look it up.)
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.
For context, I lazily didn't bother because the argparse default is to autogenerate help text for you: "show program's version number and exit"
However I'm more than happy to make this explicit. I've tweaked your suggested wording to better fit in with the style of __main__.py
which consistently uses imperative mood, so "Prints" -> "Print".
Without this, it's impossible to get feature parity between detection mechanisms. Both the pkg-config file and the cmake config set their versions, but the python probe script didn't provide an option for this. So you could print the compiler flags for using it, but you could not check what you got.
5440951
to
27651c9
Compare
I'm fine with sticking with |
@henryiii I added a Suggested changelog entry to the PR description, based on my rather superficial understanding, hoping it's a better start than nothing. |
Thanks. For documentation purposes, when I refer to this fix -- should I write that the fix will be in pybind11 2.10.4 or 2.11.0? I'm assuming probably the former? |
Related: do you have an example of the best way to use pybind11 & meson together (probably in the context of meson-python)? A quick search got me to mesonbuild/meson#4677 (comment). I'm guessing this will be nicer with the 2.10.4 depends on if we have enough to make it worth backporting before 2.11. Don't think we are moving very quickly towards 2.11, though, so I'd say it's possible there will be a 2.10.4. I'll let know know if I know more. (If there is a 2.10.4, this should be in it) |
Yes, that has to be added to meson because The idea is that people should be able to just do this: dependency('pybind11') and that will most likely find the pybind11-config installed to $PATH (including to the $PATH of a pip build isolation environment). Although if the global version is installed, it may find the pkg-config or cmake file instead. |
Does the meson.build file in https://github.com/scikit-hep/cookie/pull/124/files look fine? I'm assuming the stuff in the middle of it can become |
I left a comment there. |
Without this, it's impossible to get feature parity between detection mechanisms. Both the pkg-config file and the cmake config set their versions, but the python probe script didn't provide an option for this. So you could print the compiler flags for using it, but you could not check what you got.
There will be a 2.10.4, it's nearly ready except for #4301. |
Released 2.10.4. |
Description
Without this, it's impossible to get feature parity between detection mechanisms. Both the pkg-config file and the cmake config set their versions, but the python probe script didn't provide an option for this.
So you could print the compiler flags for using it, but you could not check what you got.
Suggested changelog entry: