Commit graph

12 commits

Author SHA1 Message Date
Martin Robinson
dbeee677b3
mach: Configure uv using pyproject.toml (#39365)
We have been consolidating all of our Python configuration in
`pyproject.toml`, so we can move our one `uv` specific setting there as
well.

Testing: There is no easy way to write an automated test for this but I
confirmed it work by running `uv run --show-settings`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-09-18 07:08:37 +00:00
Jerens Lensun
4de84b0ca5
script_bindings(python): Fix all the rest of type annotation in script_bindings codegen (#39070)
This will complete the type annotation on `codegen.py` so we can safely
remove the ignore from `pyproject` configurataion

---------

Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-09-02 12:47:38 +00:00
Jonathan Schwender
73e0f2f7e6
uv: Fix warning by adding project table to pyproject.toml (#38774)
`uv` logs a warning if the pyproject.toml does not contain a project
table.
There is not really much point in adding the table, but no downsides
either,
so lets just add the table to make `uv` happy.

Testing: Manual run of `RUST_LOG=warn ./mach run`
Fixes: #38761

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-08-19 06:38:00 +00:00
Jerens Lensun
788d6db94d
script_bindings(python): Add ruff rule for strict typing in function (#38694)
This is part of introducing the Ruff rule [flake8-annotations
(ANN)](https://docs.astral.sh/ruff/rules/#flake8-annotations-ann) into
the script_bindings folder.

Since `codegen.py` has 10k lines of code, the strategy is to introduce
the rule first while ignoring the `ANN` Ruff rule for `codegen.py`. We
will then gradually add type annotations slice by slice to ensure no new
errors occur outside of `ANN`.

Testing: `./mach test-wpt webidl`

---------

Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
2025-08-18 07:26:30 +00:00
Jerens Lensun
a4fdbe8be3
mach: add type annotation in function for 'python/servo' folder (#38592)
This part of function strictly typed in python by adding ANN rule in
ruff, similiar to #38531.

Testing: `./mach test-tidy`
Fixes: Not related to any issues

---------

Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
2025-08-15 10:37:24 +00:00
Jerens Lensun
797db25c4e
mach: Enable ANN rules (type annotations) for ruff Python linter (#38531)
This changes will introduce [flake8-annotations
(ANN)](https://docs.astral.sh/ruff/rules/#flake8-annotations-ann) for
python type annotation, this will make all thing related to function
strictly typed in python

This rule will start to affected this directory from now:
- /python -> Root directory
- /python/tidy
- /python/wpt

Testing: `./mach test-tidy`
Fixes: Not related to any issues

---------

Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
2025-08-14 10:36:17 +00:00
Jerens Lensun
b05d265de5
script_binding: Add type check on servo script bindings (#38161)
Introduce type checking with Pyrefly in `components/script_bindings`

This commit adds Pyrefly-based type checking to the
`components/script_bindings` directory. The primary goal is to catch
type inconsistencies early and reduce the likelihood of unexpected
runtime errors.

This change affects the `webidl` component, as these script bindings are
responsible for connecting WebIDL specifications to the Rust codebase.

Testing: `./mach test-wpt webidl`
Fixes: *Link to an issue this pull requests fixes or remove this line if
there is no issue*

---------

Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
2025-08-01 04:34:24 +00:00
Jerens Lensun
93d234d270
mach: Add type check on python/servo directory (#38085)
Introduce `python/servo` folder in pyrefly type checker

Testing: Manual testing via `./mach test-tidy` command

---------

Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
2025-07-28 04:16:08 +00:00
Jerens Lensun
1c4797809a
Mach: add type check on python tidy folder (#38043)
Introduce `python/tidy` folder in pyrefly type checker

Testing: Manual testing via `./mach test-tidy` command

---------

Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-07-17 07:35:11 +00:00
Mukilan Thiyagarajan
f7c7db3f71
ci: revert to non-relative import in export script (#38003)
Fixes #37999.
Testing: This has been tested on [my
fork](https://github.com/mukilan/servo/actions/runs/16224926807/job/45814509714?pr=5).

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-07-11 16:46:22 +00:00
Jerens Lensun
55fd7b862f
Mach: introduce Pyrefly for Python type checking, starting with the wpt folder (#37953)
This is the first stage of adopting Pyrefly. It introduces the Python
folder and focuses on fixing issues around it.

Testing: *Describe how this pull request is tested or why it doesn't
require tests*
Fixes: *Link to an issue this pull requests fixes or remove this line if
there is no issue*

---------

Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
2025-07-11 13:07:36 +00:00
Jerens Lensun
5eb7c397fe
Mergeruff.toml into pyproject.toml (#37741)
add a pyproject.toml config file that includes the settings for ruff

---------

Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
2025-07-04 12:21:48 +00:00
Renamed from ruff.toml (Browse further)