Metadata-Version: 2.1
Name: pyfory
Version: 0.12.0
Summary: Apache Fory™ is a blazingly fast multi-language serialization framework powered by jit and zero-copy
Author-email: chaokunyang <shawn.ck.yang@gmail.com>
Maintainer-email: "https://github.com/chaokunyang" <shawn.ck.yang@gmail.com>
Keywords: fory,serialization,multi-language,fast,row-format,jit,codegen,polymorphic,zero-copy
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Description-Content-Type: text/markdown
Requires-Dist: cloudpickle
Provides-Extra: all
Requires-Dist: pyarrow; extra == "all"
Provides-Extra: dev
Requires-Dist: ruff; extra == "dev"
Provides-Extra: format
Requires-Dist: pyarrow; extra == "format"

# Apache Fory™ Python

Fory is a blazingly-fast multi-language serialization framework powered by just-in-time compilation and zero-copy.

## Build Fory Python

```bash
cd python
# Uninstall numpy first so that when we install pyarrow, it will install the correct numpy version automatically.
# For Python versions less than 3.13, numpy 2 is not currently supported.
pip uninstall -y numpy
# Install necessary environment for Python < 3.13.
pip install pyarrow==15.0.0 Cython wheel pytest
# For Python 3.13, pyarrow 18.0.0 is available and requires numpy version greater than 2.
# pip install pyarrow==18.0.0 Cython wheel pytest
pip install -v -e .
```

If the last steps fails with an error like `libarrow_python.dylib: No such file or directory`,
you are probably suffering from bazel's aggressive caching; the sought library is longer at the
temporary directory it was the last time bazel ran. To remedy this run

> bazel clean --expunge

In this situation, you might also find it fruitful to run bazel yourself before pip:

> bazel build -s //:cp_fory_so

### Environment Requirements

- python 3.8+

## Testing

```bash
cd python
pytest -v -s .
```

## Code Style

```bash
cd python
pip install ruff
ruff format python
```

## Debug

```bash
cd python
python setup.py develop
```

- Use `cython --cplus -a  pyfory/_serialization.pyx` to produce an annotated HTML file of the source code. Then you can
  analyze interaction between Python objects and Python's C API.
- Read more: <https://cython.readthedocs.io/en/latest/src/userguide/debugging.html>

```bash
FORY_DEBUG=true python setup.py build_ext --inplace
# For linux
cygdb build
```

## Debug with lldb

```bash
lldb
(lldb) target create -- python
(lldb) settings set -- target.run-args "-c" "from pyfory.tests.test_serializer import test_enum; test_enum()"
(lldb) run
(lldb) bt
```
