Skip to content

Commit

Permalink
0.15 (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
spacemanspiff2007 authored Dec 10, 2024
1 parent 03eb760 commit a491775
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
rev: v0.7.4
hooks:
- id: ruff
name: ruff unused imports
Expand Down
3 changes: 3 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ ignore = [

# https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
"RUF005", # Consider {expression} instead of concatenation

# https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
"PT007", # Wrong values type in @pytest.mark.parametrize expected {values} of {row}
]


Expand Down
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ This code will be executed
```

# Changelog
#### 0.15 (2024-12-10)
- Removed confusing log output

#### 0.14 (2024-11-15)
- Add support for all options from code block
- Reworked how blocks and options are processed
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ sphinx == 7.1.2; python_version == '3.8'

# Current dependencies
pre-commit == 4.0.1; python_version >= '3.9'
pytest == 8.3.3; python_version >= '3.10'
pytest == 8.3.4; python_version >= '3.10'
sphinx == 8.1.3; python_version >= '3.10'

ruff == 0.6.9
ruff == 0.8.2

sphinx-rtd-theme == 3.0.1
sphinx-rtd-theme == 3.0.2
2 changes: 1 addition & 1 deletion src/sphinx_exec_code/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.14'
__version__ = '0.15'
21 changes: 11 additions & 10 deletions src/sphinx_exec_code/sphinx_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SphinxSpecBase:
defaults: ClassVar[Dict[str, str]]

@staticmethod
def alias_to_name(alias: str) -> str:
def alias_to_name(alias: str, *, do_log: bool = True) -> str:
raise NotImplementedError()

@staticmethod
Expand All @@ -37,7 +37,7 @@ def set_block_spec(self, block: literal_block) -> None:
def from_options(cls, options: Dict[str, Any]) -> 'SphinxSpecBase':
spec_names = tuple(cls.create_spec().keys())

spec = {cls.alias_to_name(n): v for n, v in cls.defaults.items()}
spec = {cls.alias_to_name(n, do_log=False): v for n, v in cls.defaults.items()}
for name in spec_names:
if name not in options:
continue
Expand Down Expand Up @@ -98,9 +98,10 @@ class SpecCode(SphinxSpecBase):
}

@staticmethod
def alias_to_name(alias: str) -> str:
def alias_to_name(alias: str, *, do_log: bool = True) -> str:
if alias == 'hide_code':
log.info('The "hide_code" directive is deprecated! Use "hide" instead!')
if do_log:
log.warning('The "hide_code" directive is deprecated! Use "hide" instead!')
return 'hide'
return alias

Expand All @@ -118,8 +119,13 @@ def __init__(self, **kwargs: Dict[str, Any]) -> None:


class SpecOutput(SphinxSpecBase):
defaults: ClassVar = {
'hide': False,
'language': 'none',
}

@staticmethod
def alias_to_name(alias: str) -> str:
def alias_to_name(alias: str, *, do_log: bool = True) -> str: # noqa: ARG004
if alias.endswith('_output'):
return alias[:-7]
return alias
Expand All @@ -143,8 +149,3 @@ def post_process_spec(spec: Dict[str, Any], options: Dict[str, Any]) -> None:

# if we have a name for input we create a name for output
spec['name'] = f'{options[name_code]:s}_output'

defaults: ClassVar = {
'hide': False,
'language': 'none',
}

0 comments on commit a491775

Please sign in to comment.