Metadata-Version: 2.4
Name: mprpc
Version: 0.1.17
Summary: A fast MessagePack RPC library
Author: mprpc contributors
License: Apache-2.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
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 :: Cython
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# mprpc Extension Building

This directory contains the mprpc Python package with Cython extensions that need to be compiled into `.so` files for different Linux distributions.

## Automatic Building

The build system automatically detects and compiles missing `.so` files using either:

1. **Makefile** - Run `make` to build extensions
2. **Build Script** - Run `./build-extensions.sh` 
3. **Setup.py** - Run `python setup.py build_ext --inplace`

## Files

- `client.pyx` / `server.pyx` - Cython source files
- `client.c` / `server.c` - Generated C files (fallback if Cython unavailable)
- `setup.py` - Enhanced setup script that handles both Cython and C compilation
- `Makefile` - Build automation
- `build-extensions.sh` - Portable build script

## Usage

### Check if extensions exist:
```bash
./build-extensions.sh --check
```

### Build missing extensions:
```bash
make
# or
./build-extensions.sh
```

### Force rebuild:
```bash
make rebuild
# or  
./build-extensions.sh --force
```

## Integration with Main Build

Add this to the main project Makefile to ensure mprpc extensions are built:

```makefile
# Ensure mprpc extensions are compiled
mprpc-extensions:
	@cd src/mprpc && ./build-extensions.sh

build: mprpc-extensions $(PROJECTOR) $(PYENV)
	$(PROJECTOR) devenv build --prefer-final --use-isolated-python
```

## Dependencies

**Required:**
- Python 3.6+
- setuptools

**Optional:**
- Cython (for building from .pyx files)

**Runtime:**
- msgpack
- gevent (for server functionality)

## Troubleshooting

1. **No module named 'Cython'**: Install Cython with `pip install Cython`
2. **Missing .c files**: Either install Cython or ensure the .c files are present
3. **Build fails**: Check that all dependencies are installed and Python development headers are available

The build system is designed to work across different Linux distributions and will automatically:
- Detect available Python version and ABI
- Use Cython if available, otherwise fall back to C files
- Generate appropriate .so filenames for the target platform
- Handle missing dependencies gracefully
