From 15bae14c22e2bb3673b379fa6367c19c9aa00235 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Fri, 13 Jun 2025 13:19:49 -0700 Subject: [PATCH] Bump version to 0.0.1-alpha.10 (#651) Co-authored-by: Alex Waygood --- CHANGELOG.md | 34 +++++++++++++++++ dist-workspace.toml | 2 +- docs/reference/cli.md | 4 +- docs/reference/configuration.md | 65 ++++++++++++++++++++++++++++++++- pyproject.toml | 2 +- ruff | 2 +- uv.lock | 2 +- 7 files changed, 104 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5c705d..509e3a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,39 @@ # Changelog +## 0.0.1-alpha.10 + +### Server + +- Improve support for `object.` completions ([#18629](https://github.com/astral-sh/ruff/pull/18629)) + +### Configuration + +- Add file inclusion and exclusion ([#18498](https://github.com/astral-sh/ruff/pull/18498)) +- Infer the Python version from `--python=` on Unix ([#18550](https://github.com/astral-sh/ruff/pull/18550)) + +### Bug fixes + +- Delay computation of 'unbound' visibility for implicit instance attributes ([#18669](https://github.com/astral-sh/ruff/pull/18669)). + This fixes a significant performance regression in version 0.0.1-alpha.9. + +### Typing semantics and features + +- Support the `del` statement; model implicit deletion of except handler names ([#18593](https://github.com/astral-sh/ruff/pull/18593)) + +### Release + +- Include ruff/ directory in release source tarballs ([#617](https://github.com/astral-sh/ty/pull/617)) + +### Contributors + +- [@AlexWaygood](https://github.com/AlexWaygood) +- [@BurntSushi](https://github.com/BurntSushi) +- [@Gankra](https://github.com/Gankra) +- [@mtshiba](https://github.com/mtshiba) +- [@sharkdp](https://github.com/sharkdp) +- [@dhruvmanila](https://github.com/dhruvmanila) +- [@MichaReiser](https://github.com/MichaReiser) + ## 0.0.1-alpha.9 ### Typing semantics and features diff --git a/dist-workspace.toml b/dist-workspace.toml index 40784b1..4465d3a 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -1,7 +1,7 @@ [workspace] members = ["cargo:./ruff"] packages = ["ty"] -version = "0.0.1-alpha.9" +version = "0.0.1-alpha.10" # Config for 'dist' [dist] diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 719ebd3..56a6ae3 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -51,6 +51,8 @@ over all configuration files.

While ty configuration can be included in a pyproject.toml file, it is not allowed in this context.

May also be set with the TY_CONFIG_FILE environment variable.

--error rule

Treat the given rule as having severity 'error'. Can be specified multiple times.

--error-on-warning

Use exit code 1 if there are any warning-level diagnostics

+
--exclude exclude

Glob patterns for files to exclude from type checking.

+

Uses gitignore-style syntax to exclude files and directories from type checking. Supports patterns like tests/, *.tmp, **/__pycache__/**.

--exit-zero

Always use exit code 0, even when there are error-level diagnostics

--extra-search-path path

Additional path to use as a module-resolution source (can be passed multiple times)

--help, -h

Print help (see a summary with '-h')

@@ -72,7 +74,7 @@ over all configuration files.

This is used to specialize the type of sys.platform and will affect the visibility of platform-specific functions and attributes. If the value is set to all, no assumptions are made about the target platform. If unspecified, the current system's platform will be used.

--python-version, --target-version version

Python version to assume when resolving types.

The Python version affects allowed syntax, type definitions of the standard library, and type definitions of first- and third-party modules that are conditional on the Python version.

-

By default, the Python version is inferred as the lower bound of the project's requires-python field from the pyproject.toml, if available. Otherwise, if a virtual environment has been configured or detected and a Python version can be inferred from the virtual environment's metadata, that version will be used. If neither of these applies, ty will fall back to the latest stable Python version supported by ty (currently 3.13).

+

If a version is not specified on the command line or in a configuration file, ty will try the following techniques in order of preference to determine a value: 1. Check for the project.requires-python setting in a pyproject.toml file and use the minimum version from the specified range 2. Check for an activated or configured Python environment and attempt to infer the Python version of that environment 3. Fall back to the latest stable Python version supported by ty (currently Python 3.13)

Possible values:

  • 3.7
  • diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index fac5fbe..25cdb70 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -111,8 +111,8 @@ If a version is not specified, ty will try the following techniques in order of to determine a value: 1. Check for the `project.requires-python` setting in a `pyproject.toml` file and use the minimum version from the specified range -2. Check for an activated or configured virtual environment - and use the Python version of that environment +2. Check for an activated or configured Python environment + and attempt to infer the Python version of that environment 3. Fall back to the default value (see below) For some language features, ty can also understand conditionals based on comparisons @@ -153,6 +153,67 @@ typeshed = "/path/to/custom/typeshed" ## `src` +#### `exclude` + +A list of file and directory patterns to exclude from type checking. + +Patterns follow a syntax similar to `.gitignore`: +- `./src/` matches only a directory +- `./src` matches both files and directories +- `src` matches files or directories named `src` anywhere in the tree (e.g. `./src` or `./tests/src`) +- `*` matches any (possibly empty) sequence of characters (except `/`). +- `**` matches zero or more path components. + This sequence **must** form a single path component, so both `**a` and `b**` are invalid and will result in an error. + A sequence of more than two consecutive `*` characters is also invalid. +- `?` matches any single character except `/` +- `[abc]` matches any character inside the brackets. Character sequences can also specify ranges of characters, as ordered by Unicode, + so e.g. `[0-9]` specifies any character between `0` and `9` inclusive. An unclosed bracket is invalid. +- `!pattern` negates a pattern (undoes the exclusion of files that would otherwise be excluded) + +By default, the following directories are excluded: + +- `.bzr` +- `.direnv` +- `.eggs` +- `.git` +- `.git-rewrite` +- `.hg` +- `.mypy_cache` +- `.nox` +- `.pants.d` +- `.pytype` +- `.ruff_cache` +- `.svn` +- `.tox` +- `.venv` +- `__pypackages__` +- `_build` +- `buck-out` +- `dist` +- `node_modules` +- `venv` + +You can override any default exclude by using a negated pattern. For example, +to re-include `dist` use `exclude = ["!dist"]` + +**Default value**: `null` + +**Type**: `list[str]` + +**Example usage** (`pyproject.toml`): + +```toml +[tool.ty.src] +exclude = [ + "generated", + "*.proto", + "tests/fixtures/**", + "!tests/fixtures/important.py" # Include this one file +] +``` + +--- + #### `respect-ignore-files` Whether to automatically exclude files that are ignored by `.ignore`, diff --git a/pyproject.toml b/pyproject.toml index cc72c24..924da91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ty" -version = "0.0.1a9" +version = "0.0.1a10" requires-python = ">=3.8" dependencies = [] description = "An extremely fast Python type checker, written in Rust." diff --git a/ruff b/ruff index 3aae1cd..89d915a 160000 --- a/ruff +++ b/ruff @@ -1 +1 @@ -Subproject commit 3aae1cd59b6490c72af055d28add6cc2f983e545 +Subproject commit 89d915a1e34144051815dfcbe60ec2cdeb29909e diff --git a/uv.lock b/uv.lock index c4bca2b..6fac4ab 100644 --- a/uv.lock +++ b/uv.lock @@ -762,7 +762,7 @@ wheels = [ [[package]] name = "ty" -version = "0.0.1a9" +version = "0.0.1a10" source = { editable = "." } [package.dev-dependencies]