Skip to content

Commit 8a4f9af

Browse files
committed
Add comprehensive msgraphfs enhancements
This commit introduces major enhancements to make msgraphfs more intuitive to use. - Support URL-based filesystem paths (msgd://site/drive/path) - Enable single filesystem instance to access multiple SharePoint sites - Add automatic site and drive discovery from URLs - Support msgd://, sharepoint://, and onedrive:// protocols - Add AZURE_* environment variable fallback support - Implement robust OAuth2 token management with automatic refresh - Support both client credentials and delegated authentication flows - Implement lazy HTTP client initialization to prevent fork issues - Add process ID tracking to detect forks and reinitialize clients - Make filesystem safe for multi-process environments like Airflow - Resolve threading and subprocess compatibility problems - Add comprehensive file permissions API (get_permissions method) - Extended metadata with SharePoint-specific fields (weburl, fields) - Include permission analysis with user, group, and link breakdown - Support expand parameters for additional metadata retrieval - Replace content.py with proper pytest fixtures in conftest.py - Add comprehensive live credential testing capabilities - Implement environment variable configuration for test credentials - Add OAuth2 integration tests and URL parsing validation - Extensive documentation updates with usage examples - Multiple protocol registration for fsspec integration - Improved error messages and debugging information - Add support for Python 3.10+ The changes maintain full backward compatibility while adding: - Session-scoped pytest fixtures for better test performance - Lazy initialization patterns for resource management - Comprehensive URL parsing for flexible path specifications - Multi-tenancy support with filesystem instance caching
1 parent 467dec8 commit 8a4f9af

File tree

14 files changed

+3700
-292
lines changed

14 files changed

+3700
-292
lines changed

.github/workflows/test.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.10", "3.11", "3.12"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v3
26+
with:
27+
version: "latest"
28+
29+
- name: Install dependencies
30+
run: |
31+
uv sync --all-extras --dev
32+
33+
- name: Lint with ruff
34+
run: |
35+
uv run ruff check .
36+
37+
- name: Run tests (excluding live credential tests)
38+
run: |
39+
uv run pytest tests/ -v -m "not live" --cov=msgraphfs --cov-report=xml --cov-report=term-missing
40+
41+
- name: Upload coverage to Codecov
42+
uses: codecov/codecov-action@v3
43+
with:
44+
token: ${{ secrets.CODECOV_TOKEN }}
45+
file: ./coverage.xml
46+
fail_ci_if_error: true
47+
48+
test-with-credentials:
49+
runs-on: ubuntu-latest
50+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
51+
environment: testing-with-credentials
52+
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Set up Python 3.11
57+
uses: actions/setup-python@v4
58+
with:
59+
python-version: "3.11"
60+
61+
- name: Install uv
62+
uses: astral-sh/setup-uv@v3
63+
with:
64+
version: "latest"
65+
66+
- name: Install dependencies
67+
run: |
68+
uv sync --all-extras --dev
69+
70+
- name: Run live credential tests (if credentials available)
71+
env:
72+
MSGRAPHFS_CLIENT_ID: ${{ secrets.MSGRAPHFS_CLIENT_ID }}
73+
MSGRAPHFS_TENANT_ID: ${{ secrets.MSGRAPHFS_TENANT_ID }}
74+
MSGRAPHFS_CLIENT_SECRET: ${{ secrets.MSGRAPHFS_CLIENT_SECRET }}
75+
run: |
76+
if [ -n "$MSGRAPHFS_CLIENT_ID" ] && [ -n "$MSGRAPHFS_TENANT_ID" ] && [ -n "$MSGRAPHFS_CLIENT_SECRET" ]; then
77+
echo "Running live credential tests..."
78+
uv run pytest tests/ -v -m "live" --tb=short
79+
else
80+
echo "Skipping live credential tests - credentials not configured"
81+
fi

0 commit comments

Comments
 (0)