fix: exclude notebook-settings.json from Notebook publish payload (#869)#883
Conversation
When a .py Notebook item contains a notebook-settings.json file, the Fabric API's py-to-ipynb converter fails with 'The file suffix type .json is not supported'. Root cause: NotebookPublisher.publish_one() was not passing an exclude_path to _publish_item(), so notebook-settings.json (a local git-side metadata file) was included in the API payload alongside the notebook content files. Fix: - Add ItemType.NOTEBOOK entry to EXCLUDE_PATH_REGEX_MAPPING in constants.py, excluding notebook-settings.json - Pass exclude_path=EXCLUDE_PATH_REGEX_MAPPING.get(self.item_type) in NotebookPublisher.publish_one() - Update existing tests and add a new regression test Fixes microsoft#869
|
@dreamcreated please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
@dreamcreated Thanks for creating a PR to resolve this bug! Please add a changelog entry using |
|
@dreamcreated Kind reminder to resolve the changelog failure so we can get this one merged. Thanks |
|
I found the root cause for the error, check my post on the other issue: #869 (comment) |
Summary
Fixes #869
When a
.pyNotebook item contains anotebook-settings.jsonfile, the Fabric API py-to-ipynb converter fails with:Root Cause
NotebookPublisher.publish_one()was not passing anexclude_pathto_publish_item(), sonotebook-settings.json(a local git-side metadata file) was included in the API payload alongside the notebook content files. The Fabric API converter then choked on the.jsonfile extension.This is consistent with how other item types handle their metadata files (e.g.
DataAgent,Report,SemanticModel,Eventhouseall useEXCLUDE_PATH_REGEX_MAPPING).Changes
src/fabric_cicd/constants.py: AddedItemType.NOTEBOOKentry toEXCLUDE_PATH_REGEX_MAPPINGwith patternnotebook-settings\.jsonsrc/fabric_cicd/_items/_notebook.py: Passexclude_path=EXCLUDE_PATH_REGEX_MAPPING.get(self.item_type)when calling_publish_item()tests/test_publish.py: Updated existing tests to includeexclude_pathin expected call args; added new regression testtest_notebook_settings_json_excluded_from_publishTesting
All 25 tests in
tests/test_publish.pypass, including 5TestNotebookPublishertests.