Coder Social home page Coder Social logo

Comments (4)

sirosen avatar sirosen commented on June 15, 2024 2

Yep, I'm happy with that! (Well, in as much as I'm happy with the type checkers...)

The only part of this, on review, that I might keep an eye on is "how should we support that fancy recursive JSON type"? It's clearly a subtype of Mapping[str, Any] and it feels like it should work. But I don't need that but at all for my work -- it just felt more correct academically.

from referencing.

Julian avatar Julian commented on June 15, 2024 1

Thanks for the detailed issue, which I haven't read through fully yet :D -- but because it seems like it may at least be slightly related, I also can't figure out why newer versions of pyright seem to have issues with type invariance either! I have it pinned to 1.1.307 here in the repo's noxfile which is the newest working version. Newer versions complain about things which make no sense to me, though I've only spent a few minutes trying to poke at them.

I'll have a closer look at the rest of what you shared after the weekend, thanks for writing it up.

from referencing.

Julian avatar Julian commented on June 15, 2024 1

So -- I think given that the mypy part of this is partly or in whole a "known issue" with mypy -- namely python/mypy#5406 -- and given the last comment about indeed using the public objects for pyright -- I'm going to close this perhaps.

Obviously speak up if you disagree, or if you have concrete suggestions for what to tweak, as should anyone else running into trouble here.

But yeah on the mypy side specifically I'm not sure if there's anything to do until things are fixed upstream.

from referencing.

Julian avatar Julian commented on June 15, 2024

(Will probably repeatedly respond to this in piecemeal as I flip back and forth between looking at it and some other things) --

mypy doesn't understand that retrieve is an attrs-provided field:

I remember fighting with this a bit -- I think mypy doesn't understand dataclass_transform yet or something, specifically it doesn't understand attrs' alias argument -- and vice versa, pyright is slightly dumb and doesn't understand that the alias argument isn't needed at all when all it's doing is automatic renaming of private attributes, so you have to write alias even when it's not needed.
More type checker time wasting, grumble grumble.

I'm probably going to be importing Schema on the assumption that it's safe to rely on that name and using it to ensure that my annotations always match referencing

referencing.jsonschema.Schema is definitely public -- lemme know if there's some other convention in the typing community to make that even more obvious. For that matter, so is referencing.jsonschema.SchemaRegistry which I figured would be even more common to use, it's just Registry[Schema] specializing the generic to something JSON Schema specific (as opposed to future support for OpenAPI or something).

from referencing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.