semvec/pypi-packages huggingface dataset:
laissez 0.0.1a7
Agents spending you can trust
Requires Python: >=3.10

# Laissez

Agent spending you can trust.

## What you get
- **Paid MCP server**: Create a paid MCP server using `LaissezMCPProvider`.
- **Paying MCP client**: Use `LaissezMCPConnector` to connect to paid MCP servers and pay for their tools automatically.
- **Transparent settlement**: Payments are finalized with x402 and appear in the Laissez App dashboard at <https://app.laissez.xyz>.

## Set up once
- `uv sync --group examples` to pull the example dependencies.
- Grab a Laissez API key via the CLI wizard when you first run the examples, or from <https://app.laissez.xyz>.
- Export your OpenAI API key (the client agent calls an OpenAI model).
- Optional: add the keys to a `.env`; the examples load it with `python-dotenv`.

## Run the paid MCP server
- Command: `uv run examples/mcp/paid-mcp-server.py`
- What happens: spins up a FastMCP streamable http server on `http://127.0.0.1:8000`, generates a temporary wallet (if not provided), and exposes paid tools (e.g. `roll_die`, `multiply`) behind Laissez enforcement. All with the simplicity of `LaissezMCPProvider`.

## Run the paying MCP client
- Ensure the server is live or update `BASE_URL` in `examples/mcp/mcp-client.py` to point at your deployment.
- Command: `uv run examples/mcp/mcp-client.py`
- What happens: creates a `pydantic_ai` agent backed by `LaissezMCPConnector`, pays for two dice rolls plus a multiply call, and prints the result.

## Keep exploring
- See `examples/mcp/README.md` for a deeper walkthrough of the server and client.
- Tweak prices, add more tools, or swap in different MCP agents to prototype your own billing flows.
geojson-msgspec 1.0.0
msgspec GeoJSON model
Requires Python: >=3.9

This project contains code published as an example in the `msgspec project <https://jcristharif.com/msgspec/>`
backported to python 3.8.

GeoJSON
=======

`GeoJSON <https://geojson.org>`__ is a popular format for encoding geographic
data. Its specification_ describes nine different types a message may take
(seven "geometry" types, plus two "feature" types). Here we provide one way of
implementing that specification using ``msgspec`` to handle the parsing and
validation.

The ``loads`` and ``dumps`` methods defined below work similar to the
standard library's ``json.loads``/``json.dumps``, but:

- Will result in high-level `msgspec.Struct` objects representing GeoJSON types
- Will error nicely if a field is missing or the wrong type
- Will fill in default values for optional fields
- Decodes and encodes *significantly faster* than the `json` module (as well as
  most other ``json`` implementations in Python).

This example makes use `msgspec.Struct` types to define the different GeoJSON
types, and `struct-tagged-unions`_ to differentiate between them. See the
relevant docs for more information.

The original source code can be found `here
<https://github.com/jcrist/msgspec/blob/main/examples/geojson>`__.

Here we use the ``loads`` method defined above to read some `example GeoJSON`_.

.. code-block:: ipython3

    In [1]: import msgspec_geojson

    In [2]: with open("canada.json", "rb") as f:
       ...:     data = f.read()

    In [3]: canada = msgspec_geojson.loads(data)

    In [4]: type(canada)  # loaded as high-level, validated object
    Out[4]: msgspec_geojson.FeatureCollection

    In [5]: canada.features[0].properties
    Out[5]: {'name': 'Canada'}

Comparing performance to:

- orjson_
- `json`
- geojson_ (another validating Python implementation)

.. code-block:: ipython3

   In [6]: %timeit msgspec_geojson.loads(data)  # benchmark msgspec
   6.15 ms ± 13.8 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

   In [7]: %timeit orjson.loads(data)  # benchmark orjson
   8.67 ms ± 20.8 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

   In [8]: %timeit json.loads(data)  # benchmark json
   27.6 ms ± 102 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

   In [9]: %timeit geojson.loads(data)  # benchmark geojson
   93.9 ms ± 88.1 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)


This shows that the readable ``msgspec`` implementation above is 1.4x faster
than `orjson` (on this data), while also ensuring the loaded data is valid
GeoJSON.  Compared to geojson_ (another validating geojson library for python),
loading the data using ``msgspec`` was **15.3x faster**.

.. _specification: https://datatracker.ietf.org/doc/html/rfc7946
.. _example GeoJSON: https://github.com/jcrist/msgspec/blob/main/examples/geojson/canada.json
.. _orjson: https://github.com/ijl/orjson
.. _geojson: https://github.com/jazzband/geojson
.. _struct-tagged-unions: https://jcristharif.com/msgspec/structs.html#tagged-unions