semvec/pypi-packages huggingface dataset:
trivy-py 0.66.0.1
Python wrapper around invoking trivy (https://trivy.dev/)
License: MIT
Requires Python: >=3.9

[![build status](https://github.com/GaukeT/pre-commit-mirrors-trivy/actions/workflows/main.yml/badge.svg)](https://github.com/GaukeT/pre-commit-mirrors-trivy/actions/workflows/main.yml)

# pre-commit-mirrors-trivy

pre-commit hook that mirrors the trivy for usage as pre-commit language

Internally this package provides a convenient way to download the pre-built
trivy binary for your particular platform.

### As a pre-commit hook

See [pre-commit] for instructions

Sample `.pre-commit-config.yaml`:
```yaml
- repo: https://github.com/GaukeT/pre-commit-mirrors-trivy
  rev: v0.66.0
  hooks:
    - id: trivy-fs
      args:
        - --exit-code=1 # Example: set exit with code 1
        - --debug # Example: enable debug output
        - . # Example: scan current directory (provide DIR as last argument if `args` are used)
    - id: trivy-config
```

[trivy]: https://trivy.dev/
[pre-commit]: https://pre-commit.com
bytex 0.2.0
Pydantic-like binary validation
License: MIT
Requires Python: >=3.8

# bytex

Like [Pydantic](https://github.com/pydantic/pydantic), but for binary formats.

## Installation

```console
$ pip install bytex
```

## Example

Let’s say you want to represent a user profile in your application using a compact binary format.

Start by defining the user type as a `StructureEnum`:

```python
from bytex import StructureEnum
from bytex.types import U8
from enum import auto


class UserType(StructureEnum(U8)):
    """
    An enum representing a UserType in a single byte.
    """
    ADMIN = auto()
    MEMBER = auto()
    GUEST = auto()
```

> A `StructureEnum` is just a subclass of Python's built-in `Enum`, so you can use it as you normally would.

Then define a structure for a date:

```python
from bytex import Structure
from bytex.types import U16, U8


class Date(Structure):
    year: U16
    month: U8
    day: U8
```

Now bring it all together into a `UserProfile` structure:

```python
from bytex import Structure
from bytex.length_encodings import Terminator
from typing import Annotated


class UserProfile(Structure):
    user_type: UserType
    joined_at: Date
    name: Annotated[str, Terminator("\0")]
```

> The `Annotated[str, Terminator("\0")]` represents a string with a `Terminator` length encoding, meaning the string is serialized with a `"\0"` at the end, and deserialized until a `"\0"` is encountered (There is a pre-made type for this exact scenario called `CStr` located at `structure.types`, which is a null-terminated string).

And you're done!

You can now serialize and parse binary data with ease:

```python
from bytex import Endianness

profile = UserProfile(
    user_type=UserType.ADMIN,
    joined_at=Date(year=2024, month=6, day=25),
    name="admin"
)

binary: bytes = profile.dump(endianness=Endianness.LITTLE)
parsed: UserProfile = UserProfile.parse(binary, endianness=Endianness.LITTLE)
```