Switch changelog to markdown (#1067)

* Switch changelog to markdown

* Add changelog except back to long description

* Fix MANIFEST.in

* Re-add towncrier draft entries

* Write the title outselves

* Add warning box

* Make changelog format more KeepAChangelog-ish

* Link latest changes to main tree

* Move link into warning

* KAC has no empty lines between entries

* There's no more .rst in the root dir
This commit is contained in:
Hynek Schlawack 2022-12-07 09:15:46 +01:00 committed by GitHub
parent 14008b4f35
commit afe211143d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 1110 additions and 1166 deletions

View File

@ -176,15 +176,15 @@ But it's way more comfortable to run it locally and *git* catching avoidable err
If your change is noteworthy, there needs to be a changelog entry so our users can learn about it!
To avoid merge conflicts, we use the [*Towncrier*](https://pypi.org/project/towncrier) package to manage our changelog.
*towncrier* uses independent files for each pull request so called *news fragments* instead of one monolithic changelog file.
On release, those news fragments are compiled into our [`CHANGELOG.rst`](https://github.com/python-attrs/attrs/blob/main/CHANGELOG.rst).
*towncrier* uses independent *Markdown* files for each pull request so called *news fragments* instead of one monolithic changelog file.
On release, those news fragments are compiled into our [`CHANGELOG.md`](https://github.com/python-attrs/attrs/blob/main/CHANGELOG.md).
You don't need to install *towncrier* yourself, you just have to abide by a few simple rules:
You don't need to install *Towncrier* yourself, you just have to abide by a few simple rules:
- For each pull request, add a new file into `changelog.d` with a filename adhering to the `pr#.(change|deprecation|breaking).rst` schema:
For example, `changelog.d/42.change.rst` for a non-breaking change that is proposed in pull request #42.
- For each pull request, add a new file into `changelog.d` with a filename adhering to the `pr#.(change|deprecation|breaking).md` schema:
For example, `changelog.d/42.change.md` for a non-breaking change that is proposed in pull request #42.
- As with other docs, please use [semantic newlines] within news fragments.
- Wrap symbols like modules, functions, or classes into double backticks so they are rendered in a `monospace font`.
- Wrap symbols like modules, functions, or classes into backticks so they are rendered in a `monospace font`.
- Wrap arguments into asterisks like in docstrings:
`Added new argument *an_argument*.`
- If you mention functions or other callables, add parentheses at the end of their names:
@ -196,19 +196,19 @@ You don't need to install *towncrier* yourself, you just have to abide by a few
+ Added `attrs.validators.func()`.
+ `attrs.func()` now doesn't crash the Large Hadron Collider anymore when passed the *foobar* argument.
- If you want to reference multiple issues, copy the news fragment to another filename.
*towncrier* will merge all news fragments with identical contents into one entry with multiple links to the respective pull requests.
*Towncrier* will merge all news fragments with identical contents into one entry with multiple links to the respective pull requests.
Example entries:
```rst
Added ``attrs.validators.func()``.
```md
Added `attrs.validators.func()`.
The feature really *is* awesome.
```
or:
```rst
``attrs.func()`` now doesn't crash the Large Hadron Collider anymore when passed the *foobar* argument.
```md
`attrs.func()` now doesn't crash the Large Hadron Collider anymore when passed the *foobar* argument.
The bug really *was* nasty.
```

1021
CHANGELOG.md Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
include LICENSE *.rst *.toml *.yml *.yaml *.ini CITATION.cff
include LICENSE *.md *.toml *.yml *.yaml *.ini CITATION.cff
graft .github
# Stubs
@ -16,9 +16,10 @@ recursive-include docs *.png
recursive-include docs *.svg
recursive-include docs *.py
recursive-include docs *.rst
recursive-include docs *.md
prune docs/_build
# Just to keep check-manifest happy; on releases those files are gone.
# Last rule wins!
exclude changelog.d/*.rst
include changelog.d/towncrier_template.rst
exclude changelog.d/*.md
include changelog.d/towncrier_template.md.jinja

View File

@ -0,0 +1,2 @@
On Python 3.10 and later, call [`abc.update_abstractmethods()`](https://docs.python.org/3/library/abc.html#abc.update_abstractmethods) on dict classes after creation.
This improves the detection of abstractness.

View File

@ -1,2 +0,0 @@
On Python 3.10 and later, call `abc.update_abstractmethods() <https://docs.python.org/3/library/abc.html#abc.update_abstractmethods>`_ on dict classes after creation.
This improves the detection of abstractness.

View File

@ -1,2 +1,2 @@
``attrs``'s pickling methods now use dicts instead of tuples.
*attrs*'s pickling methods now use dicts instead of tuples.
That is safer and more robust across different versions of a class.

View File

@ -0,0 +1 @@
Added `attrs.validators.not_(wrapped_validator)` to logically invert *wrapped_validator* by accepting only values where *wrapped_validator* rejects the value with a `ValueError` or `TypeError` (by default, exception types configurable).

View File

@ -1 +0,0 @@
Added ``attrs.validators.not_(wrapped_validator)`` to logically invert *wrapped_validator* by accepting only values where *wrapped_validator* rejects the value with a ``ValueError`` or ``TypeError`` (by default, exception types configurable).

View File

@ -0,0 +1 @@
The type stubs for `attrs.cmp_using()` now have default values.

View File

@ -1 +0,0 @@
The type stubs for ``attrs.cmp_using()`` now have default values.

View File

@ -0,0 +1 @@
To conform with [PEP 681](https://peps.python.org/pep-0681/), `attr.s()` and `attrs.define()` now accept *unsafe_hash* in addition to *hash*.

View File

@ -1 +0,0 @@
To conform with `PEP 681 <https://peps.python.org/pep-0681/>`_, ``attr.s()` and ``attrs.define()`` now accept *unsafe_hash* in addition to *hash*.

View File

@ -0,0 +1,4 @@
`attrs.field()` now supports an *alias* option for explicit `__init__` argument names.
Get `__init__` signatures matching any taste, peculiar or plain!
The [PEP 681 compatible](https://peps.python.org/pep-0681/#field-specifier-parameters) *alias* option can be use to override private attribute name mangling, or add other arbitrary field argument name overrides.

View File

@ -1,5 +0,0 @@
``attrs.field`` now supports an ``alias`` option for explicit ``__init__`` argument names.
Get ``__init__`` signatures matching any taste, peculiar or plain!
The `PEP 681 compatible <https://peps.python.org/pep-0681/#field-specifier-parameters>`_ ``alias`` option can be use to override private attribute name mangling,
or add other arbitrary field argument name overrides.

View File

@ -0,0 +1 @@
`attrs.NOTHING` is now an enum value, making it possible to use with e.g. [`typing.Literal`](https://docs.python.org/3/library/typing.html#typing.Literal).

View File

@ -1 +0,0 @@
``attrs.NOTHING`` is now an enum value, making it possible to use with f.e. ``typing.Literal``.

View File

@ -0,0 +1 @@
Added missing re-import of `attr.AttrsInstance` to the `attrs` namespace.

View File

@ -1 +0,0 @@
Added missing re-import of ``attr.AttrsInstance`` to the ``attrs`` namespace.

View File

@ -0,0 +1 @@
Fix slight performance regression in classes with custom `__setattr__` and speedup even more.

View File

@ -1 +0,0 @@
Fix slight performance regression in classes with custom ``__setattr__`` and speedup even more.

View File

@ -0,0 +1,2 @@
`attrs.has()` is now a [`TypeGuard`](https://docs.python.org/3/library/typing.html#typing.TypeGuard) for `AttrsInstance`.
That means that type checkers know a class is an instance of an `attrs` class if you check it using `attrs.has()` (or `attr.has()`) first.

View File

@ -1,2 +0,0 @@
``attrs.has()`` is now a ``TypeGuard`` for ``AttrsInstance``.
That means that type checkers know a class is an instance of an ``attrs`` class if you check it using ``attrs.has()`` (or ``attr.has()``) first.

View File

@ -0,0 +1 @@
Made `attrs.AttrsInstance` stub available at runtime and fixed type errors related to the usage of `attrs.AttrsInstance` in *Pyright*.

View File

@ -1 +0,0 @@
Made ``attrs.AttrsInstance`` stub available at runtime and fixed type errors related to the usage of ``attrs.AttrsInstance`` in Pyright.

View File

@ -0,0 +1,28 @@
{%- if versiondata["version"] == "main" -%}
## Changes for the Upcoming Release
:::{warning}
These changes reflect the current [development progress](https://github.com/python-attrs/attrs/tree/main) and have **not** been part of a PyPI release yet.
:::
{% else -%}
## [{{ versiondata["version"] }}](https://github.com/python-attrs/attrs/tree/{{ versiondata["version"] }}) - {{ versiondata["date"] }}
{%- endif %}
{% for section, _ in sections.items() %}
{% if sections[section] %}
{% for category, val in definitions.items() if category in sections[section] %}
### {{ definitions[category]['name'] }}
{% for text, values in sections[section][category].items() %}
- {{ text }}
{{ values|join(',\n ') }}
{% endfor %}
{% endfor %}
{% else %}
No significant changes.
{% endif %}
{% endfor %}

View File

@ -1,36 +0,0 @@
{% for section, _ in sections.items() %}
{% set underline = underlines[0] %}{% if section %}{{section}}
{{ underline * section|length }}{% set underline = underlines[1] %}
{% endif %}
{% if sections[section] %}
{% for category, val in definitions.items() if category in sections[section]%}
{{ definitions[category]['name'] }}
{{ underline * definitions[category]['name']|length }}
{% if definitions[category]['showcontent'] %}
{% for text, values in sections[section][category].items() %}
- {{ text }}
{{ values|join(',\n ') }}
{% endfor %}
{% else %}
- {{ sections[section][category]['']|join(', ') }}
{% endif %}
{% if sections[section][category]|length == 0 %}
No significant changes.
{% else %}
{% endif %}
{% endfor %}
{% else %}
No significant changes.
{% endif %}
{% endfor %}
----

11
docs/changelog.md Normal file
View File

@ -0,0 +1,11 @@
```{include} ../CHANGELOG.md
:end-before: Changes for the upcoming release can be found
```
```{towncrier-draft-entries}
main
```
```{include} ../CHANGELOG.md
:start-after: towncrier release notes start -->
```

View File

@ -1,7 +0,0 @@
.. include:: ../CHANGELOG.rst
:end-before: Changes for the upcoming release can be found
.. towncrier-draft-entries:: Unreleased
.. include:: ../CHANGELOG.rst
:start-after: .. towncrier release notes start

View File

@ -1,18 +1,12 @@
```{eval-rst}
.. module:: attr
.. module:: attrs
```
# *attrs*: Classes Without Boilerplate
Release **{sub-ref}`release`** ([What's new?](changelog))
Release **{sub-ref}`release`** ([What's new?](changelog.md))
```{eval-rst}
.. include:: ../README.md
:parser: myst_parser.sphinx_
:start-after: teaser-begin -->
:end-before: <!-- teaser-end
```
## Getting Started

View File

@ -50,12 +50,12 @@ toplevel = ["attr", "attrs"]
[tool.towncrier]
name = "attrs"
filename = "CHANGELOG.rst"
template = "changelog.d/towncrier_template.rst"
issue_format = "`#{issue} <https://github.com/python-attrs/attrs/issues/{issue}>`_"
directory = "changelog.d"
title_format = "{version} ({project_date})"
underlines = ["-", "^"]
filename = "CHANGELOG.md"
template = "changelog.d/towncrier_template.md.jinja"
title_format = ""
issue_format = "[#{issue}](https://github.com/python-attrs/attrs/issues/{issue})"
underlines = ["", "", ""]
[[tool.towncrier.section]]
path = ""

View File

@ -114,7 +114,18 @@ def find_meta(meta):
VERSION = find_meta("version")
URL = find_meta("url")
LONG = read("README.md")
LONG = (
read("README.md")
+ "\n\n## Changes in This Release\n"
+ read("CHANGELOG.md")
.split("towncrier release notes start -->", 1)[1]
.strip()
.split("\n## ", 1)[0]
.strip()
.split("\n", 1)[1]
+ "\n\n---\n\n[Full changelog]"
"(https://www.attrs.org/en/stable/changelog.html)\n"
)
if __name__ == "__main__":
setup(

View File

@ -93,7 +93,7 @@ commands =
basepython = python3.8
deps = towncrier
skip_install = true
commands = towncrier build --version UNRELEASED --draft
commands = towncrier build --version main --draft
[testenv:mypy]