Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed
- `STYLE_STRING_FORMAT_REGEX`, which is no longer used to find `{` style fields. [#75](https://github.com/nhairs/python-json-logger/pull/75)

### Changed
- Replaced MyPy with Pyrefly for type checking

### Fixed
- `%` style formats no longer treat the escaped literal `%%` as the start of a field, so `"%%(notafield)s"` is correctly read as literal text. [#75](https://github.com/nhairs/python-json-logger/pull/75)
- `{` style formats now use `string.Formatter` (as `logging.StrFormatStyle.validate` does) to find fields, so escaped literal braces (`{{`/`}}`) are skipped and a conversion (`{message!r}`) or format spec (`{levelname:>8}`) is no longer treated as part of the field name. [#75](https://github.com/nhairs/python-json-logger/pull/75)
Expand Down
4 changes: 2 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ black src tests

# Lint
pylint --output-format=colorized src
mypy src tests
pyrefly check src tests

# Tests
pytest
```

The above commands (`black`, `pylint`, `mypy`, `pytest`) should all be run before submitting a pull request.
The above commands (`black`, `pylint`, `pyrefly `, `pytest`) should all be run before submitting a pull request.

If making changes to the documentation you can preview the changes locally using `mkdocs`. Changes to the `README.md` can be previewed using a tool like [`grip`](https://github.com/joeyespo/grip) (installable via `pip install grip`).

Expand Down
4 changes: 2 additions & 2 deletions docs/style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ We use automated tools to enforce a consistent code style and catch potential er

* **Black:** For opinionated code formatting.
* **Pylint:** For static code analysis and error detection.
* **MyPy:** For static type checking.
* **Pyrefly:** For static type checking.

Ensure these tools are run before committing code. Configuration for these tools can be found in `pyproject.toml`, `pylintrc`, and `mypy.ini` respectively. This guide primarily focuses on conventions not automatically verifiable by these tools.
Ensure these tools are run before committing code. Configuration for these tools can be found in `pyproject.toml`, `pylintrc`, and `pyrefly.toml` respectively. This guide primarily focuses on conventions not automatically verifiable by these tools.

## Imports

Expand Down
1 change: 0 additions & 1 deletion mypy.ini

This file was deleted.

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ dev = [
"validate-pyproject[all]",
"black",
"pylint",
"mypy<2; implementation_name == 'pypy' and python_version < '3.11'",
"mypy; implementation_name != 'pypy' or python_version >= '3.11'",
"pyrefly",
## Test
"pytest",
"freezegun",
Expand Down
1 change: 1 addition & 0 deletions pyrefly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
preset = "default"
4 changes: 2 additions & 2 deletions tests/test_formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
### ============================================================================
ALL_FORMATTERS: list[type[BaseJsonFormatter]] = [JsonFormatter]
if pythonjsonlogger.ORJSON_AVAILABLE:
ALL_FORMATTERS.append(OrjsonFormatter)
ALL_FORMATTERS.append(OrjsonFormatter) # type: ignore[unbound-name]
if pythonjsonlogger.MSGSPEC_AVAILABLE:
ALL_FORMATTERS.append(MsgspecFormatter)
ALL_FORMATTERS.append(MsgspecFormatter) # type: ignore[unbound-name]

_LOGGER_COUNT = 0

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ commands =
validate-pyproject pyproject.toml
black --check --diff src tests
pylint src
mypy src tests
pyrefly check src tests
Loading