haxsaw/hikaru

Unpin Black version

Closed this issue · 2 comments

"Black" version < 22.3.0 has issues and conflicts with "click" >= 8.1.0. Thus the version range that is pinned is causing conflicts in many of our projects.

Additionally, "Black" is a code quality tool - thus is should be specified in "extras_require" section, not the main "install_requires" - since it is not actually needed to install the package externally.

I recommend to create a "dev" section under "extras_require" and pin "black" there if needed - or unpin it alltogether.

Thanks for this ticket, it reminded me of an issue that had fallen through the cracks. But my quick review for this is telling me that you may not be a fan of the answer.

But indulge me to share some background first.

So I previously have been in touch with the black team looking for a function call that I can use to pass in a string of Hikaru-generated code and get formatted code back. The black team acknowledged that people wanted this and directed me to a non-published function that I could call to get the capability that I needed (Hikaru doesn't use the command-line form of black). My recollection was that they recommended me pin Hikaru at this release until they officially addressed the issue, which is why it's currently pinned. I have been keeping an eye on black and saw that they reached their 1.0 release and have been meaning to check for the official API, but that got lost in the same swamp of events that made Hikaru 0.12.0b late.

Back to the present: I took a moment to have a look at black as I'm currently getting ready for a trip, and unfortunately their FAQ says they still don't have an official API, but one is 'coming'. I don't have the time to peek under the covers to see if the private function is still available, but if not, I have a feeling that I'm going to have to switch to autopep8 as a formatter, as they do what I need and expose and API (but I found it a bit slower and didn't like the format quite as much). But this will be a pretty simple solution to the pinning problem and shouldn't be hard to do with a point release, once I get the worst of my tasks on this trip behind me.

One of these two will allow me to establish unpinned dependencies on the code formatter. Stay tuned.

haxsaw commented

OK, it looks like the black team are maintaining the existence and functionality of that private interface, so the next release will update the requirements to allow a range of black releases (this is coming quite soon).