aboutcode-org / aboutcode-org/scancode-toolkit

Compatibility with pathlib

未关闭
#3,925 0 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
new feature
主要语言
Python
星标
2.6k
派生
791
平均合并
1 天 12 小时
30 天内合并 PR
5

描述

## Short Description

SCTK should support proper path objects instead of relying on string operations for paths.

## Possible Labels

- new feature
- enhancement

## Select Category

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

## **Describe the Update**

SCTK and its sister projects currently tend to mostly rely on all paths being passed as strings. The stdlib includes the `pathlib` module which provides a proper wrapper for working with paths.

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

I am a consumer of the Python-level APIs provided by SCTK and its sister projects inside my own libraries/modules, widely relying on `pathlib.Path` for working with paths. When working on new integrations, I regularly stumble upon SCTK code which strictly expects strings and thus requires a conversion each time.

## **Possible Solution/Implementation Details**

SCTK should either support both variants properly or make object-oriented paths a first-level citizen.

## **Example/Links if Any**

My most recent encounter has been with `licensedcode.models.ignore_editor_tmp_files` where the file extension is being checked with `.endswith()`.

There already have been some discussions in #1610 and #1637 in the past, but there have been doubts about parallel compatibility for Python 2 and 3. As Python 2 is EOL for over four years now, this should not be an issue anymore. The topic is slightly related to #3487 as well - if tend to see myself searching for the correct types to pass to functions from time to time.

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

This topic covers large parts of the code base and probably should be discussed beforehand to decide how to go with it. Depending on my workload, I might be able to support with this.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。