Skip to content

Commit b12c230

Browse files
authored
Merge branch 'main' into attrib_alias
2 parents 40a5161 + 6151683 commit b12c230

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+424
-522
lines changed

.github/CONTRIBUTING.md

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,67 @@ The official tag is `python-attrs` and helping out in support frees us up to imp
3434
If you have problems to test something, open anyway and ask for advice.
3535
In some situations, we may agree to add an `# pragma: no cover`.
3636
- Once you've addressed review feedback, make sure to bump the pull request with a short note, so we know you're done.
37-
- Don’t break backwards compatibility.
37+
- Don’t break backwards-compatibility.
38+
39+
40+
## Local Development Environment
41+
42+
You can (and should) run our test suite using [*tox*].
43+
However, you’ll probably want a more traditional environment as well.
44+
We highly recommend to develop using the latest Python release because we try to take advantage of modern features whenever possible.
45+
46+
First create a [virtual environment](https://virtualenv.pypa.io/) so you don't break your system-wide Python installation.
47+
It’s out of scope for this document to list all the ways to manage virtual environments in Python, but if you don’t already have a pet way, take some time to look at tools like [*direnv*](https://hynek.me/til/python-project-local-venvs/), [*virtualfish*](https://virtualfish.readthedocs.io/), and [*virtualenvwrapper*](https://virtualenvwrapper.readthedocs.io/).
48+
49+
Next, get an up-to-date checkout of the `attrs` repository:
50+
51+
```console
52+
$ git clone [email protected]:python-attrs/attrs.git
53+
```
54+
55+
or if you prefer to use git via `https`:
56+
57+
```console
58+
$ git clone https://github.com/python-attrs/attrs.git
59+
```
60+
61+
Change into the newly created directory and **after activating your virtual environment** install an editable version of `attrs` along with its tests and docs requirements:
62+
63+
```console
64+
$ cd attrs
65+
$ python -m pip install --upgrade pip setuptools # PLEASE don't skip this step
66+
$ python -m pip install -e '.[dev]'
67+
```
68+
69+
At this point,
70+
71+
```console
72+
$ python -m pytest
73+
```
74+
75+
should work and pass, as should:
76+
77+
```console
78+
$ cd docs
79+
$ make html
80+
```
81+
82+
The built documentation can then be found in `docs/_build/html/`.
83+
84+
To avoid committing code that violates our style guide, we strongly advise you to install [*pre-commit*] [^dev] hooks:
85+
86+
```console
87+
$ pre-commit install
88+
```
89+
90+
You can also run them anytime (as our *tox* does) using:
91+
92+
```console
93+
$ pre-commit run --all-files
94+
```
95+
96+
[^dev]: *pre-commit* should have been installed into your virtualenv automatically when you ran `pip install -e '.[dev]'` above.
97+
If *pre-commit* is missing, your probably need to run `pip install -e '.[dev]'` again.
3898

3999

40100
## Code
@@ -54,7 +114,7 @@ The official tag is `python-attrs` and helping out in support frees us up to imp
54114
```
55115
- If you add or change public APIs, tag the docstring using `.. versionadded:: 16.0.0 WHAT` or `.. versionchanged:: 16.2.0 WHAT`.
56116
- We use [*isort*](https://github.com/PyCQA/isort) to sort our imports, and we use [*Black*](https://github.com/psf/black) with line length of 79 characters to format our code.
57-
As long as you run our full [*tox*] suite before committing, or install our [*pre-commit*] hooks (ideally you'll do both – see [*Local Development Environment*](#local-development-environment) below), you won't have to spend any time on formatting your code at all.
117+
As long as you run our full [*tox*] suite before committing, or install our [*pre-commit*] hooks (ideally you'll do both – see [*Local Development Environment*](#local-development-environment) above), you won't have to spend any time on formatting your code at all.
58118
If you don't, [CI] will catch it for you – but that seems like a waste of your time!
59119

60120

@@ -81,7 +141,7 @@ The official tag is `python-attrs` and helping out in support frees us up to imp
81141

82142
## Documentation
83143

84-
- Use [semantic newlines] in [*reStructuredText*] files (files ending in `.rst`):
144+
- Use [semantic newlines] in [*reStructuredText*] and [*Markdown*](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) files (files ending in `.rst` and `.md`):
85145

86146
```rst
87147
This is a sentence.
@@ -152,66 +212,6 @@ or:
152212
``tox -e changelog`` will render the current changelog to the terminal if you have any doubts.
153213

154214

155-
## Local Development Environment
156-
157-
You can (and should) run our test suite using [*tox*].
158-
However, you’ll probably want a more traditional environment as well.
159-
We highly recommend to develop using the latest Python release because we try to take advantage of modern features whenever possible.
160-
161-
First create a [virtual environment](https://virtualenv.pypa.io/) so you don't break your system-wide Python installation.
162-
It’s out of scope for this document to list all the ways to manage virtual environments in Python, but if you don’t already have a pet way, take some time to look at tools like [*direnv*](https://hynek.me/til/python-project-local-venvs/), [*virtualfish*](https://virtualfish.readthedocs.io/), and [*virtualenvwrapper*](https://virtualenvwrapper.readthedocs.io/).
163-
164-
Next, get an up to date checkout of the `attrs` repository:
165-
166-
```console
167-
$ git clone [email protected]:python-attrs/attrs.git
168-
```
169-
170-
or if you want to use git via `https`:
171-
172-
```console
173-
$ git clone https://github.com/python-attrs/attrs.git
174-
```
175-
176-
Change into the newly created directory and **after activating your virtual environment** install an editable version of `attrs` along with its tests and docs requirements:
177-
178-
```console
179-
$ cd attrs
180-
$ pip install --upgrade pip setuptools # PLEASE don't skip this step
181-
$ pip install -e '.[dev]'
182-
```
183-
184-
At this point,
185-
186-
```console
187-
$ python -m pytest
188-
```
189-
190-
should work and pass, as should:
191-
192-
```console
193-
$ cd docs
194-
$ make html
195-
```
196-
197-
The built documentation can then be found in `docs/_build/html/`.
198-
199-
To avoid committing code that violates our style guide, we strongly advise you to install [*pre-commit*] [^dev] hooks:
200-
201-
```console
202-
$ pre-commit install
203-
```
204-
205-
You can also run them anytime (as our tox does) using:
206-
207-
```console
208-
$ pre-commit run --all-files
209-
```
210-
211-
[^dev]: *pre-commit* should have been installed into your virtualenv automatically when you ran `pip install -e '.[dev]'` above.
212-
If *pre-commit* is missing, your probably need to run `pip install -e '.[dev]'` again.
213-
214-
215215
## Governance
216216

217217
`attrs` is maintained by [team of volunteers](https://github.com/python-attrs) that is always open to new members that share our vision of a fast, lean, and magic-free library that empowers programmers to write better code with less effort.
@@ -225,6 +225,6 @@ If you'd like to join, just get a pull request merged and ask to be added in the
225225
[CI]: https://github.com/python-attrs/attrs/actions?query=workflow%3ACI
226226
[Hynek Schlawack]: https://hynek.me/about/
227227
[*pre-commit*]: https://pre-commit.com/
228-
[*tox*]: https://https://tox.wiki/
228+
[*tox*]: https://tox.wiki/
229229
[semantic newlines]: https://rhodesmill.org/brandon/2012/one-sentence-per-line/
230230
[*reStructuredText*]: https://www.sphinx-doc.org/en/stable/usage/restructuredtext/basics.html

.github/SECURITY.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
We are following [CalVer](https://calver.org) with generous backwards-compatibility guarantees.
6+
Therefore we only support the latest version.
7+
8+
9+
## Reporting a Vulnerability
10+
111
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
212
Tidelift will coordinate the fix and disclosure.

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "pypy-3.7", "pypy-3.8"]
26+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11.0-beta - 3.11", "pypy-3.7", "pypy-3.8"]
2727

2828
steps:
2929
- uses: actions/checkout@v3

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
*.pyc
33
.cache
44
.coverage*
5+
.direnv
6+
.envrc
57
.hypothesis
68
.mypy_cache
79
.pytest_cache
810
.tox
11+
.vscode
912
build
1013
dist
1114
docs/_build/
1215
htmlcov
1316
pip-wheel-metadata
17+
tmp

.pre-commit-config.yaml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22
ci:
33
autoupdate_schedule: monthly
44

5+
default_language_version:
6+
python: python3.10 # needed for match
7+
58
repos:
69
- repo: https://github.com/psf/black
7-
rev: 22.3.0
10+
rev: 22.6.0
811
hooks:
912
- id: black
1013

1114
- repo: https://github.com/asottile/pyupgrade
12-
rev: v2.32.1
15+
rev: v2.37.3
1316
hooks:
1417
- id: pyupgrade
15-
args: [--py3-plus, --keep-percent-format]
18+
args: [--py36-plus, --keep-percent-format]
1619
exclude: "tests/test_slots.py"
1720

1821
- repo: https://github.com/PyCQA/isort
@@ -21,27 +24,28 @@ repos:
2124
- id: isort
2225
additional_dependencies: [toml]
2326
files: \.py$
24-
language_version: python3.10 # needed for match
27+
28+
- repo: https://github.com/asottile/yesqa
29+
rev: v1.3.0
30+
hooks:
31+
- id: yesqa
2532

2633
- repo: https://github.com/PyCQA/flake8
27-
rev: 4.0.1
34+
rev: 5.0.2
2835
hooks:
2936
- id: flake8
30-
language_version: python3.10
3137

3238
- repo: https://github.com/econchick/interrogate
3339
rev: 1.5.0
3440
hooks:
3541
- id: interrogate
3642
args: [tests]
37-
language_version: python3.10 # needed for match
3843

3944
- repo: https://github.com/pre-commit/pre-commit-hooks
40-
rev: v4.2.0
45+
rev: v4.3.0
4146
hooks:
4247
- id: trailing-whitespace
4348
- id: end-of-file-fixer
4449
- id: debug-statements
45-
language_version: python3.10 # needed for match
4650
- id: check-toml
4751
- id: check-yaml

AUTHORS.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Credits
33

44
``attrs`` is written and maintained by `Hynek Schlawack <https://hynek.me/>`_.
55

6-
The development is kindly supported by `Variomedia AG <https://www.variomedia.de/>`_.
6+
The development is kindly supported by `Variomedia AG <https://www.variomedia.de/>`_, ``attrs`` `Tidelift subscribers <https://tidelift.com/subscription/pkg/pypi-attrs?utm_source=pypi-attrs&utm_medium=referral&utm_campaign=enterprise&utm_term=repo>`_, and all my amazing `GitHub Sponsors <https://github.com/sponsors/hynek>`_.
77

88
A full list of contributors can be found in `GitHub's overview <https://github.com/python-attrs/attrs/graphs/contributors>`_.
99

1010
It’s the spiritual successor of `characteristic <https://characteristic.readthedocs.io/>`_ and aspires to fix some of it clunkiness and unfortunate decisions.
11-
Both were inspired by Twisted’s `FancyEqMixin <https://twistedmatrix.com/documents/current/api/twisted.python.util.FancyEqMixin.html>`_ but both are implemented using class decorators because `subclassing is bad for you <https://www.youtube.com/watch?v=3MNVP9-hglc>`_, m’kay?
11+
Both were inspired by Twisted’s `FancyEqMixin <https://docs.twisted.org/en/stable/api/twisted.python.util.FancyEqMixin.html>`_ but both are implemented using class decorators because `subclassing is bad for you <https://www.youtube.com/watch?v=3MNVP9-hglc>`_, m’kay?

CHANGELOG.rst

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,48 @@ Changes for the upcoming release can be found in the `"changelog.d" directory <h
2828

2929
.. towncrier release notes start
3030
31+
22.1.0 (2022-07-28)
32+
-------------------
33+
34+
Backwards-incompatible Changes
35+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36+
37+
- Python 2.7 is not supported anymore.
38+
39+
Dealing with Python 2.7 tooling has become too difficult for a volunteer-run project.
40+
41+
We have supported Python 2 more than 2 years after it was officially discontinued and feel that we have paid our dues.
42+
All version up to 21.4.0 from December 2021 remain fully functional, of course.
43+
`#936 <https://github.com/python-attrs/attrs/issues/936>`_
44+
- The deprecated ``cmp`` attribute of ``attrs.Attribute`` has been removed.
45+
This does not affect the *cmp* argument to ``attr.s`` that can be used as a shortcut to set *eq* and *order* at the same time.
46+
`#939 <https://github.com/python-attrs/attrs/issues/939>`_
47+
48+
49+
Changes
50+
^^^^^^^
51+
52+
- Instantiation of frozen slotted classes is now faster.
53+
`#898 <https://github.com/python-attrs/attrs/issues/898>`_
54+
- If an ``eq`` key is defined, it is also used before hashing the attribute.
55+
`#909 <https://github.com/python-attrs/attrs/issues/909>`_
56+
- Added ``attrs.validators.min_len()``.
57+
`#916 <https://github.com/python-attrs/attrs/issues/916>`_
58+
- ``attrs.validators.deep_iterable()``'s *member_validator* argument now also accepts a list of validators and wraps them in an ``attrs.validators.and_()``.
59+
`#925 <https://github.com/python-attrs/attrs/issues/925>`_
60+
- Added missing type stub re-imports for ``attrs.converters`` and ``attrs.filters``.
61+
`#931 <https://github.com/python-attrs/attrs/issues/931>`_
62+
- Added missing stub for ``attr(s).cmp_using()``.
63+
`#949 <https://github.com/python-attrs/attrs/issues/949>`_
64+
- ``attrs.validators._in()``'s ``ValueError`` is not missing the attribute, expected options, and the value it got anymore.
65+
`#951 <https://github.com/python-attrs/attrs/issues/951>`_
66+
- Python 3.11 is now officially supported.
67+
`#969 <https://github.com/python-attrs/attrs/issues/969>`_
68+
69+
70+
----
71+
72+
3173
21.4.0 (2021-12-29)
3274
-------------------
3375

@@ -940,7 +982,7 @@ Deprecations:
940982
This will remove the confusing error message if you write your own ``__init__`` and forget to initialize some attribute.
941983
Instead you will get a straightforward ``AttributeError``.
942984
In other words: decorated classes will work more like plain Python classes which was always ``attrs``'s goal.
943-
- The serious business aliases ``attr.attributes`` and ``attr.attr`` have been deprecated in favor of ``attr.attrs`` and ``attr.attrib`` which are much more consistent and frankly obvious in hindsight.
985+
- The serious-business aliases ``attr.attributes`` and ``attr.attr`` have been deprecated in favor of ``attr.attrs`` and ``attr.attrib`` which are much more consistent and frankly obvious in hindsight.
944986
They will be purged from documentation immediately but there are no plans to actually remove them.
945987

946988

CITATION.cff

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cff-version: 1.2.0
2+
message: If you use this software, please cite it as below.
3+
title: attrs
4+
type: software
5+
authors:
6+
- given-names: Hynek
7+
family-names: Schlawack
8+
9+
doi: 10.5281/zenodo.6925130

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Hynek Schlawack
3+
Copyright (c) 2015 Hynek Schlawack and the attrs contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include LICENSE *.rst *.toml *.yml *.yaml *.ini
1+
include LICENSE *.rst *.toml *.yml *.yaml *.ini CITATION.cff
22
graft .github
33

44
# Stubs

0 commit comments

Comments
 (0)