semvec/pypi-packages huggingface dataset:
nqxpack 0.1.7
Library to serialise objects arising from scientific and Machine Learning libraries, including NetKet.
Requires Python: >=3.11

# NQXPack

A library to save and load objects coming from Scientific Machine Learning libraries, with a special attention to Neural Quantum States from NetKet.

Goals:
- Simple format, possible to hand-edit and inspect manually;
- Compatibility among Python version;
- Allows to load Neural Networks with a single ``load`` command;

## Usage

Install with 

```bash
uv add git+https://github.com/NeuralQXLab/nqxpack.git
```
or (but seriously, stop using pip and start using uv)
```bash
pip install git+https://github.com/NeuralQXLab/nqxpack.git
```


### With `flax.linen`

Save a dictionary containing the model and the parameters.
Note that you cannot serialise jax arrays for the time-being but it could easily be added (I'd need to think about how to handle sharding...)

```python
import nqxpack
import jax
from flax import linen as nn
import numpy as np

model = nn.Sequential((
    nn.Dense(features=2),
    nn.gelu,
    nn.Dense(features=1),
    jax.numpy.squeeze,
))

variables = model.init(jax.random.key(1), jax.numpy.ones((2,4)))
variables_np = jax.tree.map(np.asarray, variables)

# for the moment cannot serialise jax arrays.
# Could easily be implemented
nqxpack.save({'model':model, 'variables':jax.tree.map(np.asarray, variables)}, "mymodel.nk")

loaded_dict = nqxpack.load("mymodel.nk")
loaded_model, loaded_variables = loaded_dict['model'], loaded_dict['variables']
```

### With `flax.nnx` (WIP, not working yet)


```python
import nqxpack
import jax
from flax import nnx
import numpy as np

rngs = nnx.Rngs(0)
model = nnx.Sequential(
  nnx.Linear(1, 4, rngs=rngs),  # data
  nnx.Linear(4, 2, rngs=rngs),  # data
)

graphdef, variables = nnx.split(model)
variables_np = jax.tree.map(np.asarray, variables.to_pure_dict())

# for the moment cannot serialise jax arrays.
# Could easily be implemented
nqxpack.save({'graphdef':graphdef, 'variables':variables_np}, "mymodel.nk")

loaded_dict = nqxpack.load("mymodel.nk")
loaded_graphdef, loaded_variables = loaded_dict['model'], loaded_dict['variables']

loaded_model = nnx.merge(loaded_graphdef, loaded_variables)
```


### With NetKet

```python
import nqxpack
import netket as nk

hi = nk.hilbert.Spin(0.5, 10)
operator = nk.operator.spin.sigmax(nqs_state.hilbert, 1)

nqs_state = nk.vqs.MCState(nk.sampler.MetropolisLocal(hi), nk.models.RBM(alpha=4))
# print expectation value:
nqs_state.expect(operator)

nqxpack.save(nqs_state, "nqs_state.nk")
nqs_state_loaded = nqxpack.load("nqs_state.nk")

nqs_state_loaded.expect(operator)
```

## The format

The format is a single zip file. You can decompress it yourself and look into it.

## Feedback required

If you use this library, please let us know of any issue you might find.
collective.html2blocks 1.0.0a3
Convert html to blocks to be used by Volto
Requires Python: >=3.12
Keywords: Plone, Python, Volto

<h1 align="center">collective.html2blocks</h1>

<div align="center">

[![PyPI](https://img.shields.io/pypi/v/collective.html2blocks)](https://pypi.org/project/collective.html2blocks/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/collective.html2blocks)](https://pypi.org/project/collective.html2blocks/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/collective.html2blocks)](https://pypi.org/project/collective.html2blocks/)
[![PyPI - License](https://img.shields.io/pypi/l/collective.html2blocks)](https://pypi.org/project/collective.html2blocks/)
[![PyPI - Status](https://img.shields.io/pypi/status/collective.html2blocks)](https://pypi.org/project/collective.html2blocks/)


[![CI](https://github.com/collective/collective.html2blocks/actions/workflows/ci.yml/badge.svg)](https://github.com/collective/collective.html2blocks/actions/workflows/ci.yml)

[![GitHub contributors](https://img.shields.io/github/contributors/collective/collective.html2blocks)](https://github.com/collective/collective.html2blocks)
[![GitHub Repo stars](https://img.shields.io/github/stars/collective/collective.html2blocks?style=social)](https://github.com/collective/collective.html2blocks)

</div>

**collective.html2blocks** helps with migrations from old Plone versions -- and other CMS -- to Volto.

Read the [documentation](https://collective.github.io/collective.html2blocks).
magic-reqtools 0.2.0
IPython magics and helpers for working with HTTP requests
Requires Python: >=3.10

# reqtools

[![License](https://img.shields.io/github/license/amir-aharon/reqtools)](https://github.com/amir-aharon/reqtools/blob/main/LICENSE)
![Python](https://img.shields.io/badge/python-3.10+-blue)
![Code style](https://img.shields.io/badge/code%20style-black-black)

reqtools is a super simple ipython extension that allows you to pretty-print HTTP responses and convert between requests code and curl commands.

## installation

```bash
pip install magic-reqtools
```

manually loading:

```ipython
# Inside an IPython shell
%load_ext reqtools
```

Automatic loading:

```bash
echo "c.InteractiveShellApp.extensions = ['reqtools']" > ~/.ipython/profile_default/ipython_config.py
```

## Usage

```ipython
# Load the extension
In [1]: %load_ext reqtools

# `curl` magic
In [2]: %curl https://www.affirmations.dev/
Out[2]: <Response [200]>

In [3]: response = _

# `res` magic
In [4]: %res response
================================================================================
Status: 200 OK
URL:    https://www.affirmations.dev/
--------------------------------------------------------------------------------
Headers:
  Content-Length: 54
  Content-Type: application/json; charset=utf-8
  ...
--------------------------------------------------------------------------------
Body:
{
  "affirmation": "Your mind is full of brilliant ideas"
}
================================================================================
Out[4]: <Response [200]>

# `req` magic
In [5]: %req response.request
================================================================================
Method: GET
URL:    https://www.affirmations.dev/
--------------------------------------------------------------------------------
Headers:
  User-Agent: python-requests/2.32.5
  Accept-Encoding: gzip, deflate
  Accept: */*
  Connection: keep-alive
--------------------------------------------------------------------------------
Body:
  <empty>
================================================================================
Out[5]: <PreparedRequest [GET]>

In [6]: response_body = json.loads(bytes.decode(response.content))

# `jq` magic (add `-q` for quiet)
In [7]: %jq response_body .affirmation
"Your mind is full of brilliant ideas"
Out[7]: 'Your mind is full of brilliant ideas'

In [8]: %jq -q response_body .affirmation
Out[8]: 'Your mind is full of brilliant ideas'
```