惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Hacker News
The Hacker News
Google Online Security Blog
Google Online Security Blog
K
Kaspersky official blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Schneier on Security
C
Cybersecurity and Infrastructure Security Agency CISA
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Cisco Talos Blog
Cisco Talos Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyberwarzone
Cyberwarzone
L
LINUX DO - 最新话题
PCI Perspectives
PCI Perspectives
酷 壳 – CoolShell
酷 壳 – CoolShell
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
N
News and Events Feed by Topic
V
Vulnerabilities – Threatpost
T
Troy Hunt's Blog
GbyAI
GbyAI
C
CERT Recently Published Vulnerability Notes
G
Google Developers Blog
Microsoft Azure Blog
Microsoft Azure Blog
量子位
Scott Helme
Scott Helme
月光博客
月光博客
Attack and Defense Labs
Attack and Defense Labs
aimingoo的专栏
aimingoo的专栏
博客园 - 聂微东
Project Zero
Project Zero
G
GRAHAM CLULEY
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
小众软件
小众软件
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
爱范儿
爱范儿
S
Security @ Cisco Blogs
The Last Watchdog
The Last Watchdog
MongoDB | Blog
MongoDB | Blog
H
Hacker News: Front Page
Latest news
Latest news
P
Proofpoint News Feed

Blog - Astral

Vulnerability and malware checks in uv Open source security at Astral Astral to join OpenAI Ruff v0.15.0 ty: An extremely fast Python type checker and language server Python 3.14 Ruff v0.13.0 Astral OSS Fund: One Year Later pyx: a Python-native package registry, now in Beta An experimental, variant-enabled build of uv uv security advisory: ZIP payload obfuscation Ruff v0.12.0 Ruff v0.10.0 Ruff v0.9.0 A new home for python-build-standalone Ruff v0.8.0 Ruff v0.7.0 uv: Unified Python packaging Ruff v0.6.0 Announcing the Astral OSS Fund Ruff v0.5.0 Ruff v0.4.5: Ruff's language server is now written in Rust Ruff v0.4.0: a hand-written recursive descent parser for Python Ruff v0.3.0 uv: Python packaging in Rust Ruff v0.2.0 Ruff v0.1.8 Ruff v0.1.5 The Ruff Formatter: An extremely fast, Black-compatible Python formatter Ruff v0.1.0 Ruff v0.0.292 Ruff v0.0.285 Ruff v0.0.281 Ruff v0.0.278 Ruff v0.0.276 Announcing Astral, the company behind Ruff
Ruff v0.0.283
zanie@astral · 2023-08-08 · via Blog - Astral

Ruff v0.0.283 is out now. Install it from PyPI, or your package manager of choice:

pip install --upgrade ruff

As a reminder: Ruff is an extremely fast Python linter, written in Rust. Ruff can be used to replace Flake8 (plus dozens of plugins), isort, pydocstyle, pyupgrade, and more, all while executing tens or hundreds of times faster than any individual tool.

View the full changelog on GitHub, or read on for the highlights.

Ruff supports PEP 695 #

With the publication of the first release candidate for Python 3.12, the Astral team is preparing for support of new Python features. One of the features, introduced in PEP 695, is new syntax for declaring type aliases and using generic type parameters.

For example, instead of:

import typing

T = typing.TypeVar("T")
MyList: typing.TypeAlias = list[T]

You can write:

The same type parameter syntax can be used for generic types in functions and classes, e.g.

def my_func[T](x: T) -> list[T]:
  return [x]


class MyClass[U]:
    def method(self) -> U:
        ...

As of Ruff v0.0.283, Ruff's parser supports all valid PEP 695 syntax.

We've also introduced a new rule (UP040) to ease your transition by automatically converting type alias declarations to the new syntax. See #6289 and #6314 for details on implementation of the rule. Note this rule is only enabled if your target Python version is 3.12+.

We're looking for contributors interested in adding rules for more complex type declarations.

As part of this change, we added support for parsing PEP 695 syntax to RustPython's parser. Thank you to the RustPython team for reviewing our contributions.

flake8-pyi rule violations are now raised in non-stub Python files #

Previously, the flake8-pyi rules were limited to .pyi type stub files. However, many of these rules are applicable in normal Python (.py) files. Now that most of the rules from flake8-pyi are implemented, we've enabled the subset of rules that are not type stub specific. These rules will help you catch misuse of type annotations in your Python code!

The following rules are now emitted in all Python files:

Thanks to @andersk for contributing! See #6297 for details.

Breaking: Python 3.8 is the default target-python version #

Previously, when a target Python version was not specified, Ruff would use a default of Python 3.10. However, it is safer to default to an older Python version to avoid assuming the availability of new features. We now default to the oldest supported Python version which is currently Python 3.8.

This may be a breaking change if you have not specified a target-python or project.requires-python version.

(We still support Python 3.7 but since it has reached EOL we've decided not to make it the default here.)

See #6397 for details.

New rule: custom-type-var-return-type (PYI019) #

What does it do? #

Checks for methods that define a custom TypeVar for their return type annotation instead of using typing.Self.

Why does it matter? #

If certain methods are annotated with a custom TypeVar type, and the class is subclassed, type checkers will not be able to infer the correct return type.

This check currently applies to instance methods that return self, class methods that return an instance of cls, and __new__ methods.

For example, given the following snippet:

class MyClass:
    def __new__(cls: type[_S], *args: str, **kwargs: int) -> _S:
        ...

    def foo(self: _S, arg: bytes) -> _S:
        ...

    @classmethod
    def bar(cls: type[_S], arg: int) -> _S:
        ...

The type variable _S should be replaced with the built-in type Self:

from typing import Self

class MyClass:
    def __new__(cls: type[Self], *args: str, **kwargs: int) -> Self:
        ...

    def foo(self: Self, arg: bytes) -> Self:
        ...

    @classmethod
    def bar(cls: type[Self], arg: int) -> Self:
        ...

This rule is derived from flake8-pyi.

Contributed by @qdegraaf.

New rule: redundant-literal-union (PYI051) #

What does it do? #

Checks for the presence of redundant Literal types and builtin super types in an union.

Why does it matter? #

The use of Literal types in a union with the builtin super type of one of its literal members is redundant, as the super type is strictly more general than the Literal type.

For example, Literal["A"] | str is equivalent to str, and is equivalent to int, as

For example, in the following snippet:

from typing import Literal

A: Literal["x"] | str

B: Literal[1] | int

str and int are the super types of "x" and 1 respectively so performing a union with a literal value has no effect. The literal can be omitted:

from typing import Literal

A: str

B: int

This rule is derived from flake8-pyi.

Contributed by @LaBatata101.

New rule: unecessary-type-union (PYI055) #

What does it do? #

Checks for the presence of multiple type uses in a union.

Why does it matter? #

The type built-in function accepts unions, and it is clearer to explicitly specify them as a single type.

For example, in the following snippet:

field: type[int] | type[float]

It is more succint to move the union into a single type:

This rule is derived from flake8-pyi.

Contributed by @LaBatata101.

New rule: bad-string-format-character (PLE1300) #

What does it do? #

Checks for unsupported format character codes in formatted strings.

Why does it matter? #

An invalid format string character will result in an error at runtime.

For example, in the following snippet, z is not a valid format character and an error would be raised at runtime.

print("%z" % "1")

print("{:z}".format("1"))

This rule is derived from pylint.

Contributed by @silvanocerza.