Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adding run-clang-format to PyPI #37

Open
carlosperate opened this issue Nov 3, 2022 · 3 comments
Open

Adding run-clang-format to PyPI #37

carlosperate opened this issue Nov 3, 2022 · 3 comments

Comments

@carlosperate
Copy link

First of all, thanks for creating this great wrapper around clang-format, it makes running it locally and on CI much more easy and useful!

Now that clang-format is packaged in PyPI (https://pypi.org/project/clang-format/) would you consider adding this package to PyPI and configuring clang-format as a dependency? That way users could just pip install run-clang-format (or even better using pipx we could pipx install run-clang-format!), and be able to use this tool very easily.

@Sarcasm
Copy link
Owner

Sarcasm commented Nov 3, 2022

Hello,

See my previous answer here:

@carlosperate
Copy link
Author

carlosperate commented Nov 3, 2022

Thanks for the quick response @Sarcasm!

From my point of view, as a user, it's a lot nicer to be able to be able install this as part as any other Python dependencies and run it like any other tool (specially since CMake and Ninja are also in PyPI). Even more so in a CI environment, where we can easily get everything installer with a single pip command. It also means it's easier to see if there are new releases and update when appropriate. Vendoring tools usually end up with rotting files, but to be fair, that is the users' responsability.
And it is true, that packing it moves some of that burden from the users to the maintainer.

I've be happy to submit a PR to sort out the packaging, and to configure GitHub actions to submit it to PyPI via github tag if that helps? That way the only thing needed is to set up the PyPI keys via GitHub secrets and push a git tag to get the automation going.

If you still prefer not to package it, would you be against somebody else packaging it and publishing to PyPI? Of course, I'd make sure the description clearly gives the proper attribution an indicates all packaing issues should be directed to a different issue tracker.

@Sarcasm
Copy link
Owner

Sarcasm commented Nov 5, 2022

It also means it's easier to see if there are new releases and update when appropriate. Vendoring tools usually end up with rotting files, but to be fair, that is the users' responsability.

The thing is that run-clang-format.py is deliberately dependency-less (just Python stdlib and clang-format).
And it's mostly one use case, running clang-format on the project.
Eventually, clang-format changes, and you want the new feature, then you can lookup run-clang-format for an update.
But you won't gain or lose much lagging behind.
Upgrading clang-format needs to be somewhat controlled, output can varies from version to versions, so blindly updating may not be advised IMHO.
run-clang-format.py a single text file, so usually easy to embed in a VCS-tracked project.

Thinking about it, if I really wanted to package it, I would consider upstreaming it to the llvm project, like run-clang-tidy is (the source of inspiration for run-clang-format).
That way, the clang-format pip package could also distribute it then, I think.

That said, I can consider a PR for a PyPI package via Github actions and I would not be offended by an independent pip package either.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants