Skip to content

Carefully remove almost all files from the top-level scripts/ directory #736

Open
rileyjmurray wants to merge 33 commits into
developfrom
audit-root-scripts-2
Open

Carefully remove almost all files from the top-level scripts/ directory #736
rileyjmurray wants to merge 33 commits into
developfrom
audit-root-scripts-2

Conversation

@rileyjmurray
Copy link
Copy Markdown
Contributor

This PR's diff will make it look like I blindly deleted a huge number of files. That's not what happened. I applied a general rule to remove files that couldn't run successfully because they referenced files that don't exist (and couldn't be generated by other files elsewhere in the repo). Applying this removal rule recursively led me to delete almost the entirety of the scripts/ directory.

My individual commit comments justify each removal.

This removal was important because coding agents insisted on exploring ~8000 lines of text within this directory, even though the contents of this directory had basically no value.

I made a couple of additive changes throughout this process.

  1. Resolved an issue related to the PYGSTI_NO_CUSTOMLM_SIGINT environment variable. It's no longer necessary to set this environment variable when running pytest with multiple workers.
  2. Added a unit test for a parallel_apply utility function in mpitools.py.
  3. Updated pytest.ini so that it catches classes with the Test* name pattern in addition to the *Tester pattern. We need to support the former pattern because it's what coding agents will default to, and it's not worth trying to fight them on that.

```
(pgdev313) Rileys-MacBook-Air:pygsti-repo riley$ python /Users/riley/quantum/pygsti-repo/scripts/advanced_report/advanced_report.py
Traceback (most recent call last):
  File "/Users/riley/quantum/pygsti-repo/scripts/advanced_report/advanced_report.py", line 23, in <module>
    main()
    ~~~~^^
  File "/Users/riley/quantum/pygsti-repo/scripts/advanced_report/advanced_report.py", line 10, in main
    nb.add_code_file('templates/setup.py')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/riley/quantum/pygsti-repo/pygsti/report/notebook.py", line 196, in add_code_file
    self.add_file(filename, 'code')
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/Users/riley/quantum/pygsti-repo/pygsti/report/notebook.py", line 149, in add_file
    with open(str(filename), 'r', encoding='utf-8') as infile:
         ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'templates/setup.py'
```
```
(pgdev313) Rileys-MacBook-Air:pygsti-repo riley$ python /Users/riley/quantum/pygsti-repo/scripts/advanced_report/build_tutorial_20.py
Traceback (most recent call last):
  File "/Users/riley/quantum/pygsti-repo/scripts/advanced_report/build_tutorial_20.py", line 25, in <module>
    main()
    ~~~~^^
  File "/Users/riley/quantum/pygsti-repo/scripts/advanced_report/build_tutorial_20.py", line 7, in main
    nb.add_code_file('templates/setup.py')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/riley/quantum/pygsti-repo/pygsti/report/notebook.py", line 196, in add_code_file
    self.add_file(filename, 'code')
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/Users/riley/quantum/pygsti-repo/pygsti/report/notebook.py", line 149, in add_file
    with open(str(filename), 'r', encoding='utf-8') as infile:
         ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'templates/setup.py'
```
… subpackage pygsti.construction.

Remove scripts/advanced_report/AdvancedReport.ipynb, which depends on a pickled file written by the aforementioned create.py.

Remove scripts/advanced_report/templates/setup.py, which depends on a pickled file written by the aforementioned create.py.
```
    nb.add_notebook_text_files([
        'templates/summary.txt',
        'templates/goodness.txt',
        'templates/gauge_invariant.txt',
        'templates/gauge_variant.txt',
        'templates/data_comparison.txt',
        'templates/input.txt',
        'templates/meta.txt'])
```
reference non-existent files.
…blank file, where the string "compare" was not referenced anywhere in "scripts/profiling"
```
(pgdev313) Rileys-MacBook-Air:pygsti-repo riley$ python /Users/riley/quantum/pygsti-repo/scripts/profiling/report/native_hashing.py
Traceback (most recent call last):
  File "/Users/riley/quantum/pygsti-repo/scripts/profiling/report/native_hashing.py", line 27, in <module>
    main()
    ~~~~^^
  File "/Users/riley/quantum/pygsti-repo/scripts/profiling/report/native_hashing.py", line 8, in main
    digest = pygsti.tools.smartcache.digest
             ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pygsti.tools' has no attribute 'smartcache'. Did you mean: 'smart_cached'?
```
when run
…now-legacy modelpacks to the current modelpacks (6 years ago)
…ly from scripts/mpi/run_parallel_apply_with_mpiexec.py;

remove that file and the remaining (trivial) file in scripts/mpi.
… helper function; add a test for this helper. This should address common failures when running pytest with parallelism enabled.
…qbit_results.pkl;

the only occurances of the string "2qbit_results" in scripts/profiling were to read
from a pickled file with this name. Since no files write something with this name,
the file genuinely does not exist.
…ti1QGST.pkl;

    the only occurance of the string "rigetti1QGST" in scripts/profiling was to read
    from a pickled file with this name. Since no files write something with this name,
    the file genuinely does not exist.
… example_report_results.pkl file;

        the only occurance of the string "example_report_results" in scripts/profiling was to read
        from a pickled file with this name. Since no files write something with this name,
        the file genuinely does not exist.
…thin it.

Each of these files references a non-existent file named full_report_results.pkl.
The only hits for the string "full_report_results" in scripts/ is in these files,
so there aren't other files in the scripts/ folder that generate the
apparently-required full_report_results.pkl file. That means these scripts are
definitively broken.
…tant (recently removed) file scripts/profiling/gaugeopt/load.py
…t and distribute_for_dot) with incorrect arguments
… was removed in the last commit (due to being broken)
…hin it. One file just held environment variables (trivial) and the other referenced a non-existant (recently removed) file scripts/profiling/gaugeopt/load.py
…ched for the past 10 years. The contents strongly suggest they were CI infrastructure, abandoned since we moved to GitHub Actions
@rileyjmurray rileyjmurray requested review from a team as code owners May 5, 2026 23:22
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.

1 participant