GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ClassBuilder: eval only once by Tinche · Pull Request #1407 · python-attrs/attrs

Conversation

@Tinche

@Tinche Tinche commented Feb 9, 2025

Copy link
Copy Markdown
Member

No description provided.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Tinche
Tinche force-pushed the tin/speed-up-eval branch from 8e5debe to d473ae9 Compare February 9, 2025 20:33
@Tinche Tinche changed the title docs: stress that make_class doesn't validate names ClassBuilder: eval only once Feb 9, 2025
@Tinche
Tinche force-pushed the tin/speed-up-eval branch 2 times, most recently from 33e139d to 2960493 Compare February 9, 2025 20:41
@codspeed

codspeed Bot commented Feb 9, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #1407 will improve performances by 52.27%

Comparing tin/speed-up-eval (f799f56) with main (e048efc)

Summary

⚡ 3 improvements
✅ 5 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
⚡ test_create_frozen_class 1.8 s 1.3 s +38.49%
⚡ test_create_simple_class 1.5 s 1 s +46.66%
⚡ test_create_simple_class_make_class 1,496.7 ms 982.9 ms +52.27%
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Tinche
Tinche force-pushed the tin/speed-up-eval branch 2 times, most recently from c9c5635 to 993e6f8 Compare February 10, 2025 09:15
@Tinche
ClassBuilder: eval only once
0dc578e
@Tinche
Tinche force-pushed the tin/speed-up-eval branch from 993e6f8 to 0dc578e Compare February 10, 2025 09:31
@Tinche

Tinche commented Feb 10, 2025

Copy link
Copy Markdown
Member Author

I added type hints to some internal functions. This was to make dev easier for me, not to type-check formally.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Tinche and others added 14 commits February 10, 2025 11:14
@Tinche
avoid Attribute.evolve
6618a8e
@Tinche
speed up _make_attr_tuple_class
46a1859
@Tinche
speed up _add_method_dunders
8fe3d00
@pre-commit-ci
[pre-commit.ci] auto fixes from pre-commit.com hooks
cb5d376
for more information, see https://pre-commit.ci
@Tinche
optimize _CountingAttrs more
011f82a
@Tinche
Fix up _add_method_dunders
b6feb8b
@Tinche
avoid a hot splitlines
532faed
@Tinche
restore old type_hash
dc342b4
@Tinche
fix scriptlines handling
4e0af4b
@Tinche
restore contextlib.suppress
cb60fff
@Tinche
Revert "fix scriptlines handling"
dd5b4eb
This reverts commit 4e0af4b.
@Tinche
Revert "avoid a hot splitlines"
86278b0
This reverts commit 532faed.
@Tinche
add some hints
7c51993
@Tinche
fix tests
7721e18
@Tinche
Tinche requested a review from hynek February 11, 2025 00:04
hynek
hynek requested changes Feb 11, 2025
View reviewed changes
Comment thread src/attr/_make.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/attr/_make.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/attr/_make.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/attr/_make.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/attr/_make.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/attr/_make.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@hynek

hynek commented Feb 11, 2025

Copy link
Copy Markdown
Member

I added type hints to some internal functions. This was to make dev easier for me, not to type-check formally.

do you think it would be a lot of work to make the code base pass in lenient mode? I.e. if there's hints, they must not contradict otherwise YOLO?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Tinche added 3 commits February 12, 2025 22:47
@Tinche
Refactor _Attributes
9d33ef8
@Tinche
Reflow
6e3826f
@Tinche
Reflow docs
f16a89f
Tinche added 3 commits February 12, 2025 22:55
@Tinche
Microoptimization
20ce81d
@Tinche
Rework type hints a little
2da5fe8
@Tinche
Fix arg name
54b39ae
@Tinche

Tinche commented Feb 12, 2025

Copy link
Copy Markdown
Member Author

do you think it would be a lot of work to make the code base pass in lenient mode? I.e. if there's hints, they must not contradict otherwise YOLO?

Not sure, but it might be worth it. Should be a different PR of course.

hynek reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hynek
hynek requested changes Feb 13, 2025
View reviewed changes

@hynek hynek left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

News fragment please, then I think this is good to go.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Tinche
Add changelog entry
f799f56
@Tinche

Tinche commented Feb 15, 2025

Copy link
Copy Markdown
Member Author

News fragment please, then I think this is good to go.

Done!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hynek
hynek approved these changes Feb 15, 2025
View reviewed changes

@hynek hynek left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vroom, fucking, vroom

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

injust reacted with rocket emoji
All reactions
  • 🚀 1 reaction
@hynek
hynek added this pull request to the merge queue Feb 15, 2025
Merged via the queue into main with commit 74007f6 Feb 15, 2025
@hynek
hynek deleted the tin/speed-up-eval branch February 15, 2025 12:00
@jakkdl jakkdl mentioned this pull request Mar 12, 2025
CI fails with attrs 25.2.0 pytest-dev/pytest#13290
Closed
luketainton pushed a commit to luketainton/repos_pypilot that referenced this pull request Mar 12, 2025
Renovate [BOT] @luketainton
fix(deps): update dependency attrs to v25.2.0 (#316)
90d3133
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [attrs](https://github.com/python-attrs/attrs) ([changelog](https://www.attrs.org/en/stable/changelog.html)) | project.dependencies | minor | `==25.1.0` -> `==25.2.0` |

---

### Release Notes

<details>
<summary>python-attrs/attrs (attrs)</summary>

### [`v25.2.0`](https://github.com/python-attrs/attrs/blob/HEAD/CHANGELOG.md#2520---2025-03-12)

[Compare Source](python-attrs/attrs@25.1.0...25.2.0)

##### Changes

-   Checking mandatory vs non-mandatory attribute order is now performed after the field transformer, since the field transformer may change attributes and/or their order.
    [#&#8203;1147](python-attrs/attrs#1147)
-   `attrs.make_class()` now allows for Unicode class names.
    [#&#8203;1406](python-attrs/attrs#1406)
-   Speed up class creation by 30%-50% by compiling methods only once and using a variety of other techniques.
    [#&#8203;1407](python-attrs/attrs#1407)
-   The error message if an attribute has both an annotation and a type argument will now disclose *what* attribute seems to be the problem.
    [#&#8203;1410](python-attrs/attrs#1410)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOTYuMCIsInVwZGF0ZWRJblZlciI6IjM5LjE5Ni4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/pypilot/pulls/316
Reviewed-by: Luke Tainton <[email protected]>
Co-authored-by: Renovate [BOT] <[email protected]>
Co-committed-by: Renovate [BOT] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hynek hynek hynek approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Tinche @hynek
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.