diff --git a/.coveragerc b/.coveragerc index 8a9a1ea..ab6a53e 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,5 +1,5 @@ # .coveragerc to control coverage.py [run] -source = uniton -omit = uniton/_version.py -concurrency = multiprocessing \ No newline at end of file +source = semantikon +omit = semantikon/_version.py +concurrency = multiprocessing diff --git a/docs/README.md b/docs/README.md index d446a4a..79bed95 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,15 +1,15 @@ -# uniton +# semantikon ## Overview -In the realm of the workflow management systems, there are well defined inputs and outputs for each node. `uniton` is a Python package to give scientific context to node inputs and outputs by providing type hinting and interpreters. Therefore, it consists of two **fully** separate parts: type hinting and interpreters. +In the realm of the workflow management systems, there are well defined inputs and outputs for each node. `semantikon` is a Python package to give scientific context to node inputs and outputs by providing type hinting and interpreters. Therefore, it consists of two **fully** separate parts: type hinting and interpreters. ### **Type hinting** -`uniton` provides a way to define types for any number of input parameters and any number of output values for function via type hinting, in particular: data type, unit and ontological type. Type hinting is done with the function `u`, which **requires** the type, and **optionally** you can define the units and the ontological type. The type hinting is done in the following way: +`semantikon` provides a way to define types for any number of input parameters and any number of output values for function via type hinting, in particular: data type, unit and ontological type. Type hinting is done with the function `u`, which **requires** the type, and **optionally** you can define the units and the ontological type. The type hinting is done in the following way: ```python -from uniton.typing import u +from semantikon.typing import u def my_function( a: u(int, units="meter"), @@ -18,9 +18,9 @@ def my_function( return a / b ``` -`uniton`'s type hinting does not require to follow any particular standard. It only needs to be compatible with the interpreter applied. +`semantikon`'s type hinting does not require to follow any particular standard. It only needs to be compatible with the interpreter applied. -There are two possible ways to store the data for `uniton`. The standard way is to do it by converting all arguments except for the data type as a string, which is the default behaviour. The other way is to store the data as a list, which is turned on by setting `use_list=True`. In most cases, the default behaviour is the safest option; in some cases, especially when the data cannot be represented as a string, you might want to switch on `use_list`, but `uniton` is still under intensive development, and therefore there is no guarantee that you can retrieve the data across different versions correctly. +There are two possible ways to store the data for `semantikon`. The standard way is to do it by converting all arguments except for the data type as a string, which is the default behaviour. The other way is to store the data as a list, which is turned on by setting `use_list=True`. In most cases, the default behaviour is the safest option; in some cases, especially when the data cannot be represented as a string, you might want to switch on `use_list`, but `semantikon` is still under intensive development, and therefore there is no guarantee that you can retrieve the data across different versions correctly. ### **Interpreters** @@ -32,8 +32,8 @@ In order to extract argument information, you can use the functions `parse_input Example: ```python -from uniton.typing import u -from uniton.converter import parse_input_args, parse_output_args +from semantikon.typing import u +from semantikon.converter import parse_input_args, parse_output_args def my_function( a: u(int, units="meter"), @@ -58,11 +58,11 @@ Future announcement: There will be no distrinction between `use_list=True` and ` #### Unit conversion with `pint` -`uniton` provides a way to interpret the types of inputs and outputs of a function via a decorator, in order to check consistency of the types and to convert them if necessary. Currently, `uniton` provides an interpreter for `pint.UnitRegistry` objects. The interpreter is applied in the following way: +`semantikon` provides a way to interpret the types of inputs and outputs of a function via a decorator, in order to check consistency of the types and to convert them if necessary. Currently, `semantikon` provides an interpreter for `pint.UnitRegistry` objects. The interpreter is applied in the following way: ```python -from uniton.typing import u -from uniton.converters import units +from semantikon.typing import u +from semantikon.converters import units from pint import UnitRegistry @units diff --git a/docs/conf.py b/docs/conf.py index 7105cb6..5c16514 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -66,7 +66,7 @@ master_doc = 'index' # General information about the project. -project = u'uniton' +project = u'semantikon' copyright = u'2024, Max-Planck-Institut für Nachhaltige Materialien GmbH - Computational Materials Design (CM) Department ' \ u'All rights reserved' @@ -244,7 +244,7 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'uniton.tex', u'uniton Documentation', + ('index', 'semantikon.tex', u'semantikon Documentation', u'Max-Planck-Institut für Nachhaltige Materialien GmbH - Computational Materials Design (CM) Department', 'manual'), ] @@ -275,8 +275,8 @@ # (source start file, name, description, authors, manual section). man_pages = [ ('index', - 'uniton', - u'uniton Documentation', + 'semantikon', + u'semantikon Documentation', [u'Max-Planck-Institut für Nachhaltige Materialien GmbH - Computational Materials Design (CM) Department'], 1) ] @@ -291,10 +291,10 @@ # dir menu entry, description, category) texinfo_documents = [ ('index', - 'uniton', - u'uniton Documentation', + 'semantikon', + u'semantikon Documentation', u'Max-Planck-Institut für Nachhaltige Materialien GmbH - Computational Materials Design (CM) Department', - 'uniton', + 'semantikon', 'One line description of project.', 'Miscellaneous'), ] @@ -311,7 +311,7 @@ # If true, do not generate a @detailmenu in the "Top" node's menu. # texinfo_no_detailmenu = False -main(['-e', '-o', 'apidoc', '../uniton', '--force']) +main(['-e', '-o', 'apidoc', '../semantikon', '--force']) curdir = os.path.dirname(os.path.abspath(__file__)) if os.path.exists(os.path.join(curdir, 'source/notebooks')): diff --git a/docs/index.rst b/docs/index.rst index da8def6..b534f72 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,4 +1,4 @@ -.. uniton documentation master file +.. semantikon documentation master file .. _index: diff --git a/semantikon/_version.py b/semantikon/_version.py index dc33f5d..ade5636 100644 --- a/semantikon/_version.py +++ b/semantikon/_version.py @@ -50,9 +50,9 @@ def get_config() -> VersioneerConfig: cfg = VersioneerConfig() cfg.VCS = "git" cfg.style = "pep440-pre" - cfg.tag_prefix = "uniton-" - cfg.parentdir_prefix = "uniton" - cfg.versionfile_source = "uniton/_version.py" + cfg.tag_prefix = "semantikon-" + cfg.parentdir_prefix = "semantikon" + cfg.versionfile_source = "semantikon/_version.py" cfg.verbose = False return cfg diff --git a/semantikon/converter.py b/semantikon/converter.py index c953f58..961f143 100644 --- a/semantikon/converter.py +++ b/semantikon/converter.py @@ -41,7 +41,7 @@ def parse_metadata(value): Returns: dictionary of the metadata. Available keys are `units`, `otype`, - `shape`, and `dtype`. See `uniton.typing.u` for more details. + `shape`, and `dtype`. See `semantikon.typing.u` for more details. """ # When there is only one metadata `use_list=False` must have been used if len(value.__metadata__) == 1: @@ -76,7 +76,7 @@ def parse_input_args(func: callable): Returns: dictionary of the input arguments. Available keys are `units`, `otype`, - and `shape`. See `uniton.typing.u` for more details. + and `shape`. See `semantikon.typing.u` for more details. """ return { key: _meta_to_dict(value.annotation) @@ -94,7 +94,7 @@ def parse_output_args(func: callable): Returns: dictionary of the output arguments if there is only one output. Otherwise, a list of dictionaries is returned. Available keys are `units`, `otype`, - and `shape`. See `uniton.typing.u` for more details. + and `shape`. See `semantikon.typing.u` for more details. """ sig = inspect.signature(func) if isinstance(sig.return_annotation, tuple): @@ -167,7 +167,7 @@ def wrapper(*args, **kwargs): return wrapper -def uniton_class(cls: type): +def semantikon_class(cls: type): """ A class decorator to append type hints to class attributes. @@ -180,9 +180,9 @@ def uniton_class(cls: type): Comments: >>> from typing import Annotated - >>> from uniton.converter import uniton_class + >>> from semantikon.converter import semantikon_class - >>> @uniton_class + >>> @semantikon_class >>> class Pizza: >>> price: Annotated[float, "money"] >>> size: Annotated[float, "dimension"] @@ -199,7 +199,7 @@ def uniton_class(cls: type): """ for key, value in cls.__dict__.items(): if isinstance(value, type): - uniton_class(getattr(cls, key)) # Recursively apply to nested classes + semantikon_class(getattr(cls, key)) # Recursively apply to nested classes try: for key, value in cls.__annotations__.items(): setattr(cls, key, value) # Append type hints to attributes