semvec/pypi-packages huggingface dataset:
nr.databind.rest 0.0.3
Package description here.
License: MIT
Requires Python: >=3.4.0,<4.0.0

> Note: This package is in the dangerous land of `0.x.y` versions and may be subject to breaking
> changes with minor version increments.

> This package is superseded by [astra.http](https://pypi.org/project/astra-http/).

# nr.databind.rest

This module can be used to define a REST API interface using Python 3
annotations and `nr.databind` object mapping features.

*Todo*

* [ ] Dynamic and static code generation for REST clients

### Example

Resources are created by defining an `Interface` subclass and decorating its
methods with the `@Route` decorator. The subclass can then be used to
automatically generate client code and to implement a server based on the
same interface.

```py
from my.service.api.types import MyRequest, MyResponse
from nr.databind.rest import Route, RouteParam
from nr.interface import Interface

class MyResource(Interface):

  @Route('GET /my-endpoint/{parameter_a}')
  def my_get_endpoint(self, parameter_a: str, parameter_b: RouteParam.Query(int)) -> MyResponse:
    ...

  @Route('POST /my-endpoint/{parameter_a}')
  def my_post_endpoint(self, parameter_a: str, body: MyRequest) -> MyResponse:
    ...
```

The resource is then implemented like this:

```py
from my.service.api.resources import MyResource
from my.service.api.types import MyResponse
from nr.interface import implements


@implements(MyResource)
class MyResourceImpl:

  def my_get_endpoint(self, parameter_a, parameter_b):
    # ...
    return MyResponse(...)
  
  def my_post_endpoint(self, parameter_a, body):
    # ...
    return MyResponse(...)
```

Resources can then be bound to a server framework using one of the available
bind mechanisms (currently only Flask is available).

```py
from flask import Flask
from my.service.api.resources_impl import MyResourceImpl
from nr.databind.rest import MimeTypeMapper
from nr.databind.rest.flask import bind_resource

app = Flask(__name__)
mapper = MimeTypeMapper.json()
bind_resource(app, '/my-resource', MyResourceImpl(), mapper=mapper)
```

---

<p align="center">Copyright &copy; 2020 Niklas Rosenstein</p>
nr.utils.process 0.0.5
Utilities for cross-platform process handling and privilege escalation.
License: MIT
Requires Python: >=3.4.0,<4.0.0

> Note: This package is in the dangerous land of `0.x.y` versions and may be subject to breaking
> changes with minor version increments.

# nr.utils.process

Utilities for cross-platform process handling and privilege escalation.

---

<p align="center">Copyright &copy; 2020 Niklas Rosenstein</p>
nr.utils.ponyorm 0.0.2
Package description here.
License: MIT
Requires Python: >=3.4.0,<4.0.0

> Note: This package is in the dangerous land of `0.x.y` versions and may be subject to breaking
> changes with minor version increments.

# nr.utils.ponyorm

Utilities for [Pony ORM](https://ponyorm.org/).

### Composable databases

Applications with plugin interfaces may choose to allow the use of a common
database, accessed via the same Pony ORM database object. The
`nr.utils.ponyorm.appdb` provides classes to allow just that.

Example:

```python
from nr.utils.ponyorm.appdb import AppDatabase, Optional, Required
appdb = AppDatabase(__name__)
class Person(appdb.Entity):
  name = Required(str)
  # etc. etc.
```

Then from the application startup logic:

```python
from pony.orm import Database
db = Database()
for appdb in load_all_application_databases():  # ominous functions
  appdb.bind_to(db)
db.generate_mapping(create_tables=True)
```

### Common converters

Provides common converter implementations that are not built into Pony ORM.
All converters can be registered via `AppDatabase.register_converter(converter_cls)`
or with `nr.utils.ponyorm.converters.register_converter(db, converter_cls)`.

Available converters are

* `EnumConverter`

### Utility functions

* `get_db(entity)`
* `get_one(entity_cls, kwargs)`
* `get_or_create(entity_cls, get, set=None)`
* `upsert(entity_cls, get, set=None, mutate=True)`

---

<p align="center">Copyright &copy; 2020 Niklas Rosenstein</p>
nr.utils.io 0.1.1
Collection for IO utilities.
License: MIT
Requires Python: >=3.4.0,<4.0.0

> Note: This package is in the dangerous land of `0.x.y` versions and may be subject to breaking
> changes with minor version increments.

# nr.utils.io

Collection of IO utilties.

## Contents

* `nr.utils.io.readers`
  * `EncodedStreamReader`: A readable file-like object that wraps a `TextIO` object and converts
    it to a binary stream encoded with the specified *encoding* (or the default system encoding).

---

<p align="center">Copyright &copy; 2020 Niklas Rosenstein</p>
nr.metaclass 0.0.6
Metaclass utilities.
License: MIT

> Note: This package is in the dangerous land of `0.x.y` versions and may be subject to breaking
> changes with minor version increments.

# nr.metaclass

This module provides utilities for Python classes and metaclasses.

* `nr.metaclass.copy` &ndash; Copy a class, while optionally updating some properties
  (for example the base classes).
* `nr.metaclass.deconflict` &ndash; Functions to determine conflicting metaclasses and
  deconflicting them.
* `nr.metaclass.inline` &ndash; Provides the `InlineMetaclassBase`, allowing you to implement
  `__new__()` and `__init__()` of a metaclass in a class through `__metanew__()` and
  `__metainit__()`.

---

<p align="center">Copyright &copy; 2020 Niklas Rosenstein</p>
nr.markdown 1.0.7
Extends the misaka Markdown parser and renderer for some nifty features.
License: MIT
Requires Python: >=3.4.0,<4.0.0

# nr.markdown

Extends the [misaka][] Markdown library for a couple of extensions.

* `inside-html`: Support Markdown inside HTML tags. Requires the `bs4` package
* `smartypants`: Automatically apply `misaka.smartypants()` on the input
  Markdown. Enabled by default
* `pygments`: Highlight code blocks with Pygments. Requires the `pygments` package
* `url-transform`: Transform links and image URLs with a callback function.
  Enabled by default, but only actually does something if the
  `url_transform_callback` option is set
* `toc`: Generates a table of contents while rendering, but does not actually
  render a TOC into the output. The generated TOC data structure can be
  accessed via the `Markdown.toc` attribute. Enabled by default

[misaka]: https://github.com/FSX/misaka

---

<p align="center">Copyright &copy; 2020 Niklas Rosenstein</p>
nr.fs 1.6.3
Filesystem and path manipulation tools.
License: MIT

# nr.fs

&ndash; Filesystem and path manipulation tools.

> Note: To use the `nr.fs.glob()` function, you need the [glob2] module
> installed. It is not listed an install requirement to this module.

  [glob2]: https://pypi.org/project/glob2/

---

<p align="center">Copyright &copy; 2020 Niklas Rosenstein</p>
nr.databind.json 0.0.14
Deserialize JSON into Python objects and reverse.
License: MIT

> Note: This package is in the dangerous land of `0.x.y` versions and may be subject to breaking
> changes with minor version increments.

> This package is superseded by [databind.core](https://pypi.org/project/databind.core/).

# nr.databind.json

The `nr.databind.json` package implements (de-) serializers for nested payloads that usually
result from loading JSON-formatted data.

See also [nr.databind.core](https://git.niklasrosenstein.com/NiklasRosenstein/nr/src/branch/master/nr.databind.core).

## Example

```py
from nr.databind.core import Field, Struct, ObjectMapper
from nr.databind.json import JsonModule

class Person(Struct):
    name = Field(str, prominent=True)
    age = Field(int)
    address = Field(str, default=None)

mapper = ObjectMapper(JsonModule())
print(mapper.deserialize({'name': 'John Wick', 'age': 48, 'address': 'Wicked St.'}))  # Person(name='John Wick')
```

---

<p align="center">Copyright &copy; 2020 Niklas Rosenstein</p>
nr.databind.core 0.0.22
Bind structured data directly to typed objects.
License: MIT

> Note: This package is in the dangerous land of `0.x.y` versions and may be subject to breaking
> changes with minor version increments.

> This package is superseded by [databind.core](https://pypi.org/project/databind.core/).

# nr.databind.core

The `nr.databind.core` package provides a framework for binding structured data to typed objects
as well as the (de-) serialization of that data from/to other formats.

See also: [nr.databind.json](https://git.niklasrosenstein.com/NiklasRosenstein/nr/src/branch/master/nr.databind.json).

## Example

```py
from nr.databind.core import Field, Struct

class Person(Struct):
    name = Field(str, prominent=True)
    age = Field(int)
    address = Field(int, default=None)

print(Person('John Wick', 48, 'Wicked St.'))  # Person(name='John Wick')
```

---

<p align="center">Copyright &copy; 2020 Niklas Rosenstein</p>
nr.ansiterm 0.0.2
Package description here.
License: MIT
Requires Python: >=3.5.0,<4.0.0

> Note: This package is in the dangerous land of `0.x.y` versions and may be subject to breaking
> changes with minor version increments.

# nr.ansiterm

  [W]: https://en.wikipedia.org/wiki/ANSI_escape_code

Module for producing ANSI escape codes and stylizing text in terminals. Supports SGR, LUT and
True colors as well as all ANSI attributes per [Wikipedia: ANSI escape code][W].

Example:

```py
from nr.ansiterm import styled, parse_style, Attribute
print('Hello', styled(name, 'bright_blue', attrs=['bold', 'underline']))
print(str(parse_style('%014 italic')) + "What's kickin'?" + str(Attribute.RESET))
```

---

<p align="center">Copyright &copy; 2020 Niklas Rosenstein</p>
databind.yaml 0.1.3
De/serialize YAML payloads using Python type hints.
License: MIT
Requires Python: >=3.5.0,<4.0.0

# databind.yaml

Databind is a library inspired by Jackson-databind to describe and bind data models for
object-oriented programming. The `databind.yaml` module provides functionality to (de-)
serialize YAML payloads from/to Python objects.

> __Note:__ This module is just a thin wrapper that provides utility functions, combining the
> functionality of [databind.json](https://pypi.org/project/databind.json/) with PyYAML.

## Quickstart

```python
from typing import Optional
from databind.core import datamodel
from databind.yaml import from_str

@datamodel
class Geolocation:
  latitude: float
  longitude: float
  altitude: Optional[float] = None

@datamodel
class ResolvedLocation:
  query: str
  location: Geolocation

london = from_str(ResolvedLocation, '''
query: London
location:
  latitude: 51.507351
  longitude: -0.127758
''')

assert london == ResolvedLocation("London", Geolocation(51.507351, -0.127758))
```

---

<p align="center">Copyright &copy; 2020 Niklas Rosenstein</p>
databind.tagline 0.1.3
De/serialize strings of comma-separated key-value pairs using Python type hints.
License: MIT
Requires Python: >=3.5.0,<4.0.0

# databind.tagline

Databind is a library inspired by Jackson-databind to describe and bind data models for
object-oriented programming. The `databind.tagline` module provides functionality to (de-)
serialize strings of comma-separated key-value pairs.

## Syntax

* An object is defined of a comma-separated sequence of key-value pairs
* An array is defined as a sequence of values
* Key-value pairs or values can be grouped/nested with surrounding braces
* Unions can be instantiated by prefixing a brace with the union member name

| Notation | Syntax      | JSON representation    |
| -------- | ----------- | ---------------------- |
| Object   | `a=b,c=d`   | `{"a": "b", "c": "d"}` |
| Array    | `a,b,c`     | `["a", "b", "c"]` |
| Union    | `a{b=c}`    | `{"type": "a", "a": {"b": "c"}}` |
| Nesting  | `a={b=c}`   | `{"a": {"b": "c"}}` |
| Nesting  | `a,{b=c},d` | `["a", {"b": "c"}, "d"]` |

## Quickstart

```python
from databind.core import datamodel, field, uniontype
from databind.tagline import from_str

@datamodel
class BindMount:
  src: str
  dst: str
  read_only: bool = field(altname='readonly', default=False)

@uniontype({
  'bind': BindMount
} flat=False)
class Mount:
  pass

assert from_str(Mount, 'bind{src=data/,dst=/opt/data}') == BindMount('data/', '/opt/data')
assert from_str(Mount, 'type=bind,bind={src=data/,dst=/opt/data}') == BindMount('data/', '/opt/data')
assert from_str(BindMount, 'src=data/,dst=/opt/data,readonly=true') == BindMount('data/', '/opt/data')
```

## Notes

* All values are loaded as strings. It is up to the user of the `load()` function to interpret
  the values as needed. The `dump()` function converts numbers to string for convenience.
* The union syntax is loaded into nested form, which requires that `@uniontype()` are configured
  with `flat=False`.
* The actual data binding is out-sourced with the `databind.json` module (using a custom registry
  initialized with non-strict JSON converters, see `databind.tagline:registry`).
* The loader/dumper does not currently support escaping control characters. Dumping a string
  that contains a control character (like `{` or `,`) will result in output that cannot be
  parsed.

---

<p align="center">Copyright &copy; 2020 Niklas Rosenstein</p>