Skip to content

Commit

Permalink
change some files
Browse files Browse the repository at this point in the history
  • Loading branch information
samwaseda committed Dec 5, 2024
1 parent 3b487ec commit 0dabf5e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
6 changes: 3 additions & 3 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# .coveragerc to control coverage.py
[run]
source = uniton
omit = uniton/_version.py
concurrency = multiprocessing
source = semantikon
omit = semantikon/_version.py
concurrency = multiprocessing
22 changes: 11 additions & 11 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -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"),
Expand All @@ -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**
Expand All @@ -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"),
Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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'),
]

Expand Down Expand Up @@ -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)
]

Expand All @@ -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'),
]
Expand All @@ -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')):
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. uniton documentation master file
.. semantikon documentation master file
.. _index:

Expand Down
6 changes: 3 additions & 3 deletions semantikon/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 7 additions & 7 deletions semantikon/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand All @@ -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):
Expand Down Expand Up @@ -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.
Expand All @@ -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"]
Expand All @@ -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
Expand Down

0 comments on commit 0dabf5e

Please sign in to comment.