semvec/pypi-packages huggingface dataset:
dotchain 0.0.1
Python method chaining and piping with asyncio support.
Requires Python: >=3.10

# DotChain - Python method chaining and piping with asyncio support.

# Install

`pip install dotchain`

# Usage

### Chain Synchronously

Call `.Result()` to get the value.

```python
value = DotChain(data | iterable).method().property.Result()
```

### Chain Asynchronously

Do not call `.Result()` when using `await`.

```python
value = await DotChain(data | iterable).method().property
```

> NOTE: Must be in an event loop to use `await`.

### Piping

`Pipe` can be called anywhere in the chain to start piping the data.

`Chain` can be called anywhere in the chain to start chaining the data again.

```python
# Piping
value = DotChain(data | iterable).Pipe.method().other_method().Result()

# Chaining and Piping
value = DotChain(data | iterable).method().property.Pipe.other_method().Chain.property.Result()
```

### Contexts

Contexts can be provided to resolve methods and properties so they can be used inline.

`With` can be called anywhere in the chain to add or clear contexts.

```python
import utils  # contains `log(...)`

value = DotChain(data | iterable).With(utils).method().log().Result()

value = DotChain(data | iterable).With({'utils': utils}).method().utils.log().Result()

value = DotChain(data | iterable).With(self).method().utils.log().Result()
```

### Call inline functions

```python
value = DotChain(data | iterable).method().Call(lambda item: item.property).Result()
```

# Examples

```python
from dotchain import DotChain
import log_utils

# Chaining
order = DotChain(user).get_order('123').cancel().Result()

# Chaining with Piping
email_result = DotChain(user).get_order('123').cancel().Pipe.send_email().Result()

# With lookup contexts
order = DotChain(user).With(log_utils).get_order('123').cancel().Pipe.log_cancel().Result()

order = DotChain(user).With({'log_it': lambda order: log_utils.log_cancel(order)}).Pipe.log_it().Result()

# Inline callables
order = DotChain(user).get_order('123').cancel().Pipe.Call(lambda order: log_utils.log_cancel(order)).Result()
```

> See [Tests](tests/dotchain/test_chain.py) for more examples and usage.
argparse-from-jsonschema 0.0.6
Parse Argument with JSON Schema
Keywords: Argparse,jsonschema,Argument Schema,data validation,json,validation,command,line,parser,parsing

# argparse-from-jsonschema 

Parse Argument with JSON Schema.

## Installation

Need Python 3.6+.

```bash
pip install argparse-from-jsonschema
```

## Usage

[Schema](./tests/argument_config.json):

```json
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "argument_config",
  "description": "Arg-parse Schema UnitTest",
  "type": "object",
  "properties": {
    "config": {
      "type": "string",
      "positional": true,
      "description": "path of config file"
    },
    "resume": {
      "type": "boolean",
      "description": "resume from checkpoint or not"
    },
    "foo": {
      "type": "boolean",
      "description": "--with-foo for true or --no-foo for false",
      "false-prefix": "no",
      "true-prefix": "with"
    },
    "scale": {
      "type": "number",
      "default": 1.0,
      "description": "scale of image"
    },
    "mode": {
      "enum": [
        "happy",
        "high",
        "heaven"
      ],
      "default": "happy",
      "description": "speed mode"
    },
    "composition": [
      {"type": "string", "description": "Only first element is use"},
      {"type": "null"}
    ]
  },
  "required": [
    "config"
  ]
}
```

Python Code:

```python
# demo.py
import argparse_from_jsonschema

print(argparse_from_jsonschema.parse(schema='./tests/argument_config.json'))
```

Run with arguments:

```bash
python3 demo.py /path/to/config.py
#> {'config': '/path/to/config.py', 'resume': False, 'foo': False 'scale': 1.0, 'mode': 'happy'}
```

CLI:

```bash
argparse-from-jsonschema tests/argument_config.json
#> Show help for schema file [tests/argument_config.json]:
#> usage: YOUR-COMMAND [-h] [--resume] [--with-foo] [--scale SCALE]
#>                     [--mode {happy,high,heaven}]
#>                     config
#>
#> Arg-parse Schema UnitTest
#>
#> positional arguments:
#>   config                path of config file
#>
#> optional arguments:
#>   -h, --help            show this help message and exit
#>   --resume              resume from checkpoint or not
#>   --with-foo, --no-foo  --with-foo for true or --no-foo for false
#>   --scale SCALE         scale of image, [1.0] in default
#>   --mode {happy,high,heaven}
#>                         speed mode, [happy] in default
```
python-vagrant-metadata 0.0.5
Can use and parse metadata information of vagrant box
Requires Python: >=3.6
Keywords: vagrant

# python-vagrant-metadata

python-vagrant-metadata is a library for download vagrant box in vagrant cloud or customs site.

```python
import requests
from vagrant_metadata import fetch, forge_metadata_url

metadata = fetch(forge_metadata_url('ubuntu/trusty64'))
url = metadata.url_for_youngest_version('virtualbox')

response = requests.get(url)
if response.ok:
  with open('mybox.box', 'wb') as f:
    f.write(response.content)
```

If you need the checksum of box for specific versions, you can use provider as like
```python
import requests
from vagrant_metadata import fetch, forge_metadata_url

metadata = fetch(forge_metadata_url('ubuntu/trusty64'))
url = metadata.url_for('20190514.0.0','virtualbox')

response = requests.get(url)
if response.ok:
  with open('mybox.box', 'wb') as f:
    f.write(response.content)
```


If you need the checksum of box, you can use provider as like
```python
from vagrant_metadata import fetch, forge_metadata_url

metadata = fetch(forge_metadata_url('ubuntu/trusty64'))
provider = metadata.youngest()['virtualbox']
print(provider.url)
print(provider.checksum)
```

If you need the checksum of box for specific versions, you can use provider as like
```python
from vagrant_metadata import fetch, forge_metadata_url

metadata = fetch(forge_metadata_url('ubuntu/trusty64'))
provider = metadata['20190514.0.0']['virtualbox']
print(provider.url)
print(provider.checksum)
```

If you want only version with the specific provider, you can filtering as like
```python
from vagrant_metadata import fetch, forge_metadata_url

metadata = fetch(forge_metadata_url('ubuntu/trusty64'))
provider = metadata.keep_only_provider('virtualbox').youngest()['virtualbox']
print(provider.url)
print(provider.checksum)
```

# Build package

```python
python3 setup.py bdist_wheel
python3 -m twine upload --skip-existing --repository testpypi dist/*
python3 -m pip install --index-url https://test.pypi.org/simple/ python-vagrant-metadata
```