FileBasedPackageRepository cache clean-up

SyntaxEditor Python Language Add-on for WPF Forum

The latest build of this product (v26.1.1) was released 10 days ago, which was before this thread was created.
Posted 2 days ago by Shaun Gannon
Version: 25.1.4
Avatar

Hi,

I'm using the Python Language Add-on for WPF and have a question about managing the FileBasedPackageRepository cache.

In my application, I have quite a few Python packages in the search paths. After a typical run, the cache contains approximately 3,800 files and occupies around 100 MB. The cache appears stable between application runs, which is good.

However, I'm wondering what happens when the underlying Python environment changes.

Specifically:

  1. When a Python package is upgraded to a newer version, does FileBasedPackageRepository automatically invalidate and remove the cached reflection data associated with the old version?
  2. If a package is uninstalled, does the repository automatically remove its cached data?
  3. Is there an automatic cache cleanup or pruning mechanism?
  4. If obsolete cache data can accumulate, is there a recommended way to periodically clean it up?

I noticed that the .NET FileBasedAssemblyRepository provides a PruneCache() method, but I couldn't find an equivalent method on the Python FileBasedPackageRepository.

Thanks for any guidance!

Comments (1)

Answer - Posted 2 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Shaun,

When search paths are added to a Python project, cache updates are queued to check for changes. If a package changes at the same path, its existing cache file is regenerated. Cache files for removed packages or old directory paths are not automatically deleted, so obsolete files can accumulate.

We will add a FileBasedPackageRepository.PruneCache method for the next release, following the .NET repository's approach. It will remove cache files with invalid metadata, missing source directories, or changed package contents, while preserving valid entries. You could call it periodically, such as at startup before adding search paths, or at shutdown. That will be the recommended way to clean up cache files moving forward.

For existing versions, you can clear the application's dedicated cache folder before initializing the Python language services. The cache will be rebuilt as the search paths are processed, but there will be a small delay in IntelliPrompt results as the cache files are built up again.


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.