semvec/pypi-packages huggingface dataset:
sonatypeliftlib 0.0.4
Helper methods to allow easier interfacing to the V1 Api of Sonatype Lift
License: MIT
Requires Python: >=3.6
Keywords: sonatype lift

# sonatype-lift-lib

Sonatype Lift Lib contains helper methods to easily get up and running with Sonatype Lift V1 Api for introducing customised tools

## Example usage

```python
#!/usr/bin/env python3
from sonatypeliftlib.apiv1 import ApiV1, ToolNote
import sonatypeliftlib.helpers as lift
import sys

def js_present_in_diffs():
    '''
    This is a helper method that will use a utility method to check if any of the files that
    have changed in the PR end with a '.js'. If no js files have changed then we dont need to run
    '''
    files = lift.get_diff_files()
    if files is not None:
        for file in files:
            if file.endswith(".js"):
                return True
    return False

class ApiV1Test(ApiV1):

    def tool_applicable(self):
        if js_present_in_diffs() is True:
            return ApiV1.is_applicable()
        return ApiV1.is_not_applicable()

    def tool_run(self):
        tool_notes = []

        tn1 = ToolNote("Foo", "Foo Message", "Foo.txt", None, None)
        tool_notes.append(tn1)

        tn2 = ToolNote("Bar", "Bar Message", "Bar.yml", 2, None)
        tool_notes.append(tn2)
        return tool_notes

def main():
    tool = ApiV1Test("Test", sys.argv)
    tool.service()

if __name__ == "__main__":
    main()
```

ApiV1 expects to receive 3 parameters, which are project_path, commit hash command where command can be `applicable`, `name`, `run`. The response from a `run` should be an array of `ToolNote`'s.

Running the example above, for example `python3 apiv1_example.py . 1234 run` will yield the following output:

```json
[
    {
        "name": "Foo", 
        "message": "Foo Message",
        "line": 0
    },
    {
        "name": "Bar", 
        "message": "Bar Message",
        "line": 1
    }
]
```

For further details on the Api see [Lift Docs](https://help.sonatype.com/lift/extending-lift#ExtendingLift-APICommands)
shopcloud-metric 0.2.1
CLI tool for Metrics
License: MIT
Keywords: CLI

# Shopcloud Metric CLI

## install

```
$ pip install shopcloud_metric
```

## Usage

__Job:__  

Metrics wenn ein Job ausgeführt wird

```py
from shopcloud_metric import JobMetric

job = JobMetric('sage-supplier-update', 
    instance='airflow-production', 
    env='testing',
)
with job as j:
    j.gauge('job_last_success_unixtime', labels={'supplier': 'EP'})
    raise Exception('AS a')
    j.gauge('job_last_success_unixtime', labels={'supplier': 'SP'})

job.gauge('job_last_success_unixtime', labels={'supplier': 'SP'})
job.success()

```

__RawMetrics:__  

```py
from shopcloud_metric import MetricRegistry

registry = MetricRegistry()
registry.gauge('job_up', value=1, labels={'name': 'shopcloud-infrastructure-cli', 'instance': 'tests'})
registry.push()

registry.gauge('job_up', value=0, labels={'name': 'my-job', 'instance': 'airflow-production'})
registry.gauge('job_last_success_unixtime', labels=[{'name': 'test'}])
registry.gauge('api_http_requests_total', value=12, labels={'operation': 'create'})
registry.gauge('process_cpu_seconds_total', value=1)
registry.gauge('http_request_duration_seconds', value=1)
registry.push()
```


### Deploy to PyPi

```sh
$ pip3 install wheel twine
$ python3 setup.py sdist bdist_wheel
$ twine upload dist/* 
```