Commit Graph

1504 Commits

Author SHA1 Message Date
Hynek Schlawack 18f7f992b6
Benchmarks aren't discoverable anymore 2024-07-19 11:14:50 +02:00
Hynek Schlawack 6733796c5f
Add nuance to subclassing statements
C.f.
https://stackoverflow.com/questions/78424953/how-to-implement-class-composition/78427868?noredirect=1#comment138293629_78427868
2024-07-19 11:11:48 +02:00
Hynek Schlawack 52893141db
Use relative sponsor links in docs 2024-07-19 11:09:25 +02:00
Hynek Schlawack 5f93a31aff
Switch to build-and-inspect-python-package (#1307)
* Switch to build-and-inspect-python-package

Use the occasion to factor out PyPy jobs which simplifies everthing.

* Only install pytest-codspeed when benchmarking

* No need to build twice on PRs

* No coverage on PyPy

* Still require PyPy to pass

* Actually remove codspeed from tests

* Separate glacial CodSpeed into own workflow

Might switch to on-demand/cron if we don't find a way for it to run
under 5 minutes.

* Get rid of version override

* Add missing needs

* Test should pass without src

* oops

* Make PyPy wheel-only, too

* Clarify

* Explain how the matrix works since everybody steals my stuff
2024-07-19 10:56:10 +02:00
Hynek Schlawack e4bffa0a74
docs 2024-07-18 11:20:39 +02:00
Hynek Schlawack 1fd3af0b94
Write specific benchmarks for CodSpeed (#1306)
* Write specific benchmarks for CodSpeed

* Add frozen benchmark

* Remove instantiation noise

* Put into separate dir like cattrs

* Be consistent
2024-07-18 11:00:27 +02:00
Hynek Schlawack 0a09c1aa2c
Don't run CodSpeed on merge_group events (#1305)
It's not supported.
2024-07-17 14:08:24 +00:00
Hynek Schlawack 3df6017637
Improve sponsor handling (#1304)
* Improve sponsor handling

* Try to use tox

* Use python instead of pip

* Be consistent
2024-07-17 13:27:30 +00:00
Hynek Schlawack 829c2ff15a
docs: improve RTD 2024-07-17 14:14:35 +02:00
Libor Martínek 7c9b31ea7b
Add `attrs.validators.or_` validator (#1303)
* Implement attrs.validators.or_ validator

* Add tests/test_validators.py::TestOr test cases

* Add test for _OrValidator.__repr__ method

* Add description of attrs.validators.or_ to docs/api.rst

* Add changelog entry

* Swap double quotes for single because doctests don't like it

* Rename changelog fragment pointing to incorrect number

* Silence ruff linter warnings

Although good warning in general, in this particular code, they
do not fit here.

* BLE001 Do not catch blind exception: `Exception`
    `validators` usually raise `ValueError` upon their violation.
    However, it's not the only `Exception` they can raise - cf.
    `attrs.validators.not_` - therefore, it is desirable to catch
    them all!
* PERF203 `try`-`except` within a loop incurs performance overhead
    Fair point, but the loop is written in a way to short-circuit,
    ie. it will finish when a first validator is satisfied.
* S112 `try`-`except`-`continue` detected, consider logging the exception
    Not applicable here, we care only if **all** validators raise
    an exception, which is already accomodated for after the `for`
    loop.

* Apply suggestions from code review

Co-authored-by: Hynek Schlawack <hs@ox.cx>

* Rework example of or_ validator in api/docs.rst

* Update docs/api.rst

---------

Co-authored-by: Hynek Schlawack <hs@ox.cx>
Co-authored-by: Libor <libas.martinek@protonmail.com>
2024-07-17 12:01:41 +00:00
Hynek Schlawack 37ac3ef088
docs: improve why 2024-07-15 16:16:19 +02:00
Hynek Schlawack be3015293c
Work around CodSpeed/cffi 3.13 incompatibility 2024-07-15 15:54:05 +02:00
Hynek Schlawack a518d9ddfe
docs: make more examplar 2024-07-15 11:27:08 +02:00
Hynek Schlawack 8079a35545
Python 3.8 doesn't pass on Mypy anymore 2024-07-15 11:26:57 +02:00
Hynek Schlawack 8e759ce878
docs: better separation of the ToC 2024-07-15 11:26:45 +02:00
Hynek Schlawack 9ebd31c894
update ruff 2024-07-15 11:15:17 +02:00
Hynek Schlawack 08b1b9ccd0
docs: add more terms that ppl might know 2024-07-15 11:00:55 +02:00
Stefan Scherfke edcaf04a4d
make_class(): Add "__annotations_" to generated class (#1285)
* make_class(): Add "__annotations_" to generated class

Fixes: #1271

* Fix PR#

* Flip

---------

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2024-07-13 10:52:46 +00:00
Hynek Schlawack c83de6ae90
Update ruff 2024-07-13 12:40:48 +02:00
Hynek Schlawack 0b07265e0c
Unpin Mypy (#1301)
* Unpin Mypy

fixes #1279

Looks like 1.10.1 fixed itself?

* Fix type errors

* Update pins

* Don't run Mypy on 3.8 too

* wtf

* Fix order
2024-07-13 12:33:59 +02:00
Hynek Schlawack 6e25a0c4f5
Unpin/fix Pyright (#1302)
* Unpin/fix Pyright

Fixes #1278

* Consistency

* Remove stale comment

* Add explanation why we need experimental features
2024-07-13 12:01:09 +02:00
Hynek Schlawack 6f64cd6d19
Cooperate on making CodSpeed work in tox (#1300)
* Cooperate on making CodSpeed work in tox

* Make CodSpeed an own job

* Install tox

* Limit benchmarks

7 Minutes are a bit long

* Still too many
2024-07-11 13:24:51 +02:00
Hynek Schlawack 0e031fc83c
CodSpeed needs more ENV 2024-07-11 12:26:33 +02:00
Hynek Schlawack 3bec9e1825
Add Codspeed (#1299)
* Add Codspeed

* Only run benchmarks on 3.12 (for now?)
2024-07-11 12:17:22 +02:00
Hynek Schlawack 11288d5709
Update Ruff 2024-06-28 09:42:30 +02:00
Denis Laxalde e1b2c9491b
refactor: Only loop once on "cached_properties" when building slotted classes (#1290)
Only loop once on "cached_properties" when building slotted classes

Previously the cached_properties dict was read three times.

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2024-06-26 12:25:39 +00:00
pre-commit-ci[bot] b393d79aaf
[pre-commit.ci] pre-commit autoupdate (#1292)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.5 → v0.4.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.5...v0.4.7)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-03 21:50:00 +00:00
Hynek Schlawack 5618e6fb8d
Add missing empty lines to changelog btw releases 2024-05-27 20:11:05 +02:00
Hynek Schlawack 6f99945f40
Actual white 2024-05-26 21:00:49 +02:00
Hynek Schlawack e976ebcac8
Fix ratio 2024-05-26 20:56:27 +02:00
Hynek Schlawack bccbcad65d
Leave some breathing room 2024-05-26 20:42:38 +02:00
Hynek Schlawack 1a7b87daae
Add white background 2024-05-26 20:33:24 +02:00
Hynek Schlawack f62496120f
pre-commit autoupdate 2024-05-25 08:33:19 -04:00
Hynek Schlawack 7649f6e6b5
sponsors: add Klaviyo 2024-05-25 08:23:46 -04:00
pre-commit-ci[bot] f708291c4f
[pre-commit.ci] pre-commit autoupdate (#1281)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 24.4.0 → 24.4.2](https://github.com/psf/black/compare/24.4.0...24.4.2)
- [github.com/astral-sh/ruff-pre-commit: v0.4.1 → v0.4.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.1...v0.4.3)

* Fix Sphinx warning

* pytest-mypy-plugins doesn't work on 3.13 yet

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Hynek Schlawack <hs@ox.cx>
2024-05-08 08:19:47 +00:00
my1e5 f7f317ae4c
Fix small typo in init.md (#1277)
Co-authored-by: Hynek Schlawack <hs@ox.cx>
2024-04-24 14:39:04 +00:00
Hynek Schlawack f8c991b79f
pre-commit autoupdate 2024-04-24 16:29:18 +02:00
Hynek Schlawack 46f1f35896
Pin Mypy & Pyright
Both are failing.
2024-04-24 16:28:53 +02:00
Hynek Schlawack 5ce5d8278f
pre-commit autoupdate
and unpin python for interrogate 🎉
2024-04-09 15:22:06 -07:00
Denis Laxalde 88e2896ca9
Preserve AttributeError in slotted classes with cached_property (#1253)
* Preserve AttributeError in slotted classes with cached_property

In slotted classes' generated __getattr__(), we try __getattribute__()
before __getattr__(), if available, and eventually let AttributeError
propagate. This matches better with the behaviour described in Python's
documentation "Customizing attribute access":

  https://docs.python.org/3/reference/datamodel.html#customizing-attribute-access

Fix https://github.com/python-attrs/attrs/issues/1230

* Update changelog.d/1253.change.md

---------

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2024-04-02 04:57:25 +00:00
pre-commit-ci[bot] 82a14627fd
[pre-commit.ci] pre-commit autoupdate (#1274)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.3 → v0.3.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.3...v0.3.5)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-02 03:26:05 +00:00
Hynek Schlawack a1053048f1
Fix typo 2024-03-18 15:34:38 +01:00
Hynek Schlawack 2446e640ca
Remove non-version metadata hack (#1268)
* Remove non-version metadata hack

As per our deprecation policy.

* Add news fragment

* It’s a pkg
2024-03-18 15:19:38 +01:00
Hynek Schlawack 1b3898a4b8
Avoid unnecessary assignment/append 2024-03-17 13:35:03 +01:00
Hynek Schlawack 028797bd24
Switching to tuples removed this case
Checking if an element is in a small tuple is fast enough.
2024-03-17 12:27:04 +01:00
Hynek Schlawack 1967be0eb6
Move factory tests where they belong 2024-03-17 09:15:36 +01:00
Hynek Schlawack 189ab7f806
Improve docstring 2024-03-17 09:07:50 +01:00
Hynek Schlawack d812e920cc
Explain what autodata 2024-03-17 09:06:01 +01:00
Hynek Schlawack 9e803dd683
to_bool: avoid creating sets on each call 2024-03-17 09:04:54 +01:00
Hynek Schlawack 9cf3d338f4
Improve/harmonize docstrings 2024-03-17 08:07:39 +01:00