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

Ideas for built-in types. #8

Open
dangle opened this issue Nov 17, 2017 · 3 comments
Open

Ideas for built-in types. #8

dangle opened this issue Nov 17, 2017 · 3 comments

Comments

@dangle
Copy link
Contributor

dangle commented Nov 17, 2017

typet needs to supply a rich collection of types by default. This issue will track ideas for the initial types.

@dangle
Copy link
Contributor Author

dangle commented Nov 20, 2017

Create a SingletonObject by creating a private metaclass that inherits from Singleton and _ObjectMeta and a metaclass for a StrictSingletonObject that inherits from Singleton and _StrictObjectMeta.

The proposed use case would be a global settings object:

from typet import SingletonObject, File

class _Configuration(SingletonObject):
    config: File = '~/.my_config'

settings = _Configuration()

@dangle
Copy link
Contributor Author

dangle commented Nov 20, 2017

  • JsonFile
    ** Validates a file's existence and that it can be parsed as JSON.
    ** Instances are dicts.
    ** Sliceable to indicate the type of dict returned.
    ** JsonFile implies JsonFile[dict] by default.
    ** JsonFile[OrderedDict]
    • JsonFile[DefaultDict[Any, Any])
      ** If yaml is installed (optional in setup.py), parse YAML files?

@dangle
Copy link
Contributor Author

dangle commented Nov 24, 2017

"Registerable" metaclass that registers subclassess automatically.

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

No branches or pull requests

1 participant