semvec/pypi-packages huggingface dataset:
pyimporters-dummy 0.1.306
Sherpa knowledge import plugins
Requires Python: >=3.8

## Requirements

- Python 3.8+
- Flit to put Python packages and modules on PyPI
- Pydantic for the data parts.

## Installation
```
pip install flit
pip install pyimporters-dummy
```

## Publish the Python Package to PyPI
- Increment the version of your package in the `__init__.py` file:
```
"""An amazing package!"""

__version__ = 'x.y.z'
```
- Publish
```
flit publish
```

## Write your own pyimporters plugin
- Git clone the pyimporters_dummy project
```
git clone git@bitbucket.org:kairntech/pyimporters_dummy.git
```
- Rename the project with your own format name <new_format>
```
mv pyimporters_dummy pyimporters_<new_format>
```
- Delete the .git directory
```
rm -r -f pyimporters_<new_format>/.git
```
- Change to the new pyimporters_<new_format> directory
```
cd pyimporters_<new_format>
```
- Rename the package directory project
```
mv pyimporters_dummy pyimporters_<new_format>
```
- Rename the python file implementation
```
mv pyimporters_<new_format>/dummy.py pyimporters_<new_format>/<new_format>.py
```
- Rename the python tests file implementation
```
mv tests/test_dummy.py tests/test_<new_format>.py
```
- Edit the pyproject.toml file to change a few lines and add your additional requirements
```
[tool.flit.metadata]
module = "pyimporters_<new_format>"
...
requires = [
    "pyimporters_plugins>=0.1.61",
    "additional_requirement1",
    "additional_requirement2",
    ...
    "additional_requirementN",
]
dist-name = "pyimporters-<new_format>"
...
[tool.flit.entrypoints."pyimporters.plugins"]
<new_format> = "pyimporters_<new_format>.<new_format>:NewFormatKnowledgeParser"
```
- Write the implementation and test of your new format in python using your favorite IDE
```
@dataclass
class NewFormatOptions(KnowledgeParserOptions):
    """
    Options for the new format knowledge import
    """
    foo : str = Query("bar", description="Dummy parameter")

NewFormatOptionsModel = NewFormatOptions.__pydantic_model__

class NewFormatKnowledgeParser(KnowledgeParserBase):
    def parse(self, source : Path, options: Union[KnowledgeParserOptions, Dict[str, Any]], bar : Bar) -> Generator[Term, None, None]:
        options = NewFormatOptions(**options) if isinstance(options, dict) else options
        # Initialize the progress indicator number of terms to read so that the progress indicator can send feedback to the end user
        bar.max = 100 
        bar.start()
        # yield as many terms as you want, advancing the progress indicator each time
        bar.next()
        yield Term(identifier=options.foo, preferredForm=options.foo)
        # Terminate the progress indicator
        bar.finish()

    @classmethod
    def get_schema(cls) -> KnowledgeParserOptions:
        return NewFormatOptions

    @classmethod
    def get_model(cls) -> Type[BaseModel]:
        return NewFormatOptionsModel
```
Pritsima 0.0.1
Teaching Python Lib

        
Keywords: Python,Learn,Engineer
Platform: UNKNOWN
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Description-Content-Type: text/markdown
openbayestool 0.3.2
Openbayes Service Tool
Keywords: ml ai openbayes

# openbayestool

该工具用于 [OpenBayes](https://openbayes.com) 下参数、指标的记录。

## 快速开始

该类库将会把模型执行过程中的 `parameters` 和 `metrics` 提交到 `openbayes-server` 方便记录每次模型的结果。

```python
from openbayestool import log_param, log_metric, clear_metric, clear_param

# 记录参数 `learning_rate=0.01`
log_param('learning_rate', 0.01)

# 同一参数将会记录最后一个请求的结果 `foo=3`
log_param('foo', 1)
log_param('foo', 2)
log_param('foo', 3)

# 记录模型的运行结果 `precision=0.77`
log_metric('precision', 0.77)

# 同一个结果 precision 多次记录会追加结果，即结果为 [0.79, 0.82, 0.86]
log_metric('precision', 0.79)
log_metric('precision', 0.82)
log_metric('precision', 0.86)

# 清理一个自定义的 metric
clear_metric('precision')

# 清理一个自定义的 param
clear_param('foo')
```

## 安装

**注意** 在 [OpenBayes](https://openbayes.com) 内无需安装，默认已经引入了该依赖。

```shell
pip install -U openbayestool
```

## 使用

**注意** 在 openbayes 所提交的任务会自动设置 **API 访问 token** 和 **要记录的容器的 url** 无需用户知晓。

### 设置要记录的容器的 url

可以通过环境变量配置：`JOB_UPDATE_URL=<job-url>`，也可以在程序中采用 `api` 配置：

```python
from openbayestool import set_callback_url, get_callback_url

set_callback_url('<job-url>') # set the job-url
get_callback_url() # return the job-url
```

### 设置访问 API 的 token

可以通过环境变量 `JOB_ACCESS_TOKEN=<job-token>` 配置，也可以在程序中采用 `api` 配置：

```python
from openbayestool import set_access_token, get_access_token

set_access_token('<job-token>') # set the job-token
get_access_token() # return the job-token
```

### 通过 api 操纵 `parameters` 和 `metrics`

```python
from openbayestool import log_param, log_metric, clear_metric

# 记录参数 `learning_rate=0.01`
log_param('learning_rate', 0.01)

# 同一参数将会记录最后一个请求的结果 `foo=3`
log_param('foo', 1)
log_param('foo', 2)
log_param('foo', 3)

# 记录模型的运行结果 `precision=0.77`
log_metric('precision', 0.77)

# 同一个结果 precision 多次记录会追加结果，即结果为 [0.79, 0.82, 0.86]
log_metric('precision', 0.79)
log_metric('precision', 0.82)
log_metric('precision', 0.86)

# 清理一个自定义的 metric
clear_metric('precision')
```

## 查看记录结果

在 openbayes 的容器页面会展现以上的记录结果并作为自动建模确认下一步参数的依据。