Skip to content

App #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
May 13, 2025
Merged

App #25

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
15 changes: 11 additions & 4 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -25,7 +27,12 @@ jobs:
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Add uv to PATH
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Check uv version
run: uv --version

- name: Install dependencies
run: |
Expand All @@ -38,8 +45,8 @@ jobs:

- name: Run tests
run: |
make test
MPLBACKEND=Agg uv run pytest -v -m "not slow"

- name: Run linting
run: |
make lint
uv run ruff check .
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ __pycache__/
.DS_Store
# C extensions
*.so

gitnoc_desktop/.venv/
# Distribution / packaging
.Python
env/
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
v2.4.0
======

* Significant caching bugfixes and updates
* Added a DiskCache that persists across runs
* Added release analytics

v2.3.0
======

Expand Down
24 changes: 16 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: setup test test-all lint format clean docs build run-example test-single
.PHONY: setup test test-all lint format clean docs build run-example test-single mcp gitnoc

# Use uv for all Python operations
PYTHON = python
Expand All @@ -20,10 +20,10 @@ setup-examples:
setup-all:
$(UV) pip install -e ".[all]"

test:
test: setup-all
MPLBACKEND=Agg $(UV) run pytest $(TESTS_DIR) --cov=$(PACKAGE_NAME) --cov-report=term-missing -m "not slow"

test-single:
test-single: setup-all
@if [ "$(test)" = "" ]; then \
echo "Error: Please specify a test using test=<path_to_test>"; \
echo "Example: make test-single test=tests/test_Repository/test_advanced.py::TestRepositoryAdvanced::test_parallel_cumulative_blame"; \
Expand All @@ -32,15 +32,14 @@ test-single:
MPLBACKEND=Agg $(UV) run pytest $(test) -v

test-all:
MPLBACKEND=Agg $(UV) run pytest $(TESTS_DIR) --cov=$(PACKAGE_NAME) --cov-report=term-missing
MPLBACKEmND=Agg $(UV) run pytest $(TESTS_DIR) --cov=$(PACKAGE_NAME) --cov-report=term-missing

lint:
$(UV) run ruff check .
$(UV) run ruff check --fix --unsafe-fixes .

format:
$(UV) run ruff format .
$(UV) run ruff check --fix --unsafe-fixes .


docs:
$(MAKE) -C $(DOCS_DIR) html

Expand Down Expand Up @@ -78,11 +77,18 @@ run-example:
fi
MPLBACKEND=Agg $(UV) run python $(EXAMPLES_DIR)/$(example).py

mcp:
$(UV) run python mcp_server/server.py

gitnoc:
$(UV) run python gitnoc/app.py

help:
@echo "Available commands:"
@echo " setup Install the package in development mode"
@echo " setup-examples Install the package with examples dependencies"
@echo " setup-all Install the package with all dependencies"
@echo " setup-gitnoc Install GitNOC dependencies"
@echo " test Run tests with pytest (excluding slow tests)"
@echo " test-single Run a single test (usage: make test-single test=<path_to_test>)"
@echo " test-all Run all tests including slow tests"
Expand All @@ -94,4 +100,6 @@ help:
@echo " build Build distribution packages"
@echo " publish Publish package to PyPI"
@echo " env-export Export dependencies to requirements.txt"
@echo " run-example Run a specific example (usage: make run-example example=<name>)"
@echo " run-example Run a specific example (usage: make run-example example=<name>)"
@echo " mcp Run the MCP server"
@echo " gitnoc Run the GitNOC Streamlit app"
2 changes: 1 addition & 1 deletion examples/commit_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def repository(path):

# Build repository object
ignore_dirs = ["docs/*", "tests/*", "Data/*"]
r = Repository(path)
r = Repository(path, default_branch="main")

# Check if bare
print("\nRepository type:")
Expand Down
9 changes: 8 additions & 1 deletion examples/punchcard.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
""" """

import sys

import matplotlib

matplotlib.use("Agg") # Set the backend to Agg before importing pyplot
Expand All @@ -12,5 +14,10 @@
g = ProjectDirectory(working_dir=[str(GIT_PANDAS_DIR)], verbose=True)

by = None
punchcard = g.punchcard(branch="master", include_globs=["*.py"], by=by, normalize=2500)
punchcard = g.punchcard(include_globs=["*.py"], by=by, normalize=2500)

if punchcard.empty:
print("No commit data available for punchcard analysis.")
sys.exit(0)

plot_punchcard(punchcard, metric="lines", title="punchcard", by=by)
Loading
Loading