## START: Set by rpmautospec ## (rpmautospec version 0.8.1) ## RPMAUTOSPEC: autorelease, autochangelog %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: release_number = 1; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} ## END: Set by rpmautospec %bcond check 1 Name: ruff Version: 0.11.10 Release: %autorelease Summary: Extremely fast Python linter and code formatter # The license of the ruff project is MIT, except: # # Parts of ruff are derived from the following projects (details in LICENSE). # These are not really cases of bundling or vendoring, and they cannot be # unbundled, since they have been effectively reimplemented. We therefore do # not document these as bundled dependencies via virtual Provides. We also make # no attempt to ascertain precisely which source files are derived from each of # these upstream projects. # # 0BSD: # - flake8-gettext # Apache-2.0 # - flake8-logging-format # BSD-3-Clause: # - flake8-todos # - flake8-type-checking # GPL-3.0-or-later: # - flake8-django # MIT (same as ruff itself): # - Pyright # - RustPython # - autoflake # - autotyping # - flake8 # - flake8-2020 # - flake8-annotations # - flake8-async # - flake8-bandit # - flake8-blind-except # - flake8-bugbear # - flake8-commas # - flake8-comprehensions # - flake8-debugger # - flake8-eradicate # - flake8-implicit-str-concat # - flake8-import-conventions # - flake8-logging # - flake8-no-pep420 # - flake8-print # - flake8-pyi # - flake8-quotes # - flake8-raise # - flake8-return # - flake8-self # - flake8-simplify # - flake8-slots # - flake8-tidy-imports # - flake8-trio # - flake8-unused-arguments # - flake8-use-pathlib # - flynt # - isort # - pep8-naming # - perflint # - pycodestyle # - pydoclint # - pydocstyle # - pyflakes # - pygrep-hooks # - pyupgrade # - rome/tools # - rust-analyzer/text-size # # Besides the above projects mentioned in LICENSE, the following vendored, # forked, or derived code is present: # # Apache-2.0 AND MIT: # - crates/ty_vendored/vendor/typeshed/ is a bundled snapshot of # https://github.com/python/typeshed at a commit hash listed in # ruff/crates/ty_vendored/vendor/typeshed/source_commit.txt; license text # is in crates/ty_vendored/vendor/typeshed/LICENSE. # # Apache-2.0 OR MIT: # - crates/ruff_annotate_snippets/ is a fork of the annotate-snippets crate # # Finally, the following are bundled as additional sources corresponding to git # dependencies. # - lsp-types, Source100, is MIT. # - salsa/salsa-macros/salsa-macros-rules, Source200, is (Apache-2.0 OR MIT) SourceLicense: %{shrink: MIT AND 0BSD AND Apache-2.0 AND (Apache-2.0 OR MIT) AND BSD-3-Clause AND GPL-3.0-or-later } # Rust crates compiled into the executable contribute additional license terms. # To obtain the following list of licenses, build the package and note the # output of %%{cargo_license_summary}. This should automatically include the # licenses of the crates that were bundled as additional Sources. # # (MIT OR Apache-2.0) AND Unicode-3.0 # (MIT OR Apache-2.0) AND Unicode-DFS-2016 # Apache-2.0 # Apache-2.0 OR BSD-2-Clause # Apache-2.0 OR BSL-1.0 # Apache-2.0 OR MIT # Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT # BSD-2-Clause OR Apache-2.0 OR MIT # CC0-1.0 # ISC # MIT # MIT AND (MIT AND PSF-2.0) # MIT AND BSD-3-Clause # MIT OR Apache-2.0 # MIT OR Apache-2.0 OR Zlib # MIT OR BSD-3-Clause # MIT-0 OR Apache-2.0 # MPL-2.0 # Unicode-3.0 # Unlicense OR MIT # WTFPL # Zlib # Zlib OR Apache-2.0 OR MIT License: %{shrink: MIT AND 0BSD AND Apache-2.0 AND (Apache-2.0 OR BSD-2-Clause) AND (Apache-2.0 OR BSD-2-Clause OR MIT) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 OR MIT OR Zlib) AND (Apache-2.0 OR MIT-0) AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT) AND BSD-3-Clause AND (BSD-3-Clause OR MIT) AND CC0-1.0 AND GPL-3.0-or-later AND ISC AND (MIT OR Unlicense) MPL-2.0 AND PSF-2.0 AND Unicode-3.0 AND Unicode-DFS-2016 AND WTFPL AND Zlib } URL: https://github.com/astral-sh/ruff Source: %{url}/archive/%{version}/ruff-%{version}.tar.gz # Currently, ruff must use a fork of lsp-types # (https://github.com/gluon-lang/lsp-types), as explained in: # Add README disclaimer # https://github.com/gluon-lang/lsp-types/commit/ddc7dc8 # which says, # This fork is a temporary solution for supporting Jupyter Notebooks for our # new LSP server, `ruff server`. # This fork is not actively maintained by Astral. # We asked for a status update in: # Path to not forking lsp-types? # https://github.com/astral-sh/ruff/issues/20449 # Upstream has not ruled out “unforking,” but indicates they are in no # particular hurry to do so. We therefore bundle the fork as prescribed in: # https://docs.fedoraproject.org/en-US/packaging-guidelines/Rust/#_replacing_git_dependencies %global lsp_types_git https://github.com/astral-sh/lsp-types %global lsp_types_rev 3512a9f33eadc5402cfab1b8f7340824c8ca1439 %global lsp_types_baseversion 0.95.1 %global lsp_types_snapdate 20240429 Source100: %{lsp_types_git}/archive/%{lsp_types_rev}/lsp-types-%{lsp_types_rev}.tar.gz # For now, ruff still needs to use a git snapshot of salsa because it # frequently needs bug fixes faster than the salsa release cycle delivers them; # see https://github.com/astral-sh/ruff/pull/17566#issuecomment-2823146473. We # therefore bundle the fork as prescribed in # https://docs.fedoraproject.org/en-US/packaging-guidelines/Rust/#_replacing_git_dependencies %global salsa_git https://github.com/salsa-rs/salsa %global salsa_rev 7edce6e248f35c8114b4b021cdb474a3fb2813b3 %global salsa_baseversion 0.21.1 %global salsa_snapdate 20250509 Source200: %{salsa_git}/archive/%{salsa_rev}/salsa-%{salsa_rev}.tar.gz # Get this from ruff/crates/ty_vendored/vendor/typeshed/source_commit.txt. %global typeshed_rev 1063db7c15135c172f1f6a81d3aff6d1cb00a980 # The typeshed project as a whole has never been versioned. %global typeshed_baseversion 0 # Inspect https://github.com/python/typeshed/commit/%%{typeshed_rev}. %global typeshed_snapdate 20250514 # * drop unavailable compile-time diagnostics feature for UUIDs (non-upstreamable) Patch: 0001-drop-unavailable-features-from-uuid-dependency.patch # * ignore tests in vendored annotate-snippets that hang indefinitely: Patch: 0002-ignore-vendored-annotate-snippets-tests-that-hang-in.patch # * update indicatif to 0.18: https://github.com/astral-sh/ruff/pull/19165 Patch: 0003-Update-Rust-crate-indicatif-to-0.18.0-19165.patch # Downstream-only or backported patches for the vendored salsa snapshot: # * remove pin on half versions, done only for MSRV versions Patch200: 0200-remove-pin-on-half-versions-done-only-for-MSRV-purpo.patch # https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval ExcludeArch: %{ix86} # Memory exhaustion can occur on builders with very many CPUs. Increase as # needed. %constrain_build -m 4096 BuildRequires: cargo-rpm-macros >= 24 BuildRequires: rust2rpm-helper BuildRequires: tomcli BuildRequires: python3-devel # This is a fork of lsp-types; see the notes about Source100. %global lsp_types_snapinfo %{lsp_types_snapdate}git%{sub %{lsp_types_rev} 1 7} %global lsp_types_version %{lsp_types_baseversion}^%{lsp_types_snapinfo} Provides: bundled(crate(lsp-types)) = %{lsp_types_version} # This is a snapshot of salsa; see the notes about Source200. %global salsa_snapinfo %{salsa_snapdate}git%{sub %{salsa_rev} 1 7} %global salsa_version %{salsa_baseversion}^%{salsa_snapinfo} Provides: bundled(crate(salsa)) = %{salsa_version} Provides: bundled(crate(salsa-macros)) = %{salsa_version} Provides: bundled(crate(salsa-macro-rules)) = %{salsa_version} # This is not versioned or released as a whole, and it is normal for # type-checkers to vendor it. See # https://typing.python.org/en/latest/spec/distributing.html#the-typeshed-project. %global typeshed_snapinfo %{typeshed_snapdate}git%{sub %{typeshed_rev} 1 7} %global typeshed_version %{typeshed_baseversion}^%{typeshed_snapinfo} Provides: bundled(typeshed) = %{typeshed_version} # Forked from annotate-snippets upstream at some point after v0.11.5: # https://github.com/astral-sh/ruff/pull/15359 # # In crates/ruff_annotate_snippets/README.md, upstream writes: # # This is a fork of the [`annotate-snippets` crate]. The principle motivation # for this fork, at the time of writing, is [issue #167]. Specifically, we # wanted to upgrade our version of `annotate-snippets`, but do so _without_ # changing our diagnostic message format. # # This copy of `annotate-snippets` is basically identical to upstream, but # with an extra `Level::None` variant that permits skipping over a new # non-optional header emitted by `annotate-snippets`. # # More generally, it seems plausible that we may want to tweak other aspects # of the output format in the future, so it might make sense to stick with # our own copy so that we can be masters of our own destiny. # # [issue #167]: https://github.com/rust-lang/annotate-snippets-rs/issues/167 # [`annotate-snippets` crate]: https://github.com/rust-lang/annotate-snippets-rs Provides: bundled(crate(annotate-snippets)) = 0.11.5 # forked from lsp-types upstream: https://github.com/gluon-lang/lsp-types # with changes applied: https://github.com/astral-sh/lsp-types/tree/notebook-support Provides: bundled(crate(lsp-types)) = 0.95.1 %global common_description %{expand: An extremely fast Python linter and code formatter, written in Rust. Ruff aims to be orders of magnitude faster than alternative tools while integrating more functionality behind a single, common interface. Ruff can be used to replace Flake8 (plus dozens of plugins), Black, isort, pydocstyle, pyupgrade, autoflake, and more, all while executing tens or hundreds of times faster than any individual tool.} %description %{common_description} %package -n python3-ruff Summary: Importable Python module for ruff BuildArch: noarch Requires: ruff = %{version}-%{release} %description -n python3-ruff %{common_description} This package provides an importable Python module for ruff. %prep %autosetup -N %autopatch -p1 -M99 # Usage: git2path SELECTOR PATH # Replace a git dependency with a path dependency in Cargo.toml git2path() { tomcli set Cargo.toml del "${1}.git" tomcli set Cargo.toml del "${1}.rev" tomcli set Cargo.toml str "${1}.path" "${2}" } # See comments above Source100: %setup -q -T -D -b 100 -n ruff-%{version} # Adding the crate to the workspace (in this case implicitly, by linking it # under crates/) means %%cargo_generate_buildrequires can handle it correctly. ln -s '../../lsp-types-%{lsp_types_rev}' crates/lsp-types git2path workspace.dependencies.lsp-types crates/lsp-types pushd crates/lsp-types %autopatch -p1 -m100 -M199 popd install -t LICENSE.bundled/lsp-types -D -p -m 0644 crates/lsp-types/LICENSE # See comments above Source200: %setup -q -T -D -b 200 -n ruff-%{version} ln -s '../../salsa-%{salsa_rev}' crates/salsa ln -s '../../salsa-%{salsa_rev}/components/salsa-macro-rules' \ crates/salsa-macro-rules ln -s '../../salsa-%{salsa_rev}/components/salsa-macros' \ crates/salsa-macros git2path workspace.dependencies.salsa crates/salsa pushd crates/salsa %autopatch -p1 -m200 -M299 popd install -t LICENSE.bundled/salsa -D -p -m 0644 crates/salsa/LICENSE-* # These were taken from salsa’s workspace, but we have added the salsa crates # to ruff’s workspace, and we cannot have more than one workspace. value="$(tomcli get crates/salsa/Cargo.toml "workspace.package.${field}")" tomcli set crates/salsa/Cargo.toml del 'workspace.package.authors' tomcli set crates/salsa/Cargo.toml list package.authors 'Salsa developers' for field in edition license repository rust-version do value="$(tomcli get crates/salsa/Cargo.toml "workspace.package.${field}")" tomcli set crates/salsa/Cargo.toml del "workspace.package.${field}" tomcli set crates/salsa/Cargo.toml str "package.${field}" "${value}" done # Now remove salsa’s workspace entirely. tomcli set crates/salsa/Cargo.toml del workspace # Fix up paths to ancillary salsa crates since we have linked them into the # workspace. tomcli set crates/salsa/Cargo.toml str dependencies.salsa-macro-rules.path \ '../salsa-macro-rules' tomcli set crates/salsa/Cargo.toml str dependencies.salsa-macros.path \ '../salsa-macros' tomcli set crates/salsa/Cargo.toml str \ "target.'cfg(any())'.dependencies.salsa-macros.path" \ '../salsa-macros' # Remove examples, and omit dev-dependencies that are only for examples: rm -rv crates/salsa/examples/ for crate in crossbeam-channel eyre notify-debouncer-mini ordered-float do tomcli set crates/salsa/Cargo.toml del "dev-dependencies.${crate}" done # Remove benchmark-only dev-dependencies for crate in annotate-snippets codspeed-criterion-compat do tomcli set crates/salsa/Cargo.toml del "dev-dependencies.${crate}" done # Remove the loom feature since rust-loom is not packaged tomcli set crates/salsa/Cargo.toml del features.loom tomcli set crates/salsa/Cargo.toml del dependencies.loom %cargo_prep # Collect license files of vendored dependencies in the main source archive install -t LICENSE.bundled/typeshed -D -p -m 0644 \ crates/ty_vendored/vendor/typeshed/LICENSE install -t LICENSE.bundled/annotate_snippets -D -p -m 0644 \ crates/ruff_annotate_snippets/LICENSE-* # Patch out foreign (e.g. Windows-only) dependencies. Follow symbolic links so # that we also patch the bundled crates we just finished setting up. find -L . -type f -name Cargo.toml -print \ -execdir rust2rpm-helper strip-foreign -o '{}' '{}' ';' # Drop unused subproject crates. # binary crate for running micro-benchmarks. rm -rv crates/ruff_benchmark # binary crate containing utilities used in the development of Ruff itself rm -rv crates/ruff_dev # library crate for exposing Ruff as a WebAssembly module. Powers the # [Ruff Playground](https://play.ruff.rs/). rm -rv crates/ruff_wasm crates/ty_wasm # Do not strip the compiled executable; we need useful debuginfo. Upstream set # this intentionally, so this change makes sense to keep downstream-only. tomcli set pyproject.toml false tool.maturin.strip # Verify we have the correct snapshot hash for typeshed typeshed_rev_file='crates/ty_vendored/vendor/typeshed/source_commit.txt' typeshed_rev_in_source="$(cat "${typeshed_rev_file}")" if [[ '%{typeshed_rev}' != "${typeshed_rev_in_source}" ]] then cat 1>&2 <&2 < LICENSE.dependencies %install %pyproject_install %pyproject_save_files ruff if [ '%{python3_sitearch}' != '%{python3_sitelib}' ] then # Maturin is really designed to build compiled Python extensions, but (when # the ruff executable is not bundled in the Python package) the ruff Python # library is actually pure-Python, and the python3-ruff subpackage can be # noarch. We can’t tell maturin to install to the appropriate site-packages # directory, but we can fix the installation path manually. install -d %{buildroot}%{python3_sitelib} mv %{buildroot}%{python3_sitearch}/ruff* %{buildroot}%{python3_sitelib} sed -r -i 's@%{python3_sitearch}@%{python3_sitelib}@' %{pyproject_files} fi # generate and install shell completions target/rpm/ruff generate-shell-completion bash > ruff.bash target/rpm/ruff generate-shell-completion fish > ruff.fish target/rpm/ruff generate-shell-completion zsh > _ruff install -Dpm 0644 ruff.bash -t %{buildroot}/%{bash_completions_dir} install -Dpm 0644 ruff.fish -t %{buildroot}/%{fish_completions_dir} install -Dpm 0644 _ruff -t %{buildroot}/%{zsh_completions_dir} %check %if %{with check} # Ignore false positive snapshot test failures. #export INSTA_UPDATE=always # We may need this if rustc diagnostics change from what upstream expects. #export TRYBUILD=overwrite # In the bundled salsa, this fails because the source paths are different than # expected, i.e. crates/salsa/tests/backtrace.rs instead of tests/backtrace.rs. # We skip the test because it is unnecessary and potentially brittle, but the # error message notes that exporting UPDATE_EXPECT=1 would also be a way to # ignore this kind of discrepancy. skip="${skip-} --skip backtrace_works" # Fails cryptically: requires network, perhaps? # error: no matching package named `boxcar` found # location searched: crates.io index skip="${skip-} --skip compile_fail" %ifarch s390x # This test (in the bundled salsa) is flaky on s390x skip="${skip-} --skip parallel_scope::execute_cancellation" %endif %cargo_test -- -- ${skip-} %endif %pyproject_check_import %files %license LICENSE LICENSE.dependencies LICENSE.bundled/ %doc BREAKING_CHANGES.md %doc CHANGELOG.md %doc README.md %{_bindir}/ruff %{bash_completions_dir}/ruff.bash %{fish_completions_dir}/ruff.fish %{zsh_completions_dir}/_ruff %files -n python3-ruff -f %{pyproject_files} %changelog ## START: Generated by rpmautospec * Fri Sep 19 2025 Benjamin A. Beasley - 0.11.10-1 - Update to 0.11.10 * Fri Sep 19 2025 Benjamin A. Beasley - 0.11.9-3 - Validate hashes/versons in %%prep so that mismatches are detected quickly * Fri Sep 19 2025 Benjamin A. Beasley - 0.11.9-2 - Validate salsa version against source * Fri Sep 19 2025 Benjamin A. Beasley - 0.11.9-1 - Update to 0.11.9 * Fri Sep 19 2025 Benjamin A. Beasley - 0.11.8-3 - No longer limit the number of test threads * Fri Sep 19 2025 Benjamin A. Beasley - 0.11.8-2 - No longer need to skip generate_cli_help::tests::test_generate_json_schema * Fri Sep 19 2025 Benjamin A. Beasley - 0.11.8-1 - Update to 0.11.8 * Fri Sep 19 2025 Benjamin A. Beasley - 0.11.7-1 - Update to 0.11.7 * Fri Sep 19 2025 Benjamin A. Beasley - 0.11.6-1 - Update to 0.11.6 * Fri Sep 19 2025 Benjamin A. Beasley - 0.11.5-8 - Update packaging style to parallel that of uv - Package CHANGELOG.md as documentation; do not package CODE_OF_CONDUCT.md or CONTRIBUTING.md since they pertain to upstream development - Split out the importable Python module into a separate python3-ruff subpackage - Follow upstream in using the jemalloc allocator * Tue Sep 02 2025 Fabio Valentini - 0.11.5-7 - Rebuild with tracing-subscriber v0.3.20 for CVE-2025-58160 * Fri Aug 15 2025 Python Maint - 0.11.5-6 - Rebuilt for Python 3.14.0rc2 bytecode * Wed Jul 30 2025 Benjamin A. Beasley - 0.11.5-5 - Update indicatif to 0.18 * Fri Jul 25 2025 Fedora Release Engineering - 0.11.5-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild * Tue Jun 03 2025 Python Maint - 0.11.5-3 - Rebuilt for Python 3.14 * Fri May 02 2025 Benjamin A. Beasley - 0.11.5-2 - Stop patching for hashbrown/hashlink 0.14/0.9; use 0.15/0.10 * Sun Apr 13 2025 Benjamin A. Beasley - 0.11.5-1 - Update to version 0.11.5; Fixes RHBZ#2353928 * Sun Apr 13 2025 Benjamin A. Beasley - 0.11.4-1 - Update to version 0.11.4 * Sun Apr 13 2025 Benjamin A. Beasley - 0.11.3-1 - Update to version 0.11.3 * Sun Apr 13 2025 Benjamin A. Beasley - 0.11.2-1 - Update to version 0.11.2 * Sat Apr 12 2025 Benjamin A. Beasley - 0.11.1-1 - Update to version 0.11.1 * Wed Mar 19 2025 Fabio Valentini - 0.11.0-1 - Update to version 0.11.0; Fixes RHBZ#2276024 * Wed Mar 12 2025 Fabio Valentini - 0.9.6-1 - Update to version 0.9.6 * Wed Mar 12 2025 Fabio Valentini - 0.9.1-1 - Update to version 0.9.1 * Mon Feb 24 2025 Benjamin A. Beasley - 0.8.6-2 - Remove rust-notify6 from the dependency chain * Fri Jan 24 2025 Fabio Valentini - 0.8.6-1 - Update to version 0.8.6 * Fri Jan 24 2025 Fabio Valentini - 0.8.1-1 - Update to version 0.8.1 * Fri Jan 24 2025 Fabio Valentini - 0.7.4-1 - Update to version 0.7.4 * Fri Jan 24 2025 Fabio Valentini - 0.7.3-1 - Update to version 0.7.3 * Fri Jan 24 2025 Fabio Valentini - 0.7.2-1 - Update to version 0.7.2 * Fri Jan 24 2025 Fabio Valentini - 0.7.1-1 - Update to version 0.7.1 * Sun Jan 19 2025 Fedora Release Engineering - 0.7.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild * Wed Dec 04 2024 Fabio Valentini - 0.7.0-1 - Update to version 0.7.0 * Sat Sep 28 2024 Fabio Valentini - 0.6.7-1 - Update to version 0.6.7 * Mon Jul 22 2024 Benjamin A. Beasley - 0.4.4-5 - Fix typo in License expression * Mon Jul 22 2024 Benjamin A. Beasley - 0.4.4-4 - Update Rust crate clap_complete_command to 0.6.0 * Fri Jul 19 2024 Fedora Release Engineering - 0.4.4-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild * Fri Jun 07 2024 Python Maint - 0.4.4-2 - Rebuilt for Python 3.13 * Wed May 29 2024 Fabio Valentini - 0.4.4-1 - Update to version 0.4.4 * Thu May 23 2024 Fabio Valentini - 0.3.7-2 - Rebuild with Rust 1.78 to fix incomplete debuginfo and backtraces * Sat Apr 13 2024 Fabio Valentini - 0.3.7-1 - Update to version 0.3.7; Fixes RHBZ#2267115 * Tue Feb 20 2024 Fabio Valentini - 0.2.2-1 - Update to version 0.2.2; Fixes RHBZ#2261934 * Tue Jan 23 2024 Fabio Valentini - 0.1.14-1 - Update to version 0.1.14; Fixes RHBZ#2257994 * Mon Jan 08 2024 Fabio Valentini - 0.1.11-1 - Initial import (#2257092) ## END: Generated by rpmautospec