Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reserved Fields #243

Open
robcxyz opened this issue Jan 1, 2024 · 0 comments
Open

Reserved Fields #243

robcxyz opened this issue Jan 1, 2024 · 0 comments
Labels
proposal Proposal for changes in syntax / behaviour wip A work in progress proposal

Comments

@robcxyz
Copy link
Collaborator

robcxyz commented Jan 1, 2024

Reserved Fields

Change the syntax of reserved fields to reduce potential conflicts

Overview

Variable Rules

  • Reserved variables

    • Very few that could clash
  • Prefix underscore -> private

    • Can't set externally
  • Suffix with underscore

    • Don't show up in docs

Variables

Reserved

is_public: bool = False

args: list = []

  • For mapping args to inputs

kwargs: Union[str, dict] = None

  • Only used in requests hook with render by default to upgrade to dict

kwargs: str = None

  • This maps additional kwargs to a variable

New

args_seperator_: str = None

  • Can be set to a comma or something if you want to break up the args with that to a list

V2 - 1

is_public_: bool = False

args_: list = []

kwargs_: str = None

V2 - 1

_is_public: bool = False

args: list = []

_kwargs: str = None

env_: Any = None

  • Used in blocks / match hooks where new context is created. Needs to be public

  • because it will be mutable within a hook (see match).

skip_output: bool = False

  • Fields that should not be rendered by default

_render_exclude_default: set = {

'input_context',

'public_context',

'hook_type',

'else',

}

_render_exclude: set = {}

_render_by_default: list = []

Private

Used when rendering docs**

_doc_tags: list = []

  • For linking issues in the docs so others can potentially contribute

_issue_numbers: list = [] - TODO: Implement this

  • Additional callout sections to be included at the top of the docs

_notes: list = []

  • Allow hooks to be sorted in the docs

_docs_order: int = 10 - Arbitrary high number so hooks can be sorted high or low

  • Parameterized return type description for docs

_return_description: str = None

  • Flag for skipping creating the docs for

_wip: bool = False

from tackle import BaseHook, HookConfig

from pydantic import ConfigDict





class SomeHook(BaseHook):

    hook_name = 'foo'

    bar: str



    model_config = ConfigDict(

        extra='forbid',

    )

    hook_config: HookConfig = HookConfig(

        args=['bar'],

    )
foo<-:

  bar: str



  Config:




@robcxyz robcxyz changed the title tmp Reserved Fields Jan 1, 2024
@robcxyz robcxyz added proposal Proposal for changes in syntax / behaviour wip A work in progress proposal labels Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Proposal for changes in syntax / behaviour wip A work in progress proposal
Projects
None yet
Development

No branches or pull requests

1 participant