Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
push:
branches:
- main
tags:
- 'v*.*.*'


jobs:
build_wheels:
Expand Down Expand Up @@ -34,6 +37,9 @@ jobs:
# env:
# CIBW_SOME_OPTION: value
# ...
- name: Upload to PyPI
run: python -m twine upload --repository pypi wheelhouse/*.whl
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')

- uses: actions/upload-artifact@v6
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ venv/
.venv/
**.so
__pycache__/
rayx/_version.py
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,8 @@ The 2. option builds the package as a wheel. The resulting wheel can be installe

### Running tests

```bash
uv run pytest tests
```

## Release

Wheels are built using [cibuildwheel](https://cibuildwheel.readthedocs.io/) inside a custom manylinux container with CUDA support:
To run the tests you need to build the package with cmake.

```bash
pipx run cibuildwheel
uv run pytest tests
```

Built wheels are placed in `wheelhouse/`. See `pyproject.toml` for the build configuration.
12 changes: 10 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "rayx"
version = "0.4.6"
dynamic = ["version"]
description = "Python bindings for RAYX"
readme = "README.md"
license = { file = "LICENSE" }
Expand All @@ -27,6 +27,11 @@ build-backend = "scikit_build_core.build"
[tool.scikit-build]
wheel.packages = ["python/rayx"]
cmake.build-type = "Release"
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
sdist.include = ["rayx/_version.py"]

[tool.setuptools_scm] # Section required
write_to = "rayx/_version.py"

[tool.cibuildwheel]
archs = ["x86_64"]
Expand All @@ -40,4 +45,7 @@ pythonpath = ["python"]
package = false

[dependency-groups]
dev = ["twine>=6.2.0"]
dev = [
"setuptools-scm>=10.2.0",
"twine>=6.2.0",
]
9 changes: 4 additions & 5 deletions rayx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

try:
from . import core
from .core import *
from core import *
except ImportError:
# If the import fails, we might be in a development environment where the module is not built yet
# We can try to import from the build directory
Expand All @@ -25,11 +25,11 @@
else:
raise ImportError("Could not import the RAYX C++ extension module. Make sure it is built and available.")


from ._version import *


def get_info():
"""Get information about the RAYX installation"""
"Get information about the RAYX installation"
info = {
"version": __version__,
"python_wrapper": True,
Expand All @@ -39,8 +39,7 @@ def get_info():
return info

# From other files
from .data import rays_to_df
from .data import *

__name__ = "rayx"
__version__ = "0.4.3"
__all__ = ['get_info', 'rays_to_df']
8 changes: 4 additions & 4 deletions tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest
import pandas as pd

sys.path.insert(0, str(Path(__file__).parent.parent / "python"))
sys.path.insert(0, str(Path(__file__).parent.parent))

import rayx

Expand All @@ -27,12 +27,12 @@ def test_rays_to_df_returns_dataframe(df):

def test_rays_to_df_default_columns(df):
expected_columns = [
"path_event_id",
"path_id", "path_event_id",
"position_x", "position_y", "position_z",
"direction_x", "direction_y", "direction_z",
"electric_field_x", "electric_field_y", "electric_field_z",
"energy", "order",
"last_element_id", "source_id",
"optical_path_length", "energy", "order",
"object_id", "source_id",
"event_type",
]
assert list(df.columns) == expected_columns
Expand Down
4 changes: 4 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# tests/test_init.py
import pytest
from pathlib import Path
import sys

sys.path.insert(0, str(Path(__file__).parent.parent))

import rayx


Expand Down
2 changes: 1 addition & 1 deletion tests/test_orientation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import numpy as np
import pytest

sys.path.insert(0, str(Path(__file__).parent.parent / "python"))
sys.path.insert(0, str(Path(__file__).parent.parent))

import rayx

Expand Down
46 changes: 44 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading