Coder Social home page Coder Social logo

gordonbondon / kubernetes-typed Goto Github PK

View Code? Open in Web Editor NEW
19.0 3.0 4.0 404 KB

mypy plugin to type check Kubernetes resources

Home Page: https://pypi.org/project/kubernetes-typed/

License: Apache License 2.0

Python 95.92% Jinja 4.08%
mypy kubernetes-python-client kubernetes kubernetes-development mypy-stubs mypy-plugins python-types crd pep484

kubernetes-typed's Introduction

kubernetes-typed's People

Contributors

gordonbondon avatar sobolevn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

kubernetes-typed's Issues

Remove (or update) version constraints on mypy

Currently, this package depends on mypy>=0.800, <=0.910 which makes it impossible to use it with python 3.10+ if you use the match Expression, as this has been added in mypy >= 0.940.

Why is the version of mypy constrained in the setup.py anyway? Would it be possible to remove this constaint? Or at least release an updated version?

Thanks in advance!

upper bound on mypy dependency

The setup.py file declares an upper bound on the mypy dependency

"mypy>=0.800, <=0.910",

Is there a particular reason for that? Newer versions of mypy often come with good bugfixes, I'd like to use this package with a newer mypy version, if possible.

Add new dynamic class CustomResourceDict with version support

Current approach with CustomResource["relative/path/to/crd.yaml", "spec", "some_property"] is limited to having only one definition/version in crd file and its impossible to extend with new options. Returned errors always mention TypedDict('Jsonschema') which is not userfriendly.

Instead, we should use get_dynamic_class_hook https://github.com/python/mypy/blob/3acbf3fe78a61c19ff96754233ada453472004c4/mypy/plugin.py#L692-L705 to provide more options while creating custom resource type definition. Possible syntax:

MyResource = CustomResourceDict(
    definition_path="/path/to/crd.yaml",
    property_path: ["spec", "some_property"]
    group: "myapi.io",
    version: "v1",
    kind: "MyResource"
)

First iteration should include these features:

  • CustomResourceDict dynamic hook
  • Handle multiple versions per CustomResourceDefinition
  • Handle multiple definitions per file
  • Set TypeDict name from kind

Similar to https://github.com/lovasoa/marshmallow_dataclass/blob/513e8bfc0dcef02314180790486cea3c04f65178/marshmallow_dataclass/mypy.py

Circular references

Hi there,

I'm getting the below error when using this:

from kubernetes_typed.client import V1PodDict
ImportError: cannot import name 'AdmissionregistrationV1ServiceReferenceDict' from partially initialized module 'kubernetes_typed.client' (most likely due to a circular import) (/home/user/repos/xxx/k8s-monitor/.venv/lib/python3.8/site-packages/kubernetes_typed/client/__init__.py)

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.