-
Notifications
You must be signed in to change notification settings - Fork 791
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
CLI: add --version long argument to return PROJ version #3836
base: master
Are you sure you want to change the base?
Conversation
3a68d7d
to
fb9e68f
Compare
I think this is a good idea. Can you please include an example here? Also, remember to adjust the docs as well so that this feature isn't a secret. |
The gie and cct utilities already implement --version with the following output:
I guess with your proposed change, you'd reduce this to You could also change proj_info() in src/4D_api.cpp to change "info.version = version;" to "info.version = pj_get_version()" |
I wouldn't mind it if the date disappeared from the |
proj_info() reports 2 fields ".version=X.Y.Z" and ".release=Rel. X.Y.Z, date" |
Thanks @lbartoletti! To give context, I need to identify the installed PROJ version to adapt some parts of my logic. After some research, I've ended on this: import re
import subprocess
proj_output = check_output(["proj"], stderr=STDOUT, text=True)
version_match = re.search(r"Rel\. ([0-9.]+)", proj_output):
if version_match:
print(version_match.group(1)) But I did not know cie and cct! See also:
|
@rouault this is one of the few things I cannot talk myself into having an opinion of 🙂 - but thanks for pinging me on the subject! |
There are quite a few implementations for this depending on the program. One option to consider could be to provide a simple version (easier to parse for the use case of this PR) and a more verbose version like Python does. $ python --version
Python 3.10.10
$ python -V
Python 3.10.10
$ python -VV
Python 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0] |
Side note:
|
Code pyproj uses to get the |
This is so needed, thank-you @lbartoletti for pushing this. |
(initially reported at #2640 ) |
Indeed, However, in our case, -VV is not possible, since it's used for verbosity in proj app. May I suggest:
|
J'ai aussi ajouté une réf à OSGeo/PROJ#3836
Personally, I would just stick with below for the sake of simplicity (most more popular utilities than the PROJ ones have just --version, so it might be over-engineered to offer 3 variants for PROJ...):
The long version with the release date doesn't bring that much, given the release date is something that is a 1:1 match with the version number. |
As a packager, this release date causes confusion to users (the date is often in the future, which causes confusion for the user, and grief for the packager). It would be good to not include this, in any utility. |
Can someone give an educated guess as to what the impact of changing the output of |
9245703
to
aff3250
Compare
The PROJ project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last two months and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
Not staled |
The PROJ project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last two months and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
While we hate to see this happen, this PR has been automatically closed because it has not had any activity in the last 2 months. If this pull request should be reconsidered, please follow the guidelines in the previous comment and reopen this pull request. Or, if you have any further questions, just ask! We love to help, and if there's anything the PROJ project can do to help push this PR forward please let us know how we can assist. |
Still interested in this feature and homogenization work. |
I agree that this is a sane and useful change but since I haven't received any feedback to this
I can't really make a decision on how to proceed. For now I am inclined to not merge this PR and instead streamline the version options of the various CLI utilities in a future 10.0 release. |
@kbevers can you leave this PR open and possibly add a label to it of "10.0 release" ? I am sure that @lbartoletti can adapt the changes to anything that you need for 10.0 Thanks for all of this effort @lbartoletti, it is very useful to the community. |
Well that's funny. Just opened a feature request issue for this exact feature. Happy to see it's implemented! Fixes #3980 |
The proposed
--version
option will enable users to easily retrieve the application's version without having to refer to documentation or resort to external means. This feature is essential for testing various behaviors and fulfilling a specific user requirement.I have tried to adhere to the existing code conventions while implementing this feature. As of now, the changes have been applied only to one utility, but if it's OK, I'll extend the same modifications to other apps.
cc @Guts
--version
CLI arg to all commands (e.g.,proj
,projsync
, etc.) #3980, Add --version #2640docs/source/*.rst
for new API