Skip to content

Commit 8b48710

Browse files
authored
The fourth pre-release (#14)
1 parent 8ecc342 commit 8b48710

36 files changed

+1529
-535
lines changed

.editorconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,3 @@ indent_size = 2
3636
# TOML files
3737
[*.toml]
3838
indent_size = 2
39-

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [habedi]

.github/workflows/lint.yml renamed to .github/workflows/lints.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
name: Run Linters
22

33
on:
4-
workflow_dispatch: { } # Allow manual execution
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- main
58
push:
69
tags:
7-
- 'v*' # Trigger on version tags
10+
- 'v*'
11+
12+
permissions:
13+
contents: read
814

915
jobs:
1016
lint:
@@ -17,7 +23,7 @@ jobs:
1723
- name: Set up Rust
1824
uses: actions-rust-lang/setup-rust-toolchain@v1
1925
with:
20-
toolchain: stable
26+
toolchain: '1.86.0' # Pinned to project's MSRV
2127

2228
- name: Install Dependencies
2329
run: |

.github/workflows/publish.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
name: Publish to Crates.io
22

33
on:
4-
workflow_dispatch: { } # Allow manual execution
4+
workflow_dispatch:
55
push:
66
tags:
7-
- 'v*' # Trigger on version tags
7+
- 'v*'
88

9-
jobs:
9+
permissions:
10+
contents: read
1011

11-
# Run tests before publishing and only publish if tests pass
12+
jobs:
1213
call_tests:
1314
uses: ./.github/workflows/tests.yml
1415

@@ -35,4 +36,4 @@ jobs:
3536
sudo apt-get update
3637
sudo apt-get install -y make
3738
cargo publish --token $CARGO_REGISTRY_TOKEN
38-
continue-on-error: false
39+
continue-on-error: false

.github/workflows/publish_py.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
name: Publish to PyPI
22

33
on:
4-
workflow_dispatch: # Enable manual runs
4+
workflow_dispatch:
55
push:
66
tags:
7-
- 'v*' # Trigger on version tags
7+
- 'v*'
88

9-
jobs:
10-
11-
# # Run tests before publishing
12-
# call_tests:
13-
# uses: ./.github/workflows/tests_py.yml
9+
permissions:
10+
contents: read
1411

12+
jobs:
1513
publish_to_pypi:
1614
runs-on: ubuntu-latest
17-
# needs: call_tests
1815

1916
steps:
2017
- name: Checkout Repository
@@ -38,4 +35,4 @@ jobs:
3835
- name: Build and Publish Package
3936
run: |
4037
poetry run make wheel-manylinux
41-
PYPI_TOKEN=${{ secrets.PYPI_API_TOKEN }} poetry run make publish_py
38+
PYPI_TOKEN=${{ secrets.PYPI_API_TOKEN }} poetry run make publish-py

.github/workflows/tests.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
name: Run Tests
22

33
on:
4-
workflow_dispatch: { } # Allow manual execution
5-
workflow_call: # Make this workflow callable from other workflows
4+
workflow_dispatch:
5+
workflow_call:
6+
pull_request:
7+
branches:
8+
- main
69
push:
710
tags:
8-
- 'v*' # Trigger on version tags
11+
- 'v*'
12+
13+
permissions:
14+
contents: read
915

1016
jobs:
1117
build:
@@ -14,7 +20,7 @@ jobs:
1420
strategy:
1521
matrix:
1622
# Define the Rust versions to test against
17-
rust-version: [ "1.83.0", "1.84.0", "beta", "stable" ]
23+
rust-version: [ "1.86.0", "stable" ]
1824

1925
steps:
2026
- name: Checkout Repository
@@ -32,7 +38,7 @@ jobs:
3238
make install-deps
3339
3440
- name: Run Tests and Generate Coverage Report
35-
run: make coverage # Generates a coverage report
41+
run: make coverage
3642

3743
- name: Upload Coverage Reports to Codecov
3844
uses: codecov/codecov-action@v5

.gitignore

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,7 @@ tarpaulin-report.html
7373
# Dependency lock files (uncomment to ignore)
7474
poetry.lock
7575
Cargo.lock
76-
77-
# Miscellaneous files and directories to ignore
78-
# Add any additional file patterns a directory names that should be ignored down here
79-
.DS_Store
80-
tmp_*
81-
temp_*
82-
output_*
83-
*.so
84-
.benchmarks/
85-
ci.yml
86-
src/main.rs
76+
#uv.lock
8777

8878
# Ignore files in the tests/testdata/[graphina-graphs] directory
8979
tests/testdata/*.txt
@@ -97,3 +87,15 @@ tests/testdata/graphina-graphs/*.txt
9787
tests/testdata/graphina-graphs/*.csv
9888
tests/testdata/graphina-graphs/*.json
9989
tests/testdata/graphina-graphs/*.parquet
90+
91+
# Miscellaneous files and directories to ignore
92+
# Add any additional file patterns a directory names that should be ignored down here
93+
.DS_Store
94+
tmp_*
95+
temp_*
96+
output_*
97+
*.so
98+
.benchmarks/
99+
ci.yml
100+
src/main.rs
101+
*_output.txt

.pre-commit-config.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
default_stages: [ pre-push ]
2+
fail_fast: false
3+
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v5.0.0
7+
hooks:
8+
- id: trailing-whitespace
9+
args: [ --markdown-linebreak-ext=md ]
10+
- id: end-of-file-fixer
11+
- id: mixed-line-ending
12+
- id: check-merge-conflict
13+
- id: check-added-large-files
14+
- id: detect-private-key
15+
- id: check-yaml
16+
- id: check-toml
17+
- id: check-json
18+
- id: check-docstring-first
19+
- id: pretty-format-json
20+
args: [ --autofix, --no-sort-keys ]
21+
22+
- repo: local
23+
hooks:
24+
- id: format
25+
name: Format Code
26+
entry: make format
27+
language: system
28+
pass_filenames: false
29+
30+
- id: lint
31+
name: Check Code Style
32+
entry: make lint
33+
language: system
34+
pass_filenames: false
35+
36+
- id: test
37+
name: Run Tests
38+
entry: make nexttest
39+
language: system
40+
pass_filenames: false

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "graphina"
3-
version = "0.2.2-alpha"
3+
version = "0.3.0-a1"
44
description = "A graph data science library for Rust"
55
repository = "https://github.com/habedi/graphina"
66
license = "MIT OR Apache-2.0"
@@ -10,8 +10,8 @@ authors = ["Hassan Abedi <hassan.abedi.t@gmail.com>"]
1010
homepage = "https://github.com/habedi/graphina"
1111
documentation = "https://docs.rs/graphina"
1212
categories = ["data-structures", "algorithms"]
13-
edition = "2021"
14-
rust-version = "1.83"
13+
edition = "2024"
14+
rust-version = "1.86.0"
1515

1616
resolver = "2"
1717

@@ -41,10 +41,10 @@ sprs = "0.11.3"
4141
ordered-float = "5.0.0"
4242
rayon = "1.10.0"
4343
nalgebra = "0.33.2"
44-
petgraph = { version = "0.7.1", features = ["graphmap", "stable_graph", "matrix_graph", "serde-1", "rayon"] }
44+
petgraph = { version = "0.8.2", features = ["graphmap", "stable_graph", "matrix_graph", "serde-1", "rayon"] }
4545

4646
[dev-dependencies]
47-
criterion = { version = "0.5", features = ["html_reports"] }
47+
criterion = { version = "0.7.0", features = ["html_reports"] }
4848

4949
[[bench]]
5050
name = "project_benchmarks"

Makefile

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ RUST_LOG := info
88
RUST_BACKTRACE := full
99
WHEEL_DIR := dist
1010
PYGRAPHINA_DIR := pygraphina
11+
PY_DEP_MNGR := uv # Use `uv sync --all-extras` to make the environment
1112
TEST_DATA_DIR := tests/testdata
1213
SHELL := /bin/bash
13-
MSRV := 1.83
14+
MSRV := 1.86
1415

1516
# Find the latest built Python wheel file
1617
WHEEL_FILE := $(shell ls $(PYGRAPHINA_DIR)/$(WHEEL_DIR)/pygraphina-*.whl 2>/dev/null | head -n 1)
@@ -20,8 +21,8 @@ WHEEL_FILE := $(shell ls $(PYGRAPHINA_DIR)/$(WHEEL_DIR)/pygraphina-*.whl 2>/dev/
2021

2122
.PHONY: help
2223
help: ## Show the help message for each target
23-
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
24-
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
24+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | \
25+
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
2526

2627
########################################################################################
2728
## Rust targets
@@ -74,6 +75,8 @@ install-deps: install-snap ## Install development dependencies
7475
@cargo install cargo-tarpaulin
7576
@cargo install cargo-audit
7677
@cargo install cargo-nextest
78+
@sudo apt-get install python3-pip
79+
@pip install $(PY_DEP_MNGR)
7780

7881
.PHONY: lint
7982
lint: format ## Run linters on Rust files
@@ -125,9 +128,9 @@ install-msrv: ## Install the minimum supported Rust version (MSRV) for developme
125128
run-examples: ## Run all the scripts in the examples directory one by one
126129
@echo "Running all example scripts..."
127130
@for example in examples/*.rs; do \
128-
example_name=$$(basename $$example .rs); \
129-
echo "Running example: $$example_name"; \
130-
cargo run --example $$example_name; \
131+
example_name=$$(basename $$example .rs); \
132+
echo "Running example: $$example_name"; \
133+
cargo run --example $$example_name; \
131134
done
132135

133136
########################################################################################
@@ -153,14 +156,14 @@ wheel-manylinux: ## Build the manylinux wheel file for PyGraphina (using Zig)
153156
.PHONY: test-py
154157
test-py: develop-py ## Run Python tests
155158
@echo "Running Python tests..."
156-
@poetry run pytest $(PYGRAPHINA_DIR)/tests
159+
@$(PY_DEP_MNGR) run pytest
157160

158161
.PHONY: publish-py
159162
publish-py: wheel-manylinux ## Publish the PyGraphina wheel to PyPI (requires PYPI_TOKEN to be set)
160163
@echo "Publishing PyGraphina to PyPI..."
161164
@if [ -z "$(WHEEL_FILE)" ]; then \
162-
echo "Error: No wheel file found. Please run 'make wheel' first."; \
163-
exit 1; \
165+
echo "Error: No wheel file found. Please run 'make wheel' first."; \
166+
exit 1; \
164167
fi
165168
@echo "Found wheel file: $(WHEEL_FILE)"
166169
@twine upload -u __token__ -p $(PYPI_TOKEN) $(WHEEL_FILE)
@@ -169,3 +172,19 @@ publish-py: wheel-manylinux ## Publish the PyGraphina wheel to PyPI (requires PY
169172
generate-ci: ## Generate CI configuration files (GitHub Actions workflow)
170173
@echo "Generating CI configuration files..."
171174
@(cd $(PYGRAPHINA_DIR) && maturin generate-ci --zig --pytest --platform all -o ../.github/workflows/ci.yml github)
175+
176+
########################################################################################
177+
## Additional targets
178+
########################################################################################
179+
180+
.PHONY: setup-hooks
181+
setup-hooks: ## Install Git hooks (pre-commit and pre-push)
182+
@echo "Installing Git hooks..."
183+
@pre-commit install --hook-type pre-commit
184+
@pre-commit install --hook-type pre-push
185+
@pre-commit install-hooks
186+
187+
.PHONY: test-hooks
188+
test-hooks: ## Test Git hooks on all files
189+
@echo "Testing Git hooks..."
190+
@pre-commit run --all-files

0 commit comments

Comments
 (0)