latchset / jwcrypto

Implements JWK,JWS,JWE specifications using python-cryptography
GNU Lesser General Public License v3.0
439 stars 118 forks source link

Migrate from setuptools/tox to hatch #304

Open jcgruenhage opened 2 years ago

jcgruenhage commented 2 years ago

More and more packages are migrating to more modern build/env tooling, and one of those tools is hatch. It can replace both setuptools and tox here, and it's also the one used in the official PyPI guides. Interestingly, even tox itself is migrating to hatch for their rewrite

Before I invest the time of creating a PR for this, would this be something you're interested in?

ofek commented 2 years ago

Should be easy with https://hatch.pypa.io/latest/intro/#existing-project

jcgruenhage commented 2 years ago

Yeah, that takes care of the setuptools part, but it still requires some manual work (did it out of curiosity and the version detection and license name both needed some adjustment) and doesn't take care of the bigger/more complicated task of migrating the tox envs into hatch as well.

jcgruenhage commented 2 years ago

Oh, and not to mention migrating the stuff from the Makefile into hatch as well.

simo5 commented 2 years ago

Ok I do not know hatch, so I would like to know a few things:

jcgruenhage commented 2 years ago

For some of those questions, @ofek is surely better qualified to answer, but considering I started this I'll answer to the best of my knowledge and @ofek can jump in if I get anything wrong.

Anything I forgot to mention, @ofek?

ofek commented 2 years ago

What platforms would I leave behind migrating to hatch

Hatchling is available on all the major distribution channels such as Debian, Fedora, Arch Linux, conda-forge, Nixpkgs, Alpine Linux, FreeBSD/OpenBSD, Gentoo Linux, MacPorts, OpenEmbedded, Spack, MSYS2, etc.

simo5 commented 2 years ago

Considering I recently change the code to: python_requires = '>= 3.6' it sounds like not a huge deal to move to >= 3.7

If this is "the way of the future", who am I to stand in the way ?

I would definitely review a PR.

As for the Makefile, it would be nice to preserve the targets that can be preserved, it is my way to re-learn how to run the various python tools (in this case will be how to use hatch) when I stay a way for long enough to forget.

jcgruenhage commented 2 years ago

Considering I recently change the code to: python_requires = '>= 3.6' it sounds like not a huge deal to move to >= 3.7

I'm not sure this is necessary for users installing the library, just for building it, but maybe @ofek can clarify this bis?

As for the Makefile, it would be nice to preserve the targets that can be preserved, it is my way to re-learn how to run the various python tools (in this case will be how to use hatch) when I stay a way for long enough to forget.

So that'd be a Makefile wrapping hatch basically? Because I'd prefer to have the commands for testing, linting etc in a document instead, but I can surely also add a Makefile if you want it.

simo5 commented 2 years ago

Yes the Makefile is just a muscle-memory convenience, I am totally for a Doc as well.

ofek commented 2 years ago

I'm not sure this is necessary for users installing the library, just for building it

Correct

simo5 commented 2 years ago

JFTR, it is the building on older distributions that gives me pause, but I do not know if 3.6 is an important version, in that sense, or not.

ofek commented 2 years ago

~3-5% https://pypistats.org/packages/jwcrypto

simo5 commented 2 years ago

Cool stats, seem lion share is 3.7 in terms of downloads, but that counts only pypi.

ofek commented 2 years ago

Such environments are unlikely to be using new versions of libraries anyway so they'd never hit this

ofek commented 2 years ago

Any update on this?

jcgruenhage commented 2 years ago

I haven't been able to work on this yet, because I've had other more urgent stuff to work on. I still plan on working on this though, unless someone else is quicker of course. I'll update this issue when I actually start on it :)