Closed
Description
In paired py,ipynb configuration, a marked raw cell with an "active": "py" metadata or with an active-py tag does not exclude the cell from notebook.
steps to reproduce:
- save test.py
- open test.py as notebook
- cells with active/tags set to py as shown in jupyter despite its marking
- active="ipynb" works as intended (saving the notebook causes commenting)
file to reproduce:
test.py:
# %% active="py"
print('should only be displayed in py file')
# %% tags=["active-py"]
print('should only be displayed in py file')
# %% active="ipynb"
# print('only in jupyter')
ipynb file:
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"active": "py"
},
"outputs": [],
"source": [
"print('should only be displayed in py file')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"active-py"
]
},
"outputs": [],
"source": [
"print('should only be displayed in py file')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"active": "ipynb"
},
"outputs": [],
"source": [
"print('only in jupyter')"
]
}
],
"metadata": {
"jupytext": {
"cell_metadata_filter": "tags,active,-all",
"notebook_metadata_filter": "-all",
"text_representation": {
"extension": ".py",
"format_name": "percent"
}
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Metadata
Assignees
Labels
No labels
Activity