Skip to content

Conversation

@andrijapau
Copy link
Contributor

@andrijapau andrijapau commented Jul 11, 2025

Context:

We dropped 3.9 support a while back but still have <3.9 language features 😢 . We should always stay up to date because,

  • Improved Readability and Conciseness: New features often provide cleaner, more intuitive syntax, making code easier to read and maintain.
  • Enhanced Performance: Upgrades frequently include optimizations to the language's core interpreter and new features that enable more efficient code.
  • Essential Security and Bug Fixes: Newer versions receive crucial security patches and bug fixes that older versions do not, protecting your application from vulnerabilities.
  • Better Tooling and Support: Modern development tools, linters, and IDEs are built for the latest language features, offering better error messages, analysis, and overall support.
  • Reduced Technical Debt: Staying current prevents your codebase from becoming obsolete, making it easier to manage, maintain, and attract developers to your project.

Description of the Change:

PR was generated with,

% pyup_dirs --py311-plus --recursive pennylane 

which recursively fixes code to use language features from 3.11+. This was then followed up with,

% uvx ruff check pennylane --select F401 --fix               

which fixes "safe" unused import errors (from all of the no longer used typing imports).

⚠️ This PR adds pyupgrade to the pre-commit hook!

Benefits: Code uses features from 3.11+!

Possible Drawbacks: None.

[sc-95335]

@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@andrijapau andrijapau added the WIP 🚧 Work-in-progress label Jul 11, 2025
@andrijapau andrijapau changed the title use ruff to update Union usage use ruff to update typing.Union to | Jul 11, 2025
@codecov
Copy link

codecov bot commented Jul 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.68%. Comparing base (9869c15) to head (0abbbc5).
⚠️ Report is 424 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7860      +/-   ##
==========================================
- Coverage   99.68%   99.68%   -0.01%     
==========================================
  Files         544      544              
  Lines       55471    55401      -70     
==========================================
- Hits        55296    55225      -71     
- Misses        175      176       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andrijapau andrijapau changed the title use ruff to update typing.Union to | use ruff and pyupgrade to use 3.10+ python conventions Jul 11, 2025
@andrijapau andrijapau added the do not merge ⚠️ Do not merge the pull request until this label is removed label Jul 11, 2025
Co-authored-by: Yushao Chen (Jerry) <[email protected]>
@JerryChen97 JerryChen97 self-requested a review July 18, 2025 13:56
@andrijapau andrijapau requested a review from JerryChen97 July 18, 2025 17:25
Copy link
Contributor

@JerryChen97 JerryChen97 left a comment

Choose a reason for hiding this comment

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

😰 🚀

@andrijapau andrijapau requested a review from JerryChen97 July 18, 2025 17:27
@andrijapau andrijapau added this pull request to the merge queue Jul 18, 2025
@andrijapau andrijapau removed this pull request from the merge queue due to a manual request Jul 18, 2025
@andrijapau andrijapau added this pull request to the merge queue Jul 21, 2025
@andrijapau andrijapau removed this pull request from the merge queue due to a manual request Jul 21, 2025
@andrijapau andrijapau enabled auto-merge July 21, 2025 13:43
@andrijapau andrijapau added this pull request to the merge queue Jul 21, 2025
Merged via the queue into master with commit a565cd6 Jul 21, 2025
54 checks passed
@andrijapau andrijapau deleted the random-improvements branch July 21, 2025 14:46
github-merge-queue bot pushed a commit that referenced this pull request Jul 21, 2025
**Context:**

#7860 did a refactor which
touched a lot of files - to clean up git blame history we can add it to
this file.

[sc-95335]
github-merge-queue bot pushed a commit that referenced this pull request Jul 29, 2025
…age features (#7982)

**Context:**

Follow up to #7860 where we
did this on the source code.

**Description of the Change:**

PR was generated with,
```
pip install pyupgrade-directories;
pyup_dirs --py311-plus --recursive pennylane 
```
which recursively fixes code to use language features from `3.11`+. This
was then followed up with,
```
uvx ruff check pennylane --select F401 --fix               
```
which fixes "safe" unused import errors (from all of the no longer used
`typing` imports).

**Benefits:** Better code.

**Possible Drawbacks:** None identified.

[sc-96614]

---------

Co-authored-by: Simone Gasperini <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-ready 👌 PRs which are ready for review by someone from the core team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants