aboutcode-org / aboutcode-org/scancode-toolkit

Handling of run-specific temporary directories when using as library

Đang mở
#3,431 3 bình luận 2 reaction 0 người được giao Xem trên GitHub
new feature
Ngôn ngữ chính
Python
Star
2.6k
Fork
791
Merge trung bình
1 ngày 12 giờ
Pull request đã merge (30 ngày)
5

Mô tả

## Short Description

Running *scancode* as a library will generate run-specific temporary directories, which are never cleaned up.

## Possible Labels

- new feature

## Select Category

- [X] Enhancement
- [ ] Add License/Copyright
- [ ] Scan Feature
- [ ] Packaging
- [ ] Documentation
- [ ] Expand Support
- [ ] Other

## **Describe the Update**

There is a documented/automated way to clean the temporary directories after each run (or it happens automatically) as soon as they are not used any more.

## **How This Feature will help you/your organization**

Writing custom wrappers around *scancode* functionality without using the CLI requires manual cleanup of temporary directories, which seems to be undocumented and might unnecessarily use/block space on the hard drive.

## **Possible Solution/Implementation Details**

There should be clear documentation for the public(?) API in `scancode.api` that manual cleanup as in https://github.com/nexB/scancode-toolkit/blob/a29ae817d95296146ba8ac5bd94ed043d541cdc6/src/scancode/cli.py#L1021-L1035 is required.

Alternatively, *scancode* should automatically register the corresponding directories for cleanup during exit or provide a corresponding context manager to simplify usage.

## **Example/Links if Any**

I am currently using `atexit.register(fileutils.delete, scancode_config.scancode_temp_dir)` in every parallel processing unit after noticing the behavior.

## **Can you help with this Feature**

Maybe. I am not sure about general use cases, but for now *scancode* does not seem to have any explicit documentation on library usage or on a public API anyway.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.