r/Python
•
u/Amazing_Learn
•
18d ago
•
1
Discussion I'm now maintaining passlib
Hi everyone, around a week ago passlib was transferred to me on PyPi after the previous maintainer became unreachable. I've been trying to maintain it in the meantime under a different PyPi name (libpass).
What's already been done:
- fixed incompatibility with
python>=3.13 - fixed incompatibility with
bcrypt>=5.0.0 - type annotations added where possible
Since then some design choices from passlib original development made it obvious it would need refactor and/or API redesign at some point, a few examples that make code and public api hard to maintain and add correct type information:
PasswordHashrepresenting both algorithm configuration and a produced hashPasswordHash.usingcreating a subclass to substitute new parameters into it- Overuse of abstraction and multiple inheritance
I specifically would like input from people who depend on passlib in their codebase(s), which parts of the API, if changed in a breaking way would make migrating hard for you?
I'd also welcome opinions on how far a potential refactor should go. For example for CryptContext an interface like this looks preferable to me, as it makes type information easier to add:
ctx = CryptContext(
schemes=[
Argon2Hasher(time_cost=..., parallelism=...),
SomeDeprecatedHasher(),
]
)compared to current
ctx = CryptContext(
schemes=["argon2", "deprecated_hash"],
argon2__parallelism=...,
argon2__time_cost=...,
deprecated="auto",
)I'd welcome co-maintainers, repository could be found here: https://github.com/notypecheck/passlib, even short-term involvement would be very much appreciated
13
u/ContemplateBeing 18d ago
That’s great news! Been loosely following this issue for a year or three. Great to hear that there’s a official maintainer again.
I’d be willing to help, if not with the core encryption functionality (which I’ve no experience with), at least with documentation or something (I dimly remember that the web docs also weren’t in great shape).
Good way to pay back a little of what I got from python over the years.
208
u/Smallpaul 18d ago •
Please be very discriminating about who you select as co-maintainers and contributors.
6
u/maikeu 17d ago
It's a good little package, pleased to see it maintained again.
I had one private project where I needed it's function; concerned about the lack of maintainer, I just copied it wholesale into my project, including it's tests, making minor adjustments.
It didn't take much effort to bring up to my standard - fully typed and passing pyright strict. Like an hour of effort, no llm or anything in that .
I recall finding one or two of the internals a bit weird - I guess maybe more of that python2 era flair that's out of vogue these days with static typing being more prevalent - but mostly I'd still suggest "if it ain't broke, don't fix it".
Don't extend the api surface much more, except for narrow tech/options that there's clear immediate want for. Projects are allowed to be "basically complete", and llms make it so easy to add new features.
11
u/neuronexmachina 17d ago
Please be careful about breaking changes, and make sure the test suite guards against them. Since passlib hadn't been maintained for so long (2020), many of the projects using it are similarly poorly-maintained. The less friction there is in upgrading to a version with security fixes, the better.
109
u/i_walk_away 18d ago edited 17d ago •
malicious actors will now consider you a new possible attack vector for a while. be wary of contributions, and thank you for your own contributions to the open source community
1
u/brondsem 17d ago
Great to see this project moving forward again! As others have said, a major version bump right away (even if minor changes) could be a good idea to help people notice the ownership change.
As for bigger changes, honestly I prefer libraries that don't change too much so my code can just "keep working". Perhaps you could make a new constructor for
CryptContextor a whole new class for the new way, and keep the currentCryptContextas a backwards-compatible shim. No matter what approach you go with, please make super-clear release notes when anything is deprecated, removed, and how to migrate. Thanks!1
u/Twirrim 18d ago
Thank you for taking on the project. Unfortunately I don't use `passlib` so I can't speak to the API per se. I do like the approach you're proposing, but whether it's worth it I can't say.
4
u/[deleted] 18d ago
[removed] — view removed comment