fabric-cicd
Copilot instructions333 starsChanged 7 months agoMITView on GitHub
fabric-cicd is a Python library for Microsoft Fabric CI/CD automation. It supports code-first Continuous Integration/Continuous Deployment automations to integrate Source Controlled workspaces into a deployment framework. Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here. Prerequisites: Requires Python 3.9+ Mandatory Validation (ALWAYS): Critical: NEVER cancel build/test commands. CI (.github/workflows/validate.yml) will fail if validation workflow incomplete. Must provide explicit token_credential parameter to FabricWorkspace. Alternative: deploy_with_config()…
- Installs packages
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
20 rules. About 0 are common, 7 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 5
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does …
- Distinctive: line 24
Import check → 2. Run tests → 3.
- Very specific: line 26
Critical: NEVER cancel build/test commands.
- Very specific: line 30
Must provide explicit token_credential parameter to FabricWorkspace.
- Distinctive: line 36
Testing/imports: No authentication needed
- Very specific: line 102
Only import from the top-level package (src/fabric_cicd/__init__.py).
- Very specific: line 149
Adding constants: Add to ItemType enum + SERIAL_ITEM_PUBLISH_ORDER in src/fabric_cicd/constants.py
- Very specific: line 151
Adding public exports: Update __all__ in src/fabric_cicd/__init__.py
- Very specific: line 166
Test file naming: Follow the conventions in the tests/ directory.
- Distinctive: line 187
Base branch: Always target main unless otherwise specified.
- Distinctive: line 191
Use "Fixes" for bug fixes, "Closes" for features, "Resolves" for other changes
- Distinctive: line 200
All PRs must be linked to valid GitHub issue
- Very specific: line 204
Do not modify uv.lock manually — it is managed by uv
- Very specific: line 205
Do not import from internal modules (e.g., fabric_cicd._items) — only use the public API from fabric_cicd
- Very specific: line 206
Do not add print() statements — use the standard logging module
- Distinctive: line 207
Do not create PRs without a linked GitHub issue
- Very specific: line 208
Do not modify .github/workflows/ files unless explicitly required
- Very specific: line 214
Import errors: Use uv run python prefix to ensure virtual environment
- Very specific: line 216
Setup failures: Run uv sync --dev if modules missing
- Very specific: line 217
Formatting issues: Run uv run ruff format to auto-fix most issues
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Fabric CICD
fabric-cicd is a Python library for Microsoft Fabric CI/CD automation. It supports code-first Continuous Integration/Continuous Deployment automations to integrate Source Controlled workspaces into a deployment framework.
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
Quick Command Reference
Prerequisites: Requires Python 3.9+
| Task | Command | Timeout |
| Setup | pip install uv && uv sync --dev (NEVER CANCEL) | 120+s |
| Test | uv run pytest -v (NEVER CANCEL) | 120+s |
| Import check | uv run python -c "from fabric_cicd import FabricWorkspace; print('Import successful')" | 30s |
| Format | uv run ruff format (Fix formatting issues) | 60s |
| Lint check | uv run ruff check (Check for linting issues) | 60s |
| Format check | uv run ruff format --check (Verify formatting is correct) | 60s |
| Docs build | uv run mkdocs build --clean (Build documentation) | 60s |
| Docs serve | uv run mkdocs serve (Start local documentation server) | 60s |
Mandatory Validation (ALWAYS):
- Import check → 2. Run tests → 3. Format code → 4. Check linting → 5. Commit
Critical: NEVER cancel build/test commands. CI (.github/workflows/validate.yml) will fail if validation workflow incomplete.
Authentication
Must provide explicit token_credential parameter to FabricWorkspace.
Methods:
- Local development:
AzureCliCredential()orAzurePowerShellCredential() - CI/CD pipelines:
ClientSecretCredential()with service principal - Testing/imports: No authentication needed
Example:
from azure.identity import AzureCliCredential
from fabric_cicd import FabricWorkspace
token_credential = AzureCliCredential()
workspace = FabricWorkspace(
workspace_id="your-id",
repository_directory="/path/to/workspace/items",
token_credential=token_credential
)Basic Usage
Programmatic API
from azure.identity import AzureCliCredential
from fabric_cicd import FabricWorkspace, publish_all_items, unpublish_all_orphan_items
token_credential = AzureCliCredential()
# Initialize workspace (supports either workspace_id OR workspace_name)
workspace = FabricWorkspace(
workspace_id="your-workspace-id", # Alternative: workspace_name="your-workspace-name"
environment="DEV",
repository_directory="/path/to/workspace/items",
item_type_in_scope=["Notebook", "DataPipeline", "Environment"],
token_credential=token_credential
)
# Deploy items
publish_all_items(workspace)
# Clean up orphaned items
unpublish_all_orphan_items(workspace)Config-Based Deployment
Alternative: deploy_with_config() centralizes deployment settings in YAML.
from azure.identity import AzureCliCredential
from fabric_cicd import deploy_with_config
token_credential = AzureCliCredential()
result = deploy_with_config(
config_file_path="config.yml",
environment="dev",
token_credential=token_credential
)Implementation files:
- Entry points:
deploy_with_config(),publish_all_items(),unpublish_all_orphan_items()insrc/fabric_cicd/publish.py - Config utilities:
src/fabric_cicd/_common/_config_utils.py(loading, extraction) - Config validation:
src/fabric_cicd/_common/_config_validator.py - Documentation:
docs/how_to/config_deployment.md - Tests:
tests/test_deploy_with_config.py,tests/test_config_validator.py
Public API Exports
Only import from the top-level package (src/fabric_cicd/__init__.py). Do not import internal modules directly.
Exported symbols:
FabricWorkspace- Main workspace management classpublish_all_items- Deploy all items in scopeunpublish_all_orphan_items- Remove orphaned itemsdeploy_with_config- Config-based deploymentDeploymentResult,DeploymentStatus- Deployment result typesItemType- Enum of supported Fabric item typesFeatureFlag- Enum of feature flagsappend_feature_flag- Add feature flags programmaticallychange_log_level,configure_external_file_logging,disable_file_logging- Logging utilities
Project Structure
/
├── .github/workflows/ # CI/CD pipelines (test.yml, validate.yml, bump.yml)
├── docs/ # Documentation source files
├── docs/example/ # CI/CD scenario patterns (Azure DevOps, GitHub Actions, local development)
├── sample/ # Example workspace structure and items
├── src/fabric_cicd/ # Main library source code
├── tests/ # Test files
├── pyproject.toml # Project configuration and dependencies
├── ruff.toml # Code formatting and linting configuration
├── mkdocs.yml # Documentation configuration
├── activate.ps1 # PowerShell setup script (Windows only)
└── uv.lock # Dependency lock fileDevelopment Guidelines
Core Concepts
- Publisher Classes: Handle deployment logic for each Fabric item type in
src/fabric_cicd/_items/ - Serial Publishing: Items deploy in dependency order via
SERIAL_ITEM_PUBLISH_ORDER - Parameterization: YAML-based environment-specific value replacement
Supported Item Types
Valid values for item_type_in_scope are defined in the ItemType enum in src/fabric_cicd/constants.py. Always reference that file for the current list — do not hard-code item type strings without verifying them against the enum.
The publish/unpublish dependency order is defined in SERIAL_ITEM_PUBLISH_ORDER in the same file.
Common Development Patterns
- Adding constants: Add to
ItemTypeenum +SERIAL_ITEM_PUBLISH_ORDERinsrc/fabric_cicd/constants.py - Adding publisher: Extend
ItemPublisher+ register in_base_publisher.pyfactory - Adding public exports: Update
__all__insrc/fabric_cicd/__init__.py
Testing Guidelines
Always add/update tests for:
- New functionality or features
- Bug fixes that change behavior
- Core logic changes in any module
- Publisher classes and deployment logic
- Configuration and validation logic
- API integrations and external calls
Testing approach: Mock all external dependencies, use requests_mock for Azure APIs, tmpdir for file operations. Focus on testing business logic, error handling, and integration points.
Test file naming: Follow the conventions in the tests/ directory. Review existing test files to match the naming pattern before creating new ones.
Files to Avoid Modifying
coverage_report/,site/,htmlcov/- Auto-generateduv.lock- Managed by uv.github/workflows/- Affects CI validation
Dependencies & Testing
Runtime: azure-identity, dpath, pyyaml, requests
Development: uv, ruff, pytest, mkdocs-material
Test Types: Unit (tests/test_*.py), Integration (mocked APIs), Parameter/File Handling, Workspace management
GitHub Actions: test.yml (PR tests), validate.yml (formatting/linting), bump.yml (version bumps - vX.X.X format)
Microsoft Fabric APIs: https://learn.microsoft.com/en-us/rest/api/fabric/
Pull Request Requirements
Base branch: Always target main unless otherwise specified.
Title format: "Fixes #123 - Short Description" where #123 is the issue number
- Use "Fixes" for bug fixes, "Closes" for features, "Resolves" for other changes
- Example: "Fixes #520 - Add Python version requirements to documentation"
- Exception: Version bump PRs use "vX.X.X" format only
Requirements:
- PR description should be copilot generated summary
- Pass ruff formatting and linting checks
- Pass all tests
- All PRs must be linked to valid GitHub issue
Do Not
- Do not modify
uv.lockmanually — it is managed byuv - Do not import from internal modules (e.g.,
fabric_cicd._items) — only use the public API fromfabric_cicd - Do not add
print()statements — use the standardloggingmodule - Do not create PRs without a linked GitHub issue
- Do not modify
.github/workflows/files unless explicitly required
Agent Troubleshooting
Common Failures:
- Import errors: Use
uv run pythonprefix to ensure virtual environment - Test pollution: Azure credentials interfering - ensure proper mocking
- Setup failures: Run
uv sync --devif modules missing - Formatting issues: Run
uv run ruff formatto auto-fix most issues - CI failures: Missing format/lint step in validation workflow
Authentication Strategy for Agents:
- For testing/imports: No auth needed
- For publish operations: Use
AzureCliCredential()(IfCredentialUnavailableErroroccurs, user needs to runaz loginfirst) - Context: Import check works without auth, but publish operations require credentials
Key Files to Monitor
Core System Files:
src/fabric_cicd/constants.py- Version and configuration constantssrc/fabric_cicd/fabric_workspace.py- Main workspace management classsrc/fabric_cicd/publish.py- Main deployment entry pointssrc/fabric_cicd/_items/- Publisher classes for all item typessrc/fabric_cicd/_common/- Config utilities, validation, and exceptions
Configuration Files:
pyproject.toml- Project dependencies and configurationsample/workspace/parameter.yml- Environment-specific parameter template
Project Structure:
sample/workspace/- Example Microsoft Fabric item structures
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

