feagi-rust-py-libs 0.0.82__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of feagi-rust-py-libs might be problematic. Click here for more details.
- feagi_rust_py_libs-0.0.82/.cargo/config.toml +12 -0
- feagi_rust_py_libs-0.0.82/.github/workflows/pr-validation.yml +126 -0
- feagi_rust_py_libs-0.0.82/.github/workflows/publish_pypi_rust_py_libs.yml +531 -0
- feagi_rust_py_libs-0.0.82/.gitignore +75 -0
- feagi_rust_py_libs-0.0.82/Cargo.lock +4169 -0
- feagi_rust_py_libs-0.0.82/Cargo.toml +42 -0
- feagi_rust_py_libs-0.0.82/LICENSE +201 -0
- feagi_rust_py_libs-0.0.82/PKG-INFO +82 -0
- feagi_rust_py_libs-0.0.82/README.md +54 -0
- feagi_rust_py_libs-0.0.82/build.rs +189 -0
- feagi_rust_py_libs-0.0.82/example_genome_validator.py +82 -0
- feagi_rust_py_libs-0.0.82/feagi_data_processing.pyi +1995 -0
- feagi_rust_py_libs-0.0.82/feagi_data_processing.pyi.template +1819 -0
- feagi_rust_py_libs-0.0.82/pyproject.toml +39 -0
- feagi_rust_py_libs-0.0.82/requirements.txt +0 -0
- feagi_rust_py_libs-0.0.82/rust_build_scripts/io_cache_template_writer.rs +869 -0
- feagi_rust_py_libs-0.0.82/rust_build_scripts/mod.rs +2 -0
- feagi_rust_py_libs-0.0.82/rust_build_scripts/pyi_generator.rs +91 -0
- feagi_rust_py_libs-0.0.82/src/IDE_setup.md +8 -0
- feagi_rust_py_libs-0.0.82/src/feagi_agent_sdk/mod.rs +58 -0
- feagi_rust_py_libs-0.0.82/src/feagi_agent_sdk/py_agent_client.rs +141 -0
- feagi_rust_py_libs-0.0.82/src/feagi_agent_sdk/py_agent_config.rs +141 -0
- feagi_rust_py_libs-0.0.82/src/feagi_agent_sdk/py_agent_type.rs +76 -0
- feagi_rust_py_libs-0.0.82/src/feagi_agent_sdk_py/mod.rs +29 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/connector_agent.rs +1073 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_pipeline/descriptors.rs +1 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_pipeline/mod.rs +4 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_pipeline/pipeline_stage_properties.rs +140 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_pipeline/pipeline_stage_properties_macro.rs +1 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_pipeline/stage_properties/image_pixel_value_count_threshold.rs +77 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_pipeline/stage_properties/image_quick_diff.rs +62 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_pipeline/stage_properties/image_segmentor.rs +60 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_pipeline/stage_properties/image_transformer.rs +37 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_pipeline/stage_properties/mod.rs +16 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_types/descriptors.rs +513 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_types/gaze_properties.rs +23 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_types/image_filtering_settings.rs +37 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_types/image_frame.rs +200 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_types/json_structure.rs_disabled +135 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_types/misc_data.rs +37 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_types/mod.rs +24 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_types/percentages.rs +533 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_types/processing/image_frame_processor.rs +62 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_types/processing/image_frame_segmentator.rs +31 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_types/processing/mod.rs +5 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_types/segmented_image_frame.rs +65 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/data_types/text_token.rs +101 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/mod.rs +6 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/wrapped_io_data/mod.rs +8 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/wrapped_io_data/wrapped_iodata.rs +121 -0
- feagi_rust_py_libs-0.0.82/src/feagi_connector_core/wrapped_io_data/wrapped_iotype.rs +123 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_serialization/byte_structure/feagi_byte_structure.rs.disabled +216 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_serialization/byte_structure/feagi_byte_structure_compatible.rs.disabled +36 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_serialization/byte_structure/feagi_byte_structure_type.rs.disabled +28 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_serialization/byte_structure/mod.rs +7 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_serialization/feagi_byte_container.rs +126 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_serialization/feagi_byte_structure_type.rs +22 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_serialization/feagi_serializable.rs +2 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_serialization/mod.rs +9 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/genomic/brain_regions/mod.rs +1 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/genomic/cortical_area/cortical_area.rs +1 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/genomic/cortical_area/cortical_id.rs +104 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/genomic/cortical_area/cortical_type.rs +88 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/genomic/cortical_area/descriptors.rs +17 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/genomic/cortical_area/io_cortical_area_data_flag.rs +179 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/genomic/cortical_area/mod.rs +9 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/genomic/descriptors.rs +4 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/genomic/mod.rs +9 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/genomic/motor_cortical_unit.rs +194 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/genomic/sensory_cortical_unit.rs +111 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/mod.rs +3 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/neurons_voxels/README.md +6 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/neurons_voxels/mod.rs +1 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/neurons_voxels/xyzp/README.md +11 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/neurons_voxels/xyzp/cortical_mapped_xyzp_voxel_data.rs +273 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/neurons_voxels/xyzp/mod.rs +7 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/neurons_voxels/xyzp/neuron_voxel_xyzp.rs +20 -0
- feagi_rust_py_libs-0.0.82/src/feagi_data_structures/neurons_voxels/xyzp/neuron_voxel_xyzp_arrays.rs +156 -0
- feagi_rust_py_libs-0.0.82/src/feagi_evo/mod.rs +6 -0
- feagi_rust_py_libs-0.0.82/src/feagi_evo/validator.rs +148 -0
- feagi_rust_py_libs-0.0.82/src/lib.rs +167 -0
- feagi_rust_py_libs-0.0.82/src/py_error.rs +45 -0
- feagi_rust_py_libs-0.0.82/src/useful_macros/mod.rs +3 -0
- feagi_rust_py_libs-0.0.82/src/useful_macros/py_enum_wrapping.rs +59 -0
- feagi_rust_py_libs-0.0.82/src/useful_macros/py_struct_wrapping.rs +167 -0
- feagi_rust_py_libs-0.0.82/src/useful_macros/py_struct_wrapping_with_inheritance.rs +285 -0
- feagi_rust_py_libs-0.0.82/test.py +50 -0
- feagi_rust_py_libs-0.0.82/test_image.py +59 -0
- feagi_rust_py_libs-0.0.82/test_macroized.py +6 -0
- feagi_rust_py_libs-0.0.82/test_neurons.py +27 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Cargo build configuration for feagi-rust-py-libs
|
|
2
|
+
|
|
3
|
+
# Windows: Force static CRT linking to avoid runtime library conflicts
|
|
4
|
+
# between different dependencies (tokenizers vs zmq)
|
|
5
|
+
[target.x86_64-pc-windows-msvc]
|
|
6
|
+
rustflags = ["-C", "target-feature=+crt-static"]
|
|
7
|
+
|
|
8
|
+
[target.i686-pc-windows-msvc]
|
|
9
|
+
rustflags = ["-C", "target-feature=+crt-static"]
|
|
10
|
+
|
|
11
|
+
# Note: Vendored OpenSSL is configured in Cargo.toml as a dependency feature
|
|
12
|
+
# openssl-sys = { version = "0.9", features = ["vendored"] }
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# PR Validation Workflow
|
|
2
|
+
# Runs on all pull requests to validate builds, tests, and version bumps
|
|
3
|
+
|
|
4
|
+
name: PR Validation
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
pull_request:
|
|
8
|
+
types: [opened, synchronize, reopened]
|
|
9
|
+
branches:
|
|
10
|
+
- staging
|
|
11
|
+
- main
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
test-and-version-check:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout PR code
|
|
22
|
+
uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Checkout base branch for version comparison
|
|
25
|
+
uses: actions/checkout@v4
|
|
26
|
+
with:
|
|
27
|
+
ref: ${{ github.base_ref }}
|
|
28
|
+
path: base
|
|
29
|
+
fetch-depth: 1
|
|
30
|
+
|
|
31
|
+
- uses: actions/setup-python@v5
|
|
32
|
+
with:
|
|
33
|
+
python-version: '3.9'
|
|
34
|
+
|
|
35
|
+
- name: Install Rust
|
|
36
|
+
uses: dtolnay/rust-toolchain@stable
|
|
37
|
+
with:
|
|
38
|
+
toolchain: stable
|
|
39
|
+
|
|
40
|
+
- name: Run Rust tests
|
|
41
|
+
run: cargo test --verbose
|
|
42
|
+
|
|
43
|
+
- name: Build wheels (Linux x86_64)
|
|
44
|
+
uses: PyO3/maturin-action@v1
|
|
45
|
+
with:
|
|
46
|
+
target: x86_64
|
|
47
|
+
args: --release --out dist --find-interpreter
|
|
48
|
+
sccache: true
|
|
49
|
+
before-script-linux: |
|
|
50
|
+
# Install system OpenSSL for x86_64
|
|
51
|
+
# Note: manylinux containers already run as root, but some need explicit sudo
|
|
52
|
+
if command -v yum >/dev/null 2>&1; then
|
|
53
|
+
yum install -y openssl-devel pkgconfig
|
|
54
|
+
elif command -v dnf >/dev/null 2>&1; then
|
|
55
|
+
dnf install -y openssl-devel pkgconfig
|
|
56
|
+
elif command -v microdnf >/dev/null 2>&1; then
|
|
57
|
+
microdnf install -y openssl-devel pkgconfig
|
|
58
|
+
elif command -v apt-get >/dev/null 2>&1; then
|
|
59
|
+
sudo apt-get update -y
|
|
60
|
+
sudo apt-get install -y libssl-dev pkg-config
|
|
61
|
+
elif command -v apk >/dev/null 2>&1; then
|
|
62
|
+
apk add --no-cache openssl-dev pkgconf
|
|
63
|
+
else
|
|
64
|
+
echo "No supported package manager found" >&2
|
|
65
|
+
exit 1
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
- name: Install and test wheel
|
|
69
|
+
run: |
|
|
70
|
+
pip install dist/*.whl
|
|
71
|
+
python -c "import feagi_rust_py_libs; print('✅ Package imports successfully')"
|
|
72
|
+
|
|
73
|
+
- name: Install packaging module for version comparison
|
|
74
|
+
run: pip install packaging
|
|
75
|
+
|
|
76
|
+
- name: Check version number increase
|
|
77
|
+
run: |
|
|
78
|
+
# Get current version from PR branch (only the package version, not dependencies)
|
|
79
|
+
CURRENT_VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
|
|
80
|
+
echo "PR branch version: $CURRENT_VERSION"
|
|
81
|
+
|
|
82
|
+
# Read base branch version
|
|
83
|
+
BASE_VERSION=$(grep '^version = ' base/Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
|
|
84
|
+
echo "Base branch version: $BASE_VERSION"
|
|
85
|
+
|
|
86
|
+
# Validate versions are not empty
|
|
87
|
+
if [ -z "$CURRENT_VERSION" ] || [ -z "$BASE_VERSION" ]; then
|
|
88
|
+
echo "❌ Error: Could not extract versions properly"
|
|
89
|
+
echo "Current: '$CURRENT_VERSION'"
|
|
90
|
+
echo "Base: '$BASE_VERSION'"
|
|
91
|
+
exit 1
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
# Compare versions
|
|
95
|
+
if [ "$CURRENT_VERSION" = "$BASE_VERSION" ]; then
|
|
96
|
+
echo "❌ Error: Version must be increased from base branch"
|
|
97
|
+
exit 1
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
# Use Python for reliable version comparison
|
|
101
|
+
export BASE_VER="$BASE_VERSION"
|
|
102
|
+
export CURRENT_VER="$CURRENT_VERSION"
|
|
103
|
+
|
|
104
|
+
python3 << 'EOF'
|
|
105
|
+
import os
|
|
106
|
+
from packaging import version
|
|
107
|
+
import sys
|
|
108
|
+
|
|
109
|
+
base_ver = os.environ['BASE_VER'].strip()
|
|
110
|
+
current_ver = os.environ['CURRENT_VER'].strip()
|
|
111
|
+
|
|
112
|
+
print(f'Comparing: {base_ver} vs {current_ver}')
|
|
113
|
+
|
|
114
|
+
try:
|
|
115
|
+
if version.parse(current_ver) <= version.parse(base_ver):
|
|
116
|
+
print(f'❌ Error: Version must be higher than base branch')
|
|
117
|
+
print(f'Current: {current_ver} is not greater than Base: {base_ver}')
|
|
118
|
+
sys.exit(1)
|
|
119
|
+
else:
|
|
120
|
+
print(f'✅ Version check passed: {base_ver} → {current_ver}')
|
|
121
|
+
except Exception as e:
|
|
122
|
+
print(f'❌ Error parsing versions: {e}')
|
|
123
|
+
print(f'Base version: "{base_ver}"')
|
|
124
|
+
print(f'Current version: "{current_ver}"')
|
|
125
|
+
sys.exit(1)
|
|
126
|
+
EOF
|
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
# Release Workflow - Publish to PyPI
|
|
2
|
+
|
|
3
|
+
name: Publish to PyPI - Rust Py Libs
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
release:
|
|
7
|
+
types: [published]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
inputs:
|
|
10
|
+
version:
|
|
11
|
+
description: 'Version to publish (e.g., 0.0.82 or 0.1.0b1)'
|
|
12
|
+
required: true
|
|
13
|
+
type: string
|
|
14
|
+
dry_run:
|
|
15
|
+
description: 'Dry run (build only, do not publish)'
|
|
16
|
+
required: false
|
|
17
|
+
type: boolean
|
|
18
|
+
default: false
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
contents: read
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
validate-version:
|
|
25
|
+
name: Validate Version
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
outputs:
|
|
28
|
+
version: ${{ steps.version.outputs.version }}
|
|
29
|
+
is_prerelease: ${{ steps.version.outputs.is_prerelease }}
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
|
|
33
|
+
- name: Determine version and validate
|
|
34
|
+
id: version
|
|
35
|
+
run: |
|
|
36
|
+
if [ "${{ github.event_name }}" = "release" ]; then
|
|
37
|
+
TAG="${{ github.event.release.tag_name }}"
|
|
38
|
+
VERSION="${TAG#v}" # Strip 'v' prefix
|
|
39
|
+
IS_PRERELEASE="${{ github.event.release.prerelease }}"
|
|
40
|
+
else
|
|
41
|
+
VERSION="${{ github.event.inputs.version }}"
|
|
42
|
+
# Check if version contains pre-release identifiers
|
|
43
|
+
if [[ "$VERSION" =~ (a|b|rc)[0-9]+ ]]; then
|
|
44
|
+
IS_PRERELEASE="true"
|
|
45
|
+
else
|
|
46
|
+
IS_PRERELEASE="false"
|
|
47
|
+
fi
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# Validate PEP 440 compliance
|
|
51
|
+
echo "🔍 Validating version format: $VERSION"
|
|
52
|
+
|
|
53
|
+
# PEP 440 regex pattern
|
|
54
|
+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(a[0-9]+|b[0-9]+|rc[0-9]+)?(\.post[0-9]+)?(\.dev[0-9]+)?$ ]]; then
|
|
55
|
+
echo "❌ ERROR: Version '$VERSION' does not comply with PEP 440"
|
|
56
|
+
echo ""
|
|
57
|
+
echo "Valid PEP 440 formats:"
|
|
58
|
+
echo " - 0.1.0 (stable release)"
|
|
59
|
+
echo " - 0.1.0a1 (alpha 1)"
|
|
60
|
+
echo " - 0.1.0b1 (beta 1)"
|
|
61
|
+
echo " - 0.1.0rc1 (release candidate 1)"
|
|
62
|
+
echo ""
|
|
63
|
+
echo "Invalid formats:"
|
|
64
|
+
echo " - 0.1.0-beta1 (wrong separator)"
|
|
65
|
+
echo " - v0.1.0 (v prefix not allowed)"
|
|
66
|
+
exit 1
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
echo "✅ Version format is PEP 440 compliant"
|
|
70
|
+
echo ""
|
|
71
|
+
echo "📦 Version: $VERSION"
|
|
72
|
+
echo "📦 Pre-release: $IS_PRERELEASE"
|
|
73
|
+
|
|
74
|
+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
|
75
|
+
echo "is_prerelease=${IS_PRERELEASE}" >> "$GITHUB_OUTPUT"
|
|
76
|
+
|
|
77
|
+
linux:
|
|
78
|
+
needs: validate-version
|
|
79
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
80
|
+
strategy:
|
|
81
|
+
matrix:
|
|
82
|
+
platform:
|
|
83
|
+
- runner: ubuntu-22.04
|
|
84
|
+
target: x86_64
|
|
85
|
+
- runner: ubuntu-22.04
|
|
86
|
+
target: x86
|
|
87
|
+
- runner: ubuntu-22.04
|
|
88
|
+
target: aarch64
|
|
89
|
+
steps:
|
|
90
|
+
- uses: actions/checkout@v4
|
|
91
|
+
|
|
92
|
+
- name: Update Cargo.toml version
|
|
93
|
+
run: |
|
|
94
|
+
VERSION="${{ needs.validate-version.outputs.version }}"
|
|
95
|
+
echo "📝 Updating Cargo.toml version to: $VERSION"
|
|
96
|
+
# Only replace the FIRST occurrence (package version, not dependencies)
|
|
97
|
+
sed -i "0,/^version = /s|^version = .*|version = \"$VERSION\"|" Cargo.toml
|
|
98
|
+
echo "Updated version:"
|
|
99
|
+
grep "^version = " Cargo.toml | head -1
|
|
100
|
+
|
|
101
|
+
- uses: actions/setup-python@v5
|
|
102
|
+
with:
|
|
103
|
+
python-version: '3.9'
|
|
104
|
+
- name: Configure vendored OpenSSL for aarch64 cross-compilation
|
|
105
|
+
if: matrix.platform.target == 'aarch64'
|
|
106
|
+
shell: bash
|
|
107
|
+
run: |
|
|
108
|
+
echo "Configuring vendored OpenSSL for aarch64 cross-compilation..."
|
|
109
|
+
|
|
110
|
+
# Temporarily add vendored OpenSSL to Cargo.toml (CI only)
|
|
111
|
+
# maturin-action handles cross-compilation toolchain in Docker container
|
|
112
|
+
echo "" >> Cargo.toml
|
|
113
|
+
echo "# Temporary: vendored OpenSSL for CI cross-compilation" >> Cargo.toml
|
|
114
|
+
echo "[dependencies.openssl-sys]" >> Cargo.toml
|
|
115
|
+
echo 'version = "0.9"' >> Cargo.toml
|
|
116
|
+
echo 'features = ["vendored"]' >> Cargo.toml
|
|
117
|
+
|
|
118
|
+
echo "✅ Configured vendored OpenSSL for aarch64"
|
|
119
|
+
- name: Build wheels
|
|
120
|
+
uses: PyO3/maturin-action@v1
|
|
121
|
+
env:
|
|
122
|
+
# Set C++11 standard for aarch64 cross-compilation (required by zmq-sys)
|
|
123
|
+
CXXFLAGS: ${{ matrix.platform.target == 'aarch64' && '-std=c++11' || '' }}
|
|
124
|
+
with:
|
|
125
|
+
target: ${{ matrix.platform.target }}
|
|
126
|
+
args: --release --out dist --find-interpreter
|
|
127
|
+
sccache: true
|
|
128
|
+
manylinux: auto
|
|
129
|
+
before-script-linux: |
|
|
130
|
+
if [ "${{ matrix.platform.target }}" = "aarch64" ]; then
|
|
131
|
+
# For aarch64 cross-compilation: install cross-compilation toolchain
|
|
132
|
+
# (vendored OpenSSL configured in previous step)
|
|
133
|
+
if command -v yum >/dev/null 2>&1; then
|
|
134
|
+
yum install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
135
|
+
elif command -v dnf >/dev/null 2>&1; then
|
|
136
|
+
dnf install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
137
|
+
elif command -v microdnf >/dev/null 2>&1; then
|
|
138
|
+
microdnf install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
139
|
+
elif command -v apt-get >/dev/null 2>&1; then
|
|
140
|
+
sudo apt-get update -y
|
|
141
|
+
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
142
|
+
elif command -v apk >/dev/null 2>&1; then
|
|
143
|
+
apk add --no-cache gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
144
|
+
fi
|
|
145
|
+
else
|
|
146
|
+
# For x86_64/x86: install system OpenSSL
|
|
147
|
+
if command -v yum >/dev/null 2>&1; then
|
|
148
|
+
yum install -y openssl-devel pkgconfig
|
|
149
|
+
elif command -v dnf >/dev/null 2>&1; then
|
|
150
|
+
dnf install -y openssl-devel pkgconfig
|
|
151
|
+
elif command -v microdnf >/dev/null 2>&1; then
|
|
152
|
+
microdnf install -y openssl-devel pkgconfig
|
|
153
|
+
elif command -v apt-get >/dev/null 2>&1; then
|
|
154
|
+
sudo apt-get update -y
|
|
155
|
+
sudo apt-get install -y libssl-dev pkg-config
|
|
156
|
+
elif command -v apk >/dev/null 2>&1; then
|
|
157
|
+
apk add --no-cache openssl-dev pkgconf
|
|
158
|
+
else
|
|
159
|
+
echo "No supported package manager found" >&2
|
|
160
|
+
exit 1
|
|
161
|
+
fi
|
|
162
|
+
fi
|
|
163
|
+
- name: Upload wheels
|
|
164
|
+
uses: actions/upload-artifact@v4
|
|
165
|
+
with:
|
|
166
|
+
name: wheels-linux-${{ matrix.platform.target }}
|
|
167
|
+
path: dist
|
|
168
|
+
|
|
169
|
+
musllinux:
|
|
170
|
+
needs: validate-version
|
|
171
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
172
|
+
strategy:
|
|
173
|
+
fail-fast: false
|
|
174
|
+
matrix:
|
|
175
|
+
platform:
|
|
176
|
+
- runner: ubuntu-22.04
|
|
177
|
+
target: x86_64
|
|
178
|
+
- runner: ubuntu-22.04
|
|
179
|
+
target: x86
|
|
180
|
+
- runner: ubuntu-22.04
|
|
181
|
+
target: aarch64
|
|
182
|
+
steps:
|
|
183
|
+
- uses: actions/checkout@v4
|
|
184
|
+
|
|
185
|
+
- name: Update Cargo.toml version
|
|
186
|
+
run: |
|
|
187
|
+
VERSION="${{ needs.validate-version.outputs.version }}"
|
|
188
|
+
echo "📝 Updating Cargo.toml version to: $VERSION"
|
|
189
|
+
# Only replace the FIRST occurrence (package version, not dependencies)
|
|
190
|
+
sed -i "0,/^version = /s|^version = .*|version = \"$VERSION\"|" Cargo.toml
|
|
191
|
+
echo "Updated version:"
|
|
192
|
+
grep "^version = " Cargo.toml | head -1
|
|
193
|
+
|
|
194
|
+
- uses: actions/setup-python@v5
|
|
195
|
+
with:
|
|
196
|
+
python-version: '3.9'
|
|
197
|
+
- name: Configure vendored OpenSSL for aarch64 cross-compilation
|
|
198
|
+
if: matrix.platform.target == 'aarch64'
|
|
199
|
+
shell: bash
|
|
200
|
+
run: |
|
|
201
|
+
echo "Configuring vendored OpenSSL for aarch64 cross-compilation..."
|
|
202
|
+
|
|
203
|
+
# Temporarily add vendored OpenSSL to Cargo.toml (CI only)
|
|
204
|
+
# maturin-action handles cross-compilation toolchain in Docker container
|
|
205
|
+
echo "" >> Cargo.toml
|
|
206
|
+
echo "# Temporary: vendored OpenSSL for CI cross-compilation" >> Cargo.toml
|
|
207
|
+
echo "[dependencies.openssl-sys]" >> Cargo.toml
|
|
208
|
+
echo 'version = "0.9"' >> Cargo.toml
|
|
209
|
+
echo 'features = ["vendored"]' >> Cargo.toml
|
|
210
|
+
|
|
211
|
+
echo "✅ Configured vendored OpenSSL for aarch64"
|
|
212
|
+
- name: Build wheels
|
|
213
|
+
uses: PyO3/maturin-action@v1
|
|
214
|
+
env:
|
|
215
|
+
# Set C++11 standard for aarch64 cross-compilation (required by zmq-sys)
|
|
216
|
+
CXXFLAGS: ${{ matrix.platform.target == 'aarch64' && '-std=c++11' || '' }}
|
|
217
|
+
with:
|
|
218
|
+
target: ${{ matrix.platform.target }}
|
|
219
|
+
args: --release --out dist --find-interpreter
|
|
220
|
+
sccache: true
|
|
221
|
+
manylinux: musllinux_1_2
|
|
222
|
+
before-script-linux: |
|
|
223
|
+
if [ "${{ matrix.platform.target }}" = "aarch64" ]; then
|
|
224
|
+
# For aarch64 cross-compilation: install cross-compilation toolchain
|
|
225
|
+
# (vendored OpenSSL configured in previous step)
|
|
226
|
+
if command -v yum >/dev/null 2>&1; then
|
|
227
|
+
yum install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
228
|
+
elif command -v dnf >/dev/null 2>&1; then
|
|
229
|
+
dnf install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
230
|
+
elif command -v microdnf >/dev/null 2>&1; then
|
|
231
|
+
microdnf install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
232
|
+
elif command -v apt-get >/dev/null 2>&1; then
|
|
233
|
+
sudo apt-get update -y
|
|
234
|
+
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
235
|
+
elif command -v apk >/dev/null 2>&1; then
|
|
236
|
+
apk add --no-cache gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
237
|
+
fi
|
|
238
|
+
else
|
|
239
|
+
# For x86_64/x86: install system OpenSSL
|
|
240
|
+
if command -v yum >/dev/null 2>&1; then
|
|
241
|
+
yum install -y openssl-devel pkgconfig
|
|
242
|
+
elif command -v dnf >/dev/null 2>&1; then
|
|
243
|
+
dnf install -y openssl-devel pkgconfig
|
|
244
|
+
elif command -v microdnf >/dev/null 2>&1; then
|
|
245
|
+
microdnf install -y openssl-devel pkgconfig
|
|
246
|
+
elif command -v apt-get >/dev/null 2>&1; then
|
|
247
|
+
sudo apt-get update -y
|
|
248
|
+
sudo apt-get install -y libssl-dev pkg-config
|
|
249
|
+
elif command -v apk >/dev/null 2>&1; then
|
|
250
|
+
apk add --no-cache openssl-dev pkgconf
|
|
251
|
+
else
|
|
252
|
+
echo "No supported package manager found" >&2
|
|
253
|
+
exit 1
|
|
254
|
+
fi
|
|
255
|
+
fi
|
|
256
|
+
continue-on-error: true
|
|
257
|
+
- name: Upload wheels
|
|
258
|
+
uses: actions/upload-artifact@v4
|
|
259
|
+
if: success()
|
|
260
|
+
with:
|
|
261
|
+
name: wheels-musllinux-${{ matrix.platform.target }}
|
|
262
|
+
path: dist
|
|
263
|
+
|
|
264
|
+
windows:
|
|
265
|
+
needs: validate-version
|
|
266
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
267
|
+
strategy:
|
|
268
|
+
matrix:
|
|
269
|
+
platform:
|
|
270
|
+
- runner: windows-latest
|
|
271
|
+
target: x64
|
|
272
|
+
- runner: windows-latest
|
|
273
|
+
target: x86
|
|
274
|
+
steps:
|
|
275
|
+
- uses: actions/checkout@v4
|
|
276
|
+
|
|
277
|
+
- name: Update Cargo.toml version
|
|
278
|
+
shell: bash
|
|
279
|
+
run: |
|
|
280
|
+
VERSION="${{ needs.validate-version.outputs.version }}"
|
|
281
|
+
echo "📝 Updating Cargo.toml version to: $VERSION"
|
|
282
|
+
# Only replace the FIRST occurrence (package version, not dependencies)
|
|
283
|
+
sed -i "0,/^version = /s|^version = .*|version = \"$VERSION\"|" Cargo.toml
|
|
284
|
+
echo "Updated version:"
|
|
285
|
+
grep "^version = " Cargo.toml | head -1
|
|
286
|
+
|
|
287
|
+
- uses: actions/setup-python@v5
|
|
288
|
+
with:
|
|
289
|
+
python-version: '3.9'
|
|
290
|
+
architecture: ${{ matrix.platform.target }}
|
|
291
|
+
- name: Cache Rust dependencies
|
|
292
|
+
uses: actions/cache@v4
|
|
293
|
+
with:
|
|
294
|
+
path: |
|
|
295
|
+
~/.cargo/registry/index/
|
|
296
|
+
~/.cargo/registry/cache/
|
|
297
|
+
~/.cargo/git/db/
|
|
298
|
+
key: windows-${{ matrix.platform.target }}-cargo-deps-${{ hashFiles('**/Cargo.lock') }}
|
|
299
|
+
restore-keys: |
|
|
300
|
+
windows-${{ matrix.platform.target }}-cargo-deps-
|
|
301
|
+
- name: Build wheels
|
|
302
|
+
uses: PyO3/maturin-action@v1
|
|
303
|
+
with:
|
|
304
|
+
target: ${{ matrix.platform.target }}
|
|
305
|
+
args: --release --out dist --find-interpreter
|
|
306
|
+
sccache: true
|
|
307
|
+
- name: Upload wheels
|
|
308
|
+
uses: actions/upload-artifact@v4
|
|
309
|
+
with:
|
|
310
|
+
name: wheels-windows-${{ matrix.platform.target }}
|
|
311
|
+
path: dist
|
|
312
|
+
|
|
313
|
+
macos:
|
|
314
|
+
needs: validate-version
|
|
315
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
316
|
+
strategy:
|
|
317
|
+
matrix:
|
|
318
|
+
platform:
|
|
319
|
+
- runner: macos-14
|
|
320
|
+
target: aarch64
|
|
321
|
+
steps:
|
|
322
|
+
- uses: actions/checkout@v4
|
|
323
|
+
|
|
324
|
+
- name: Update Cargo.toml version
|
|
325
|
+
run: |
|
|
326
|
+
VERSION="${{ needs.validate-version.outputs.version }}"
|
|
327
|
+
echo "📝 Updating Cargo.toml version to: $VERSION"
|
|
328
|
+
# Only replace the FIRST occurrence (package version, not dependencies)
|
|
329
|
+
sed -i.bak "0,/^version = /s|^version = .*|version = \"$VERSION\"|" Cargo.toml
|
|
330
|
+
rm -f Cargo.toml.bak
|
|
331
|
+
echo "Updated version:"
|
|
332
|
+
grep "^version = " Cargo.toml | head -1
|
|
333
|
+
|
|
334
|
+
- uses: actions/setup-python@v5
|
|
335
|
+
with:
|
|
336
|
+
python-version: '3.9'
|
|
337
|
+
- name: Cache Rust dependencies
|
|
338
|
+
uses: actions/cache@v4
|
|
339
|
+
with:
|
|
340
|
+
path: |
|
|
341
|
+
~/.cargo/registry/index/
|
|
342
|
+
~/.cargo/registry/cache/
|
|
343
|
+
~/.cargo/git/db/
|
|
344
|
+
key: macos-${{ matrix.platform.target }}-cargo-deps-${{ hashFiles('**/Cargo.lock') }}
|
|
345
|
+
restore-keys: |
|
|
346
|
+
macos-${{ matrix.platform.target }}-cargo-deps-
|
|
347
|
+
- name: Build wheels
|
|
348
|
+
uses: PyO3/maturin-action@v1
|
|
349
|
+
with:
|
|
350
|
+
target: ${{ matrix.platform.target }}
|
|
351
|
+
args: --release --out dist --find-interpreter
|
|
352
|
+
sccache: true
|
|
353
|
+
- name: Upload wheels
|
|
354
|
+
uses: actions/upload-artifact@v4
|
|
355
|
+
with:
|
|
356
|
+
name: wheels-macos-${{ matrix.platform.target }}
|
|
357
|
+
path: dist
|
|
358
|
+
|
|
359
|
+
sdist:
|
|
360
|
+
needs: validate-version
|
|
361
|
+
runs-on: ubuntu-latest
|
|
362
|
+
steps:
|
|
363
|
+
- uses: actions/checkout@v4
|
|
364
|
+
|
|
365
|
+
- name: Update Cargo.toml version
|
|
366
|
+
run: |
|
|
367
|
+
VERSION="${{ needs.validate-version.outputs.version }}"
|
|
368
|
+
echo "📝 Updating Cargo.toml version to: $VERSION"
|
|
369
|
+
# Only replace the FIRST occurrence (package version, not dependencies)
|
|
370
|
+
sed -i "0,/^version = /s|^version = .*|version = \"$VERSION\"|" Cargo.toml
|
|
371
|
+
echo "Updated version:"
|
|
372
|
+
grep "^version = " Cargo.toml | head -1
|
|
373
|
+
|
|
374
|
+
- name: Build sdist
|
|
375
|
+
uses: PyO3/maturin-action@v1
|
|
376
|
+
with:
|
|
377
|
+
command: sdist
|
|
378
|
+
args: --out dist
|
|
379
|
+
- name: Upload sdist
|
|
380
|
+
uses: actions/upload-artifact@v4
|
|
381
|
+
with:
|
|
382
|
+
name: wheels-sdist
|
|
383
|
+
path: dist
|
|
384
|
+
|
|
385
|
+
publish:
|
|
386
|
+
name: Publish to PyPI
|
|
387
|
+
runs-on: ubuntu-latest
|
|
388
|
+
needs: [validate-version, linux, musllinux, windows, macos, sdist]
|
|
389
|
+
# Require core platforms to succeed (musllinux is best-effort)
|
|
390
|
+
if: |
|
|
391
|
+
needs.linux.result == 'success' &&
|
|
392
|
+
needs.windows.result == 'success' &&
|
|
393
|
+
needs.macos.result == 'success' &&
|
|
394
|
+
needs.sdist.result == 'success'
|
|
395
|
+
environment:
|
|
396
|
+
name: pypi
|
|
397
|
+
url: https://pypi.org/project/feagi-rust-py-libs/
|
|
398
|
+
permissions:
|
|
399
|
+
id-token: write
|
|
400
|
+
contents: write
|
|
401
|
+
attestations: write
|
|
402
|
+
steps:
|
|
403
|
+
- uses: actions/checkout@v4
|
|
404
|
+
|
|
405
|
+
- name: Determine version and validate
|
|
406
|
+
id: version
|
|
407
|
+
run: |
|
|
408
|
+
if [ "${{ github.event_name }}" = "release" ]; then
|
|
409
|
+
TAG="${{ github.event.release.tag_name }}"
|
|
410
|
+
VERSION="${TAG#v}" # Strip 'v' prefix: v0.1.0 → 0.1.0
|
|
411
|
+
IS_PRERELEASE="${{ github.event.release.prerelease }}"
|
|
412
|
+
else
|
|
413
|
+
VERSION="${{ github.event.inputs.version }}"
|
|
414
|
+
# Check if version contains pre-release identifiers
|
|
415
|
+
if [[ "$VERSION" =~ (a|b|rc)[0-9]+ ]]; then
|
|
416
|
+
IS_PRERELEASE="true"
|
|
417
|
+
else
|
|
418
|
+
IS_PRERELEASE="false"
|
|
419
|
+
fi
|
|
420
|
+
fi
|
|
421
|
+
|
|
422
|
+
# Validate PEP 440 compliance
|
|
423
|
+
echo "🔍 Validating version format: $VERSION"
|
|
424
|
+
|
|
425
|
+
# PEP 440 regex pattern
|
|
426
|
+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(a[0-9]+|b[0-9]+|rc[0-9]+)?(\.post[0-9]+)?(\.dev[0-9]+)?$ ]]; then
|
|
427
|
+
echo "❌ ERROR: Version '$VERSION' does not comply with PEP 440"
|
|
428
|
+
echo ""
|
|
429
|
+
echo "Valid PEP 440 formats:"
|
|
430
|
+
echo " - 0.1.0 (stable release)"
|
|
431
|
+
echo " - 0.1.0a1 (alpha 1)"
|
|
432
|
+
echo " - 0.1.0b1 (beta 1)"
|
|
433
|
+
echo " - 0.1.0rc1 (release candidate 1)"
|
|
434
|
+
echo ""
|
|
435
|
+
echo "Invalid formats:"
|
|
436
|
+
echo " - 0.1.0-beta1 (wrong separator)"
|
|
437
|
+
echo " - v0.1.0 (v prefix not allowed in version)"
|
|
438
|
+
exit 1
|
|
439
|
+
fi
|
|
440
|
+
|
|
441
|
+
echo "✅ Version format is PEP 440 compliant"
|
|
442
|
+
|
|
443
|
+
# Get package name from Cargo.toml
|
|
444
|
+
PACKAGE_NAME=$(grep '^name = ' Cargo.toml | head -1 | sed 's/name = "\(.*\)"/\1/' | tr '-' '_')
|
|
445
|
+
if [ -z "$PACKAGE_NAME" ]; then
|
|
446
|
+
echo "❌ Error: Could not extract package name from Cargo.toml"
|
|
447
|
+
exit 1
|
|
448
|
+
fi
|
|
449
|
+
|
|
450
|
+
echo ""
|
|
451
|
+
echo "📦 Publishing feagi-rust-py-libs"
|
|
452
|
+
echo " Version: $VERSION"
|
|
453
|
+
echo " Pre-release: $IS_PRERELEASE"
|
|
454
|
+
echo " Package: $PACKAGE_NAME"
|
|
455
|
+
|
|
456
|
+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
|
457
|
+
echo "package_name=${PACKAGE_NAME}" >> "$GITHUB_OUTPUT"
|
|
458
|
+
echo "is_prerelease=${IS_PRERELEASE}" >> "$GITHUB_OUTPUT"
|
|
459
|
+
|
|
460
|
+
- name: Download all artifacts
|
|
461
|
+
uses: actions/download-artifact@v4
|
|
462
|
+
with:
|
|
463
|
+
pattern: wheels-*
|
|
464
|
+
path: artifacts
|
|
465
|
+
|
|
466
|
+
- name: Prepare distribution directory
|
|
467
|
+
run: |
|
|
468
|
+
mkdir -p dist
|
|
469
|
+
find artifacts -type f \( -name "*.whl" -o -name "*.tar.gz" \) -exec cp {} dist/ \;
|
|
470
|
+
echo "Files in dist directory:"
|
|
471
|
+
ls -la dist/
|
|
472
|
+
|
|
473
|
+
if [ -z "$(ls -A dist/)" ]; then
|
|
474
|
+
echo "❌ Error: No files found in dist directory"
|
|
475
|
+
exit 1
|
|
476
|
+
fi
|
|
477
|
+
|
|
478
|
+
- name: Generate artifact attestation
|
|
479
|
+
uses: actions/attest-build-provenance@v2
|
|
480
|
+
with:
|
|
481
|
+
subject-path: 'dist/*'
|
|
482
|
+
|
|
483
|
+
- name: Publish to PyPI
|
|
484
|
+
if: ${{ github.event.inputs.dry_run != 'true' }}
|
|
485
|
+
uses: PyO3/maturin-action@v1
|
|
486
|
+
with:
|
|
487
|
+
command: upload
|
|
488
|
+
args: --non-interactive --skip-existing dist/*
|
|
489
|
+
env:
|
|
490
|
+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_PASSWORD_TOKEN }}
|
|
491
|
+
|
|
492
|
+
- name: Summary
|
|
493
|
+
run: |
|
|
494
|
+
VERSION="${{ needs.validate-version.outputs.version }}"
|
|
495
|
+
IS_PRERELEASE="${{ needs.validate-version.outputs.is_prerelease }}"
|
|
496
|
+
DRY_RUN="${{ github.event.inputs.dry_run }}"
|
|
497
|
+
PACKAGE_NAME="feagi_rust_py_libs"
|
|
498
|
+
|
|
499
|
+
if [ "$DRY_RUN" = "true" ]; then
|
|
500
|
+
echo "🔍 Dry run completed for $PACKAGE_NAME==$VERSION"
|
|
501
|
+
echo ""
|
|
502
|
+
echo "Build successful (NOT published)"
|
|
503
|
+
else
|
|
504
|
+
echo "✅ Successfully published $PACKAGE_NAME==$VERSION to PyPI"
|
|
505
|
+
echo ""
|
|
506
|
+
|
|
507
|
+
# Check if this is a pre-release
|
|
508
|
+
if [ "$IS_PRERELEASE" = "true" ]; then
|
|
509
|
+
echo "Pre-release installation (explicit version required):"
|
|
510
|
+
echo " pip install $PACKAGE_NAME==$VERSION"
|
|
511
|
+
echo ""
|
|
512
|
+
echo "Or install latest pre-release:"
|
|
513
|
+
echo " pip install --pre $PACKAGE_NAME"
|
|
514
|
+
else
|
|
515
|
+
echo "Installation (stable release):"
|
|
516
|
+
echo " pip install $PACKAGE_NAME"
|
|
517
|
+
echo ""
|
|
518
|
+
echo "Or specific version:"
|
|
519
|
+
echo " pip install $PACKAGE_NAME==$VERSION"
|
|
520
|
+
fi
|
|
521
|
+
|
|
522
|
+
echo ""
|
|
523
|
+
echo "📦 Published platforms:"
|
|
524
|
+
echo " - ✅ Linux wheels (x86_64, x86, aarch64)"
|
|
525
|
+
echo " - ⚠️ MuslLinux wheels (best effort)"
|
|
526
|
+
echo " - ✅ Windows wheels (x64, x86)"
|
|
527
|
+
echo " - ✅ macOS wheels (aarch64)"
|
|
528
|
+
echo " - ✅ Source distribution"
|
|
529
|
+
echo ""
|
|
530
|
+
echo "🔗 https://pypi.org/project/$PACKAGE_NAME/$VERSION/"
|
|
531
|
+
fi
|