Skip to content

Making converter a cmd line script instead of a file that must be edited to be used#172

Merged
ptrbortolotti merged 3 commits intomainfrom
cmdline_converter
Jan 16, 2026
Merged

Making converter a cmd line script instead of a file that must be edited to be used#172
ptrbortolotti merged 3 commits intomainfrom
cmdline_converter

Conversation

@gbarter
Copy link
Collaborator

@gbarter gbarter commented Dec 10, 2025

Previously, the windio v1->2 converter had to be edited in the if __name__==__main__ section with the path to the input file. These changes make the converter a command line script where the usage is:

524 09:27:06 gbarter-37067s:~/devel/WindIO/windIO/converters $./windIO2windIO.py --help
usage: windIO2windIO.py [-h] [-i INPUT] [-o OUTPUT]

WindIO v1->v2 Converter

options:
  -h, --help           show this help message and exit
  -i, --input INPUT    Input v1 filename path
  -o, --output OUTPUT  Output v2 filename path

The script is also now executable and can be called from the command line without the python preface if desired.

@gbarter
Copy link
Collaborator Author

gbarter commented Dec 10, 2025

@fzahle - Not sure what is tripping up the docs build. Let me know if you want me to dig into that. Did you set that up originally or was that Rafael?

@rafmudaf
Copy link
Collaborator

Just fwiw if you configure the [project.scripts] setting in pyproject.toml, you'd have access to the package name as a command line utility. So from any directory (so long as the correct environment is activated), you could do something like windIO --convert-from-v1 oldwindio.yaml. Here's a fairly verbose guide, but you can skip to the end to see the final usage: https://dev.to/demianbrecht/entry-points-in-python-34i3. If you like it, I'm happy to help set it up.

@gbarter
Copy link
Collaborator Author

gbarter commented Dec 12, 2025

Just fwiw if you configure the [project.scripts] setting in pyproject.toml, you'd have access to the package name as a command line utility. So from any directory (so long as the correct environment is activated), you could do something like windIO --convert-from-v1 oldwindio.yaml. Here's a fairly verbose guide, but you can skip to the end to see the final usage: https://dev.to/demianbrecht/entry-points-in-python-34i3. If you like it, I'm happy to help set it up.

Great point and reminder. Yes, we do this in WISDEM for a couple scripts. It is a level up on user intrusiveness though, so I'll defer to @kenloen and other keepers of the WindIO to decide if they want to go that route. I would be happy to put in the necessary changes.

@kenloen
Copy link
Collaborator

kenloen commented Dec 15, 2025

I think it would be great to elevate the converter CLI tool that @gbarter added to a CLI tool of windIO like @rafmudaf suggest.

The exact API for it could potentially be discuss (e.g. should the both the converter and validator be exposed as CLI tools?!). But in the interest of just adding it for now I guess we can just flag as a beta version and that the API might change in the future?

@gbarter
Copy link
Collaborator Author

gbarter commented Dec 16, 2025

Sounds good! I have added a windio_converter script that is installed with the package.

@gbarter
Copy link
Collaborator Author

gbarter commented Jan 7, 2026

@kenloen - Good to merge here?

@gbarter gbarter requested a review from kenloen January 7, 2026 15:14
Copy link
Collaborator

@kenloen kenloen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
Sorry for not getting back before.

Copy link
Collaborator

@fzahle fzahle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like the docs build CI test fails, maybe that's some of the stuff I tinkered with, so probably something I have to fix...

@fzahle fzahle self-requested a review January 8, 2026 12:39
@gbarter
Copy link
Collaborator Author

gbarter commented Jan 8, 2026

looks like the docs build CI test fails, maybe that's some of the stuff I tinkered with, so probably something I have to fix...

I think @ptrbortolotti was able to fix that in #178 . . .

@fzahle
Copy link
Collaborator

fzahle commented Jan 8, 2026

ah yes. so if you can just cherry-pick that commit, then we can merge

@ptrbortolotti ptrbortolotti merged commit 3516b49 into main Jan 16, 2026
14 checks passed
@ptrbortolotti ptrbortolotti deleted the cmdline_converter branch January 16, 2026 17:14
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.

5 participants