Skip to content

Address click.utils.LazyFile deprecation warning #714

Closed

Description

@edgarrmondragon

Starting with Click 8.5.0, LazyFile is deprecated and scheduled for removal in version 9:

It's used in

class CustomLazyFile(click.utils.LazyFile):
def __init__(

It's not urgent since this project constrains Click to <9, but re-implementing the functionality LazyFile might be rather easy.

Activity

  1. sirosen commented on Sep 8, 2026

    @sirosen
    Member

    Yeah, I want to work on it a bit, but I haven't had time. I'm considering writing a library for handling several filesystem interactions (hashing, caching content, and lazy reads), which I have use for in other projects as well.

    I'd be curious how easy a "quick fix" would be to maintain, if anyone wants to poke at it.

  2. edgarrmondragon commented on Sep 9, 2026

    @edgarrmondragon
    ContributorAuthor

    I'd be curious how easy a "quick fix" would be to maintain

    Vendoring _LazyFile is the quickest I can think of. It's ~90 lines and the implementation is not too hard to understand imo.

  3. sirosen commented on Sep 18, 2026

    @sirosen
    Member

    I finally have some free time to look into this (!); thanks for putting that up. I think vendoring is... okay. I don't really want to do it that way if I can find an easy way out. If we vendor it, I think we need to do it with the original BSD 3-clause license. So maybe in a separate file?

    I had a conversation over on the click repo in which it seems like LazyFile is going fully private inside of click. ... So maybe vendoring is the right solution.

  4. sirosen commented on Sep 19, 2026

    @sirosen
    Member

    I think I have the last details falling into place on creating a narrower and simpler class that carries the bits of LazyFile that we need here.

    @edgarrmondragon, I did see a separate fix in your PR that I picked up and marked co-authored. 🫶

    It basically seems to work, but there's some issue with it failing a check in pyjson5 that I'm running down right now.

  5. sirosen commented on Sep 19, 2026

    @sirosen
    Member

    All nicely sorted out in #716

  6. edgarrmondragon commented on Sep 19, 2026

    @edgarrmondragon
    ContributorAuthor

    I think I have the last details falling into place on creating a narrower and simpler class that carries the bits of LazyFile that we need here.

    Nice!

    I did see a separate fix in your PR that I picked up and marked co-authored. 🫶

    Thanks! 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions