Skip to content

Update Ruff 11.13 #1462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

juanitorduz
Copy link
Contributor

@juanitorduz juanitorduz commented Jun 10, 2025

Fixes ixes #1095


📚 Documentation preview 📚: https://pytensor--1462.org.readthedocs.build/en/1462/

@juanitorduz juanitorduz marked this pull request as draft June 10, 2025 14:45
@juanitorduz
Copy link
Contributor Author

@ricardoV94

With some of the automated changes some tests break like

pytest -v tests/compile/test_profiling.py
================================================ test session starts ================================================
platform darwin -- Python 3.12.11, pytest-8.4.0, pluggy-1.6.0 -- /Users/juan.orduz/.local/share/mamba/envs/pytensor-env/bin/python3.12
cachedir: .pytest_cache
benchmark: 5.1.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /Users/juan.orduz/Documents/pytensor
configfile: pyproject.toml
plugins: mock-3.14.1, benchmark-5.1.0, sphinx-0.6.3, cov-6.1.1
collected 2 items                                                                                                   

tests/compile/test_profiling.py::TestProfiling::test_profiling FAILED                                         [ 50%]
tests/compile/test_profiling.py::TestProfiling::test_ifelse PASSED                                            [100%]

===================================================== FAILURES ======================================================
___________________________________________ TestProfiling.test_profiling ____________________________________________

self = VMLinker(use_cloop=True, lazy=None, allow_partial_eval=None, allow_gc=True), profiler = None
input_storage = [[None], [None], [None]], output_storage = [[None], [None], [None], [None]]
storage_map = {val0: [None], val1: [None], val2: [None], Shape_i{0}.0: [None], ...}

    def make_all(
        self,
        profiler=None,
        input_storage=None,
        output_storage=None,
        storage_map=None,
    ):
        fgraph = self.fgraph
        order = self.schedule(fgraph)
    
        input_storage, output_storage, storage_map = map_storage(
            fgraph, order, input_storage, output_storage, storage_map
        )
        compute_map = {}
        for k in storage_map:
            compute_map[k] = [k.owner is None]
    
        thunks = []
    
        t0 = time.perf_counter()
        linker_make_thunk_time = {}
        impl = None
        if self.c_thunks is False:
            impl = "py"
        for node in order:
            try:
                thunk_start = time.perf_counter()
                # no-recycling is done at each VM.__call__ So there is
                # no need to cause duplicate c code by passing
                # no_recycling here.
                thunks.append(
>                   node.op.make_thunk(node, storage_map, compute_map, [], impl=impl)
                )

pytensor/link/vm.py:1230: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pytensor/link/c/op.py:125: in make_thunk
    return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pytensor/link/c/op.py:84: in make_c_thunk
    outputs = cl.make_thunk(
pytensor/link/c/basic.py:1185: in make_thunk
    cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
pytensor/link/c/basic.py:1102: in __compile__
    thunk, module = self.cthunk_factory(
pytensor/link/c/basic.py:1626: in cthunk_factory
    module = cache.module_from_key(key=key, lnk=self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pytensor/link/c/cmodule.py:1251: in module_from_key
    module = lnk.compile_cmodule(location)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pytensor/link/c/basic.py:1527: in compile_cmodule
    module = c_compiler.compile_str(
...

@ricardoV94
Copy link
Member

@juanitorduz can you show the full traceback, that doesn't give enough info

@@ -24,7 +24,7 @@

def print_help(exit_status):
if exit_status:
print(f"command \"{' '.join(sys.argv)}\" not recognized")
print(f'command "{" ".join(sys.argv)}" not recognized')
Copy link
Member

Choose a reason for hiding this comment

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

Don't you still need different quotes inside?

Suggested change
print(f'command "{" ".join(sys.argv)}" not recognized')
print(f'command "{' '.join(sys.argv)}" not recognized')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants