Skip to content

Commit 649c651

Browse files
authored
C++ core integration (#93)
* refactoring to use NetGraph-Core * Update version to 0.10.0, performance improvements * fixed disabled nodes and links in caching logic, covered with tests
1 parent aa55d2e commit 649c651

213 files changed

Lines changed: 10396 additions & 24000 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,4 @@ analysis*.html
141141
# Performance analysis results
142142
dev/perf_results/
143143
dev/perf_plots/
144+
.benchmarks/

Makefile

Lines changed: 68 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
# NetGraph Development Makefile
22
# This Makefile provides convenient shortcuts for common development tasks
33

4-
.PHONY: help dev install check check-ci lint format test qt clean docs docs-serve docs-diagrams build check-dist publish-test publish validate perf info
4+
.PHONY: help venv clean-venv dev install check check-ci lint format test qt clean docs docs-serve docs-diagrams build check-dist publish-test publish validate perf info check-python hooks
55

66
# Default target - show help
77
.DEFAULT_GOAL := help
88

99
# Toolchain (prefer project venv if present)
10-
VENV_BIN := $(PWD)/ngraph-venv/bin
11-
PYTHON := $(if $(wildcard $(VENV_BIN)/python),$(VENV_BIN)/python,python3)
12-
PIP := $(PYTHON) -m pip
13-
PYTEST := $(PYTHON) -m pytest
14-
RUFF := $(PYTHON) -m ruff
15-
PRECOMMIT := $(PYTHON) -m pre_commit
10+
VENV_BIN := $(PWD)/venv/bin
11+
# Use dynamic (recursive) assignment so a newly created venv is picked up
12+
# Prefer the python3 on PATH (e.g., set by setup-python)
13+
PY_FIND := $(shell command -v python3 2>/dev/null || command -v python 2>/dev/null)
14+
PYTHON ?= $(if $(wildcard $(VENV_BIN)/python),$(VENV_BIN)/python,$(PY_FIND))
15+
PIP = $(PYTHON) -m pip
16+
PYTEST = $(PYTHON) -m pytest
17+
RUFF = $(PYTHON) -m ruff
18+
PRECOMMIT = $(PYTHON) -m pre_commit
1619

1720
help:
1821
@echo "🔧 NetGraph Development Commands"
1922
@echo ""
2023
@echo "Setup & Installation:"
21-
@echo " make install - Install package for usage (no dev dependencies)"
24+
@echo " make venv - Create a local virtualenv (./venv)"
2225
@echo " make dev - Full development environment (package + dev deps + hooks)"
26+
@echo " make install - Install package for usage (no dev dependencies)"
27+
@echo " make clean-venv - Remove virtual environment"
2328
@echo ""
2429
@echo "Code Quality & Testing:"
2530
@echo " make check - Run pre-commit (auto-fix) + schema + tests, then lint"
@@ -46,11 +51,48 @@ help:
4651
@echo ""
4752
@echo "Utilities:"
4853
@echo " make info - Show project information"
54+
@echo " make hooks - Run pre-commit on all files"
55+
@echo " make check-python - Check if venv Python matches system Python"
4956

5057
# Setup and Installation
5158
dev:
5259
@echo "🚀 Setting up development environment..."
53-
@bash dev/setup-dev.sh
60+
@if [ ! -x "$(VENV_BIN)/python" ]; then \
61+
if [ -z "$(PY_FIND)" ]; then \
62+
echo "❌ Error: No Python interpreter found (python3 or python)"; \
63+
exit 1; \
64+
fi; \
65+
echo "🐍 Creating virtual environment with $(PY_FIND) ..."; \
66+
$(PY_FIND) -m venv venv || { echo "❌ Failed to create venv"; exit 1; }; \
67+
if [ ! -x "$(VENV_BIN)/python" ]; then \
68+
echo "❌ Error: venv creation failed - $(VENV_BIN)/python not found"; \
69+
exit 1; \
70+
fi; \
71+
$(VENV_BIN)/python -m pip install -U pip wheel; \
72+
fi
73+
@echo "📦 Installing dev dependencies..."
74+
@$(VENV_BIN)/python -m pip install -e .'[dev]'
75+
@echo "🔗 Installing pre-commit hooks..."
76+
@$(VENV_BIN)/python -m pre_commit install --install-hooks
77+
@echo "✅ Dev environment ready. Activate with: source venv/bin/activate"
78+
@$(MAKE) check-python
79+
80+
venv:
81+
@echo "🐍 Creating virtual environment in ./venv ..."
82+
@if [ -z "$(PY_FIND)" ]; then \
83+
echo "❌ Error: No Python interpreter found (python3 or python)"; \
84+
exit 1; \
85+
fi
86+
@$(PY_FIND) -m venv venv || { echo "❌ Failed to create venv"; exit 1; }
87+
@if [ ! -x "$(VENV_BIN)/python" ]; then \
88+
echo "❌ Error: venv creation failed - $(VENV_BIN)/python not found"; \
89+
exit 1; \
90+
fi
91+
@$(VENV_BIN)/python -m pip install -U pip wheel
92+
@echo "✅ venv ready. Activate with: source venv/bin/activate"
93+
94+
clean-venv:
95+
@rm -rf venv/
5496

5597
install:
5698
@echo "📦 Installing package for usage (no dev dependencies)..."
@@ -184,7 +226,9 @@ info:
184226
@echo "================================"
185227
@echo ""
186228
@echo "🐍 Python Environment:"
187-
@echo " Python version: $$($(PYTHON) --version)"
229+
@echo " Python (active): $$($(PYTHON) --version)"
230+
@echo " Python (system): $$($(PY_FIND) --version 2>/dev/null || echo 'missing')"
231+
@$(MAKE) check-python
188232
@echo " Package version: $$($(PYTHON) -c 'import importlib.metadata; print(importlib.metadata.version("ngraph"))' 2>/dev/null || echo 'Not installed')"
189233
@echo " Virtual environment: $$(echo $$VIRTUAL_ENV | sed 's|.*/||' || echo 'None active')"
190234
@echo ""
@@ -208,3 +252,17 @@ info:
208252
echo " ... and $$(( $$(git status --porcelain | wc -l | tr -d ' ') - 5 )) more"; \
209253
fi; \
210254
fi
255+
256+
hooks:
257+
@echo "🔗 Running pre-commit on all files..."
258+
@$(PRECOMMIT) run --all-files || (echo "Some pre-commit hooks failed. Fix and re-run." && exit 1)
259+
260+
check-python:
261+
@if [ -x "$(VENV_BIN)/python" ]; then \
262+
VENV_VER=$$($(VENV_BIN)/python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" 2>/dev/null || echo "unknown"); \
263+
SYS_VER=$$($(PY_FIND) -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" 2>/dev/null || echo "unknown"); \
264+
if [ -n "$$VENV_VER" ] && [ -n "$$SYS_VER" ] && [ "$$VENV_VER" != "$$SYS_VER" ]; then \
265+
echo "⚠️ WARNING: venv Python ($$VENV_VER) != system Python ($$SYS_VER)"; \
266+
echo " Run 'make clean-venv && make dev' to recreate venv with system Python"; \
267+
fi; \
268+
fi

0 commit comments

Comments
 (0)