beartype / beartype

Unbearably fast near-real-time hybrid runtime-static type-checking in pure Python.
https://beartype.readthedocs.io
MIT License
2.75k stars 57 forks source link

macOS Package Management Documentation #12

Closed harens closed 3 years ago

harens commented 3 years ago

Hi there! 👋

I was so impressed by @leycec's way of writing issues/README/etc. (it's amazing ✨) that I felt compelled to help in the way I knew best, macOS package management.

Unfortunately, Homebrew doesn't really do python modules, so following https://github.com/macports/macports-ports/pull/9756, beartype has been added to MacPorts! Here is the Project Page.

I am notified whenever you release a new version on GitHub, so I will aim to update the Portfile with your release (and I have generally been pretty consistent with this for the other ports I maintain).

I opened this issue since I thought it might be useful to document this. Let me know if you have any questions about this, and thank you very much for this project 👍.

Packaging status

EDIT: I nearly forgot, here's how to install the project:

sudo port install py-beartype
leycec commented 3 years ago

Mother of sweetness incarnate. Your dedication to our powerful cause of well-typed Python on a much more popular and usable platform than mine inspires me to do something.

(it's amazing :sparkles:)

Flattery will get you everywhere, giant ducky. :duck: :bath:

Unfortunately, Homebrew doesn't really do python modules...

This. It hurts me. I adore (A) the Ruby-based DSL for Homebrew brewfiles, (B) the alcoholic emphasis on humour-friendly verbs and nouns, and (C) the taps infrastructure that backports a subset of older versions of popular brews. casks is delicious, too. This is all good.

I didn't realize they mostly refused to package Python packages, though. This is bad... and irrational, frankly. Python packages are treated just like any other on most of the package managers I'm intimate with like apt, emerge, and pacman. Heck, even chocolatey packages Python packages. That's when you know it's bad.

Fascinatingly, Homebrew once was Python-friendly. In a bygone halcyon age of wonder and mystery, they used to package the standard scientific stack (e.g., NumPy, SciPy, matplotlib) under homebrew/science. They stopped for dubious and doubtless unjustifiable reasons in 2018:

Homebrew is not the right way to install scientific python packages.

It was, actually. You just arbitrarily decided it wasn't.

Well, then. Software opinionation is a really efficient way to force a userbase to switch to That Other Guy, which is why we shy away from that uniquely suicidal behaviour here at Beartype & Friends.

I mean, I loathe and despise typing.NewType just as much as the next runtime type-checking developer ...all two of us – but we still support it with minimum snark and maximum compatibility, even though I still want to emit non-fatal warnings that would only make everyone hate me. I step away from the keyboard when the urge arises. But it's a close call every day.

Curse your sclerotic livers, Homebrew maintainers. Curse all those livers.

...beartype has been added to MacPorts!

So. MacPorts. It's come to this.

It goes without saying that you are awesome and so are your packages. I am in your debt and shall repay you by repeatedly thanking you with emoji like :hushed: and :love_you_gesture: in every GitHub thread you appear in until you block me.

I'd love to take your package for a test drive myself. Sadly, planned obsolescence has rendered my several wheezing MacBooks unusable for any useful tasks – including even basic Homebrew and MacPorts usage. I get choked up just contemplating their sleek finishes and dextrous trackpads.

...I will aim to update the Portfile with your release...

As a fellow package manager, I can only sympathise with what I've internalized as "the bump grind" – the vampiric drain on scarce volunteer time, emotional and intellectual focus, and amorphous (but essential) spiritual energy needed to synchronize downstream OS-specific packages against a continual churn of upstream repository commits and new stable releases.

That's probably why I don't do it anymore until someone begs on my issue tracker with desparation, because I appreciate skillful begging.

[Incoming Version Alert] We should have a new minor beartype 0.5.2 release for you by the end of the month. Our changelog has begun to clog with scummy breakage vital improvements, which means the time of prophesy draws near. In theory, this should be a trivial bump on your end.

Of course, in theory, I still have hair.

I opened this issue since I thought it might be useful to document this.

This will happen, or my username isn't what it is, which it is, which means this will happen.

leycec commented 3 years ago

Bwa-hah! We now both:

It is done. Thanks again for your voluminous support, @harens. May the giant rubber ducky be with you always.

harens commented 3 years ago

All I can say is thank you @leycec :) Thank you for your kind works and the time you put into writing that comment. It really means a lot and genuinely made my day.

I can only sympathise with what I've internalized as "the bump grind"...

That is true. Fortunately, I have it all automated on my end so it only takes a minute. I'm trying to get a GitHub Action for this up and running and I'll let you know if it amounts to anything.

I really do mean it when I say thank you @leycec for maintaining this great project. Looking forward to bumping the Portfile at the end of this month.

leycec commented 3 years ago

I'm trying to get a GitHub Action for this up and running and I'll let you know if it amounts to anything.

Oh, boy. This is me making giddy sounds, because that sounds like the Big Boss of GitHub package automation.

The best I've personally seen so far is conda-forge, a third-party Anaconda service that automatically bumps Anaconda packages whenever the corresponding PyPI package is bumped. It's... absurdly insane, actually. They have my undying respect, which will only matter should I unfortunately turn undead later in life.

Looking forward to bumping the Portfile at the end of this month.

JoJo stare

harens commented 3 years ago

The best I've personally seen so far is conda-forge, a third-party Anaconda service that automatically bumps Anaconda packages whenever the corresponding PyPI package is bumped. It's... absurdly insane, actually.

Funny thing you say that.

So...we already know that Homebrew can't really make up their mind about python packages. I therefore thought about creating a 3rd party tap for beartype. With a bit of tinkering, I've got a formula that works! (inspired by py2cairo)

I made a tap to host the formula at harens/homebrew-bear with an automated build system to create pre-compiled bottles for macOS Catalina, Big Sur and x86_64 Linux.

Currently, it can be installed by running the following:

brew install harens/bear/beartype

But I was hoping that if the @beartype organisation wanted to own it (and I'd be more than happy to transfer it), then it would be installed by running the following:

brew install beartype/bear/beartype

Note that it can be whatever you want in the middle, not necessarily bear 🐻. Let me know if you have any ideas since I couldn't think of anything better.

Also note that the latest commit can be installed by adding the --HEAD flag, which I think is pretty cool.

How it works

There's a bumping workflow that runs every 12 hours checking for new versions (there's also a workflow_dispatch to run it manually). If it detects a new version, it will send a PR bumping the version number and checksums.

Once the PR is sent, the bottles are built for the new version. It is very important that this PR is not merged and all the tests finish.

If everything looks good, add a beary cool label (only if all the tests have finished), and then the formula's checksums and bottles will be updated. See https://github.com/harens/homebrew-bear/pull/3 as an example.

\ Credit for this awesomeness must go to dawidd6/homebrew-tap, which this tap is based heavily off (with a few minor tweaks to make it better for python packages and to add some bear puns). Fortunately they state the following:

Everything in this repository is free to grab, no license.

If you do want to own the tap, I'd be honoured for a start 😃, but I would then license it as you wish. I presume an MIT License under your name to keep things simple? Please correct me if I'm wrong on this.

As always, let me know if anything's unclear and thanks for your hard work on this project.

leycec commented 3 years ago

You are officially the Joestar of Python packaging. I mean...

Pawsibly the only homebrew tap...

Come on! This is spittle-flecked laughter erupting from deep within me.

I made a tap to host the formula at harens/homebrew-bear with an automated build system to create pre-compiled bottles for macOS Catalina, Big Sur and x86_64 Linux.

wat

I am speechlessly punching the frigid Canadian air. I also did not know sudo-less Homebrew on Linux was a thing. It is, though. Together, we have now levelled up my Knowledge statistic from 0 to slightly more than 0.

But I was hoping that if the @beartype organisation wanted to own it (and I'd be more than happy to transfer it)...

Yes, please. We would be delighted to absorb your impenetrable by-product into our own gelatinous conglomerate of repositories. I will, of course, immediately grant you full co-ownership over said repository.

Note that it can be whatever you want in the middle, not necessarily bear :bear:. Let me know if you have any ideas since I couldn't think of anything better.

I am stuffed with ideas, but they are stuffy ideas, because they are mine.

On the one paw, beartype/bear/beartype is deliciously redundant, memorable, and invites inevitable comparisons to the three little bears. God Bear rest their souls. These are favourable selling points. This may be the best any mortal primate can do.

On the other paw, viable alternatives also exist. Assuming there's no practical constraints on the middle term, I cogitated these up:

Personally, I'm partial to beartype/beartype/beartype (...it's like a stadium cheer when you're down in the ninth and Bear Ruth is up to bat), beartype/tap/beartype (...because it is what it says, and the Truth sometimes matters), and beartype/get/beartype (...because it does what it says, and actions speak louder than the Truth).

Please make the executive call. I trust your judgement implicitly, because you have packaging wisdom beyond seven lifetimes.

Also note that the latest commit can be installed by adding the --HEAD flag, which I think is pretty cool.

the hushed crowd erupts!

I support dangerous lifestyles perched precariously on the precipice of constant and irrecoverable disaster. To minimize people yelling into our issue tracker, I'll document this under a blinking collage of :radioactive: signs.

If everything looks good, add a beary cool label...

heh, heh

This is me nodding sagaciously while stroking my midnight stubble as I pretend to fully comprehend the four-dimensional packaging automation chess moves you just made.

Oh, the places you'll go in this world. Think of this central moment when you're the Head of Business Automation at Google London and remember: "This was prophesied long ago by a little balding man with a big cannabis gut who once lived in a poorly insulated cottage with two cats. True story."

If you do want to own the tap, I'd be honoured for a start :smiley:

Rejoice, for you are honoured above all other beartype packagers! Admittedly, the sample size is currently small.

...but I would then license it as you wish. I presume an MIT License under your name to keep things simple? Please correct me if I'm wrong on this.

We can go with whatever license you feel most comfortable with, actually. Since this is a disaggregated third-party package rather than, say, a mandatory dependency or asset to be imported or otherwise used by the main beartype codebase or documentation thereof, license compatibility is absolutely not a concern.

For example, I see that Homebrew itself is licensed under the BSD 2-Clause "Simplified" License. That would be fine. So would MIT. So would GPLv3. So would anything, really.

Go with your personal preference, please. You own this show.

Celebratory exploding head fireworks to commemorate this historic occasion if you please, GitHub! :exploding_head: :fire: :fireworks:

harens commented 3 years ago

So it turns out, that according to the Transferring a repo docs:

To transfer a repository that you own to an organization, you must have permission to create a repository in the target organization.

Therefore, I couldn't transfer it directly to @beartype.

To keep things simple, I instead transferred it to you @leycec, who I presume can then transfer that to the organisation.

leycec commented 3 years ago

Sounds like excellence personified – except that I am denser than mafic mesocratic nepheline-syenite and cannot find the transferred repo. This doesn't appear to be a thing. Likewise, grepping my GitHub profile for repositories whose names contain either beartype or homebrew yields the empty set, which is pretty empty.

Ugh. Why aren't I smarter? As expected, the sketchy discount bulk nootropics I recently imported from Latvia do nothing. :pill:

harens commented 3 years ago

Hmm 🤔 this is indeed a mystery. It is almost as mysterious as the case of who ate the porridge in Goldilocks and the Three Bears. However, that case was solved and so we will also solve this one!

You should've received an email asking for confirmation of the transfer. Since it expires after one day, I have sent it again.

image

Alternatively, if that doesn't work, we can always just create a new repo in the @beartype organisation, and I can just transfer everything across. It shouldn't take very long at all to get it all up and running.

leycec commented 3 years ago

You should've received an email asking for confirmation of the transfer. Since it expires after one day, I have sent it again.

...insert copious forehead sweat here. :sweat_drops: :cold_sweat: :sweat: :sweat_smile: :sweat_drops:

Profuse apologies for awkward e-mail faux pas. Did you know "faux pas" is both a singular and plural form at the exact same time? Because this is English, where the only rules are the ones we choose not to enforce.

I hadn't realized GitHub delivered confirmation by antiquated cleartext channels. Knowledge is half the battle, which explains why I lost. I'm like a prog rock drum solo that never ends. It sounds good for the first fifteen minutes and then fifteen more minutes pass.

And this is why we are all grateful that this is Friday evening and that I just binged up on Season 1 of The Mandalorian with mah beautiful wifey. plot spoiler: was awesome

Needless to say, I've clicked a link. As soon as GitHub finalizes the transaction on their end, I'll add you as co-owner! Then, I'll split our existing macOS instructions into MacPorts and Homebrew subsections.

Unrelatedly, @felix-hilden made a swag beartype banner featuring Mr. Nectar Palm, the beartype mascot who only asks you donate him all your honey:

All Mr. Nectar Palm asks is your honey.

Feel free to mic drop that into any of your packaging README files. Have a warm mid-winter's weekend, @harens – and thanks for bearing with me.

harens commented 3 years ago

Huzzah! 🎉 leycec/homebrew-beartype is up and running.

I hadn't realized GitHub delivered confirmation by antiquated cleartext channels

That's on me. I should've mentioned that the first time, but I forgot. I too blame those dodgy nootropics.

Unrelatedly, @felix-hilden made a swag beartype banner featuring Mr. Nectar Palm, the beartype mascot who only asks you donate him all your honey

That logo is genuinely awesome. The best part of it for me is how it looks amazing with both light and dark themes. Great job on this @felix-hilden!

Hope you both are having restful weekends. @leycec, wait till you watch Season 2, somehow It's even better...This is the way

leycec commented 3 years ago

It was my birthday today. We do not mention the year count. Instead, we celebrate with a shared appreciation of unpronounceable video game titles like DRAGON QUEST® XI S: Echoes of an Elusive Age™ - Definitive Edition whose lone character S may or may not meaningfully modify the preceding substring XI that may or may not actually be a Roman numeral.

Japan gonna Japan.

@leycec, wait till you watch Season 2, somehow It's even better...

This... This cannot be. It is the only thing good and decent that dares mutter that sacred word pair "The Force" since the original trilogy. We do not speak of the intermediate sacrilege. Expectations in the snow-bound @leycec household are high. Curse you, Jon Favreau, for reigniting this decrepit elder Millennial's soggy joy.

Relevantly, your well-brewed brilliance has been transferred to our discrete organization and then renamed to beartype-homebrew for meaningless conformance with existing repositories. I've also escalated your priveleges from merely Write to Admin. Interestingly, this is only feasible because this repository now resides under an organization rather than a user. For unknown reasons, ...money user repositories have no permission controls aside from granting others Write access. This is acceptable (because we are an organized rabble) but non-orthogonal (because GitHub's distinction between "user" and "organization" is artificial at best). Nonetheless, it is done.

I humbly regret breaking everything. Please accept this delicious fish cake by way of apology. :fish_cake:

harens commented 3 years ago

🎊 Happy Birthday @leycec! 🥳

Hope you have a great year ahead, filled with those unpronounceable Japanese fantasy video games that we all love. Most of all though, I hope you and your family stay safe during these tumultuous times.

renamed to beartype-homebrew for meaningless conformance with existing repositories.

I was a bit cautious at first, since Homebrew's naming convention results in things breaking if the repo does not have the prefix homebrew-. However, GitHub comes to the rescue and redirects all web traffic from the old url to the new one!

After quickly testing this on my end, it seems like everything is functional after the handover (although I will at some point correct the old beartype/homebrew-beartype urls to the new beartype/beartype-homebrew ones for readability).

So...just to finalise everything, beartype can now be installed by running the following:

MacPorts

sudo port install py-beartype

Homebrew (with bottles for macOS Catalina, Big Sur and x86_64 Linux 🍺)

brew install beartype/beartype/beartype

Homebrew (latest commit ⚠️)

brew install beartype/beartype/beartype --HEAD
leycec commented 3 years ago

Most of all though, I hope you and your family stay safe during these tumultuous times.

Absolute likewise. SARS-CoV-2 accelerated prevailing downward trends in the human condition like economic inequality and household debt to the hilt. Panic attack-inducing /r/London threads like this remind me why I'm grateful to have fled the urban poverty of my youth for a barren wasteland where I only fear being ripped apart by emaciated bloodthirsty Canadian direwolves harbouring a genetic fetish for human flesh.

Bizarrely, the safest place is now the place with no people and a half-working Internet connection. This is that place. The half-working Internet connection is a downer, but nothing the F4 button and several pounds of fresh medical cannabis can't resolve... eventually.

I was a bit cautious at first, since Homebrew's naming convention results in things breaking if the repo does not have the prefix homebrew-.

It's all my fault! I blame video games for everything.

However, GitHub comes to the rescue and redirects all web traffic from the old url to the new one!

Saved by the HTTP/1.1 308 redirect! Yes! But... no. I broke this and now the only thing keeping the fragile TitanicBear afloat is a GitHub redirect that could (and will, because Murphy brings chaos and doom) go down at any time.

We should do this right. Because you are an extraordinary gentleman, would you mind renaming beartype-homebrew back to homebrew-beartype and repairing the URL damage I have wrought "...one final time, I swear"?

This is why one shouldn't run destructive admin tasks without consulting the congenial domain expert. Ignorance destroys goodness yet again.

So...just to finalise everything, beartype can now be installed by running the following:

It is bliss. I'll update our macOS instructions to reflect this new truth.

harens commented 3 years ago

would you mind renaming beartype-homebrew back to homebrew-beartype

Consider it done. The URLs have been corrected and everything seems all good.

It's been an honour coming on this short but fascinating journey with you @leycec. May the packaging status of beartype forever flourish in the years to come, and know that I'll still be here to update the packages when you need me.

Thank you for your witty jokes and insightful comments. They're what inspired me to help, and I hope it inspires many others. If there's anything else I can do to help, anything at all, please don't hesitate to ask.

Looking forward to the next version bump.

All the best, Haren.

P.S. The URL of the third party tap in the README seems to be broken. I found adding https:// fixes it if that helps.

leycec commented 3 years ago

Obligatory swamp football GOOOOOOAL!

The most beautiful goal in the history of swamp football.

Consider it done. The URLs have been corrected and everything seems all good.

@harens: the package maintainer we didn't deserve but got anyway.

If there's anything else I can do to help, anything at all, please don't hesitate to ask.

You've sacrificed too much at the bloodstained altar of Python typing already.

I only ask that you stay bright, bubbly, and idealistic – the three D&D traits above all else that will faithfully see you through dark, non-bubbly, and pessimistic times. I had a ten-year period (...so, a decade then?) where I didn't follow that advice. Yup. It was my thirties.

I read one too many peer-reviewed papers in credible fields like ecology, climatology, and geology. In hindsight, I shouldn't have done that. But I did. No one likes a wicked problem they can't solve.

I've never unlearned what I learned, but I try not to dwell on physical reality anymore. Let the chips of industrial civilization fall where they may, but I'll forcefully fan the flames of wild ebullience instead. To quote the greatest dead satirist of all time: Yup. It's Pratchett.

Then Carrot said, "It's better to light a candle than curse the darkness, captain. That's what they say."

Godspeed and may the eldritch mystical isle of Albion be with you always.