Skip to content

Commit

Permalink
Release v0.8.0 (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
makukha authored Jan 18, 2025
1 parent 38a18ec commit 4abb1cd
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 22 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ All notable changes to this project will be documented in this file. Changes for

<!-- towncrier release notes start -->

## [v0.8.0](https://github.com/makukha/docsub/releases/tag/v0.8.0) — 2025-01-18

***Breaking 🔥***

- Changed default config file name to `docsub.toml` ([#58](https://github.com/makukha/docsub/issues/58))
- Renamed `ExecConfig.workdir` and `IncludeConfig.basedir` to `work_dir` and `base_dir` ([#58](https://github.com/makukha/docsub/issues/58))
- Switch back to `click` ([#58](https://github.com/makukha/docsub/issues/58))

***Added 🌿***

- Provide temporary directory to author of project-local commands ([#58](https://github.com/makukha/docsub/issues/58))
- Developers of project-local commands can use `Environment` object to get temporary directory etc. ([#58](https://github.com/makukha/docsub/issues/58))
- Command line options to override config values and config file location ([#58](https://github.com/makukha/docsub/issues/58))
- Project-local commands can be executed directly with `docsub x cmd-name [args]` ([#58](https://github.com/makukha/docsub/issues/58))

***Misc:***

- Major internal refactoring ([#60](https://github.com/makukha/docsub/issues/60))


## [v0.7.1](https://github.com/makukha/docsub/releases/tag/v0.7.1) — 2025-01-14

### Fixed
Expand Down
1 change: 0 additions & 1 deletion NEWS.d/58.added.md

This file was deleted.

1 change: 0 additions & 1 deletion NEWS.d/58.breaking.1.md

This file was deleted.

1 change: 0 additions & 1 deletion NEWS.d/58.breaking.2.md

This file was deleted.

1 change: 0 additions & 1 deletion NEWS.d/58.breaking.md

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
[![license](https://img.shields.io/github/license/makukha/docsub.svg)](https://github.com/makukha/docsub/blob/main/LICENSE)
[![versions](https://img.shields.io/pypi/pyversions/docsub.svg)](https://pypi.org/project/docsub)
[![pypi](https://img.shields.io/pypi/v/docsub.svg#v0.7.1)](https://pypi.python.org/pypi/docsub)
[![pypi](https://img.shields.io/pypi/v/docsub.svg#v0.8.0)](https://pypi.python.org/pypi/docsub)
[![uses docsub](https://img.shields.io/badge/uses-docsub-royalblue)
](https://github.com/makukha/docsub)

> [!WARNING]
> * With `docsub`, every documentation file may become executable.
> * Never use `docsub` to process files from untrusted sources.
> * This project is in experimental state, syntax and functionality may change significantly.
> * If still want to try it, use pinned package version `docsub==0.7.1`
> * If still want to try it, use pinned package version `docsub==0.8.0`

# Features
Expand Down Expand Up @@ -189,7 +189,7 @@ Recommended. The most flexible installation option, allowing [project-local comm
# pyproject.toml
[dependency-groups]
dev = [
"docsub==0.7.1",
"docsub==0.8.0",
]
```

Expand All @@ -198,7 +198,7 @@ dev = [
Works for simple cases.

```shell
uv tool install docsub==0.7.1
uv tool install docsub==0.8.0
```


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dev = [
# bump-my-version

[tool.bumpversion]
current_version = "0.7.1"
current_version = "0.8.0"
allow_dirty = true
files = [
{filename = "README.md"},
Expand Down
2 changes: 1 addition & 1 deletion src/docsub/__base__.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(
*,
loc: Location,
conf: C | None = None,
env = None, # type: Environment | None
env=None, # type: Environment | None
) -> None:
conf_class = self.__annotations__['conf']
if conf is not None:
Expand Down
2 changes: 1 addition & 1 deletion src/docsub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from .environment import Environment, pass_env

__version__ = '0.7.1'
__version__ = '0.8.0'

__all__ = [
'Environment',
Expand Down
11 changes: 5 additions & 6 deletions src/docsub/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
@click.group()
@click.option('-c', '--config-file', type=Path)
@click.option('-l', '--local-dir', type=Path)
@click.option( '--cmd-exec-work-dir', type=Path)
@click.option( '--cmd-exec-env-vars', type=str)
@click.option( '--cmd-help-env-vars', type=str)
@click.option( '--cmd-include-base-dir', type=Path)
@click.option( '-x', '--cmd-x-docsubfile', type=Path)
@click.option('--cmd-exec-work-dir', type=Path)
@click.option('--cmd-exec-env-vars', type=str)
@click.option('--cmd-help-env-vars', type=str)
@click.option('--cmd-include-base-dir', type=Path)
@click.option('-x', '--cmd-x-docsubfile', type=Path)
@click.version_option(__version__, prog_name='docsub')
@click.pass_context
def cli(
Expand All @@ -30,7 +30,6 @@ def cli(
cmd_help_env_vars: str | None = None,
cmd_include_base_dir: Path | None = None,
cmd_x_docsubfile: Path | None = None,

):
def maybe_json_loads(value: str | None) -> dict | None:
if value is not None:
Expand Down
1 change: 1 addition & 0 deletions src/docsub/commands/x.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from typing import TYPE_CHECKING, override

from ..__base__ import Config, DocsubfileError, Line, Location, Producer, Substitution

if TYPE_CHECKING:
from ..environment import Environment # noqa: F401

Expand Down
3 changes: 1 addition & 2 deletions src/docsub/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ def settings_customise_sources(


def load_config(config_file: Path | None, **kwargs) -> DocsubSettings:
"""Load config from file.
"""
"""Load config from file."""
if config_file:
DocsubSettings.model_config['toml_file'] = [config_file]
conf = DocsubSettings(**kwargs) # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion src/docsub/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _update_options(self, options: dict[str, Any] | None) -> None:
raise ValueError(f'Invalid option "{opt}"')
if not isinstance(getattr(item, a), BaseModel) and i < len(attrs) - 1:
raise TypeError(
f'Nested attributes not allowed for {'.'.join(attrs[:i])}'
f'Nested attributes not allowed for {".".join(attrs[:i])}'
)
if i == len(attrs) - 1: # last attribute
setattr(item, a, options[opt])
Expand Down
3 changes: 2 additions & 1 deletion tests/test_readme_docsubfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def test_readme_docsubfile_x(data_path, python, monkeypatch):
monkeypatch.chdir(data_path)
src = (data_path / '__input__.md').read_text()
match = re.search(r'^<!-- docsub: x (?P<cmd>.+) -->$', src, flags=re.MULTILINE)
result = CliRunner(mix_stderr=False).invoke(cli, ['x', *shlex.split(match.group('cmd'))])
args = shlex.split(match.group('cmd'))
result = CliRunner(mix_stderr=False).invoke(cli, ['x', *args])
assert not result.stderr
assert result.exit_code == 0
expected = strip_docsub((data_path / '__result__.txt').read_text())
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4abb1cd

Please sign in to comment.