Skip to content

Commit cce65c7

Browse files
committed
Merge remote-tracking branch 'upstream/main' into clarity-compliance-integration
2 parents 9732f91 + 953c91b commit cce65c7

File tree

84 files changed

+29383
-24485
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+29383
-24485
lines changed

CHANGELOG.rst

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,35 @@
11
Changelog
22
=========
33

4-
v35.1.0 (unreleased)
4+
v35.2.0 (unreleased)
55
--------------------
66

7+
- Refactor policies implementation to support more than licenses.
8+
The entire ``policies`` data is now stored on the ``ScanPipeConfig`` in place of the
9+
``license_policy_index``.
10+
Also, a new method ``get_policies_dict`` methods is now available on the ``Project``
11+
model to easily retrieve all the policies data as a dictionary.
12+
Renamed for clarity:
13+
* ``policy_index`` to ``license_policy_index``
14+
* ``policies_enabled`` to ``license_policies_enabled``
15+
https://github.com/aboutcode-org/scancode.io/pull/1718
16+
17+
- Add support for SPDX license identifiers as ``license_key`` in license policies
18+
``policies.yml`` file.
19+
https://github.com/aboutcode-org/scancode.io/issues/1348
20+
21+
v35.1.0 (2025-07-02)
22+
--------------------
23+
24+
- Replace the ``setup.py``/``setup.cfg`` by ``pyproject.toml`` file.
25+
https://github.com/aboutcode-org/scancode.io/issues/1608
26+
27+
- Update scancode-toolkit to v32.4.0. See CHANGELOG for updates:
28+
https://github.com/aboutcode-org/scancode-toolkit/releases/tag/v32.4.0
29+
Adds a new ``git_sha1`` attribute to the ``CodebaseResource`` model as this
30+
is now computed and returned from the ``scancode-toolkit`` ``--info`` plugin.
31+
https://github.com/aboutcode-org/scancode.io/pull/1708
32+
733
- Add a ``--fail-on-vulnerabilities`` option in ``check-compliance`` management command.
834
When this option is enabled, the command will exit with a non-zero status if known
935
vulnerabilities are detected in discovered packages and dependencies.
@@ -16,6 +42,10 @@ v35.1.0 (unreleased)
1642
license rules used during the scan.
1743
https://github.com/aboutcode-org/scancode.io/issues/1657
1844

45+
- Add a new step to the ``DeployToDevelop`` pipeline, ``map_python``, to match
46+
Cython source files (.pyx) to their compiled binaries.
47+
https://github.com/aboutcode-org/scancode.io/pull/1703
48+
1949
v35.0.0 (2025-06-23)
2050
--------------------
2151

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ RUN mkdir -p /var/$APP_NAME/static/ \
8787
&& mkdir -p /var/$APP_NAME/workspace/
8888

8989
# Install the dependencies before the codebase COPY for proper Docker layer caching
90-
COPY --chown=$APP_USER:$APP_USER setup.cfg setup.py $APP_DIR/
90+
COPY --chown=$APP_USER:$APP_USER pyproject.toml $APP_DIR/
9191
RUN pip install --no-cache-dir .
9292

9393
# Copy the codebase and set the proper permissions for the APP_USER

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,6 @@ docs:
143143
rm -rf docs/_build/
144144
@${ACTIVATE} sphinx-build docs/ docs/_build/
145145

146-
bump:
147-
@echo "-> Bump the version"
148-
@${ACTIVATE} bumpver update --no-fetch --patch
149-
150146
docker-images:
151147
@echo "-> Build Docker services"
152148
docker compose build
@@ -163,4 +159,4 @@ offline-package: docker-images
163159
@mkdir -p dist/
164160
@tar -cf dist/scancodeio-offline-package-`git describe --tags`.tar build/
165161

166-
.PHONY: virtualenv conf dev envfile install doc8 check valid check-deploy clean migrate upgrade postgresdb sqlitedb backupdb run run-docker-dev test fasttest docs bump docker-images offline-package
162+
.PHONY: virtualenv conf dev envfile install doc8 check valid check-deploy clean migrate upgrade postgresdb sqlitedb backupdb run run-docker-dev test fasttest docs docker-images offline-package

RELEASE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
- Create a new `release-x.x.x` branch
66
- Update the version in:
7-
- `setup.cfg` (2 entries)
7+
- `pyproject.toml`
88
- `scancodeio/__init__.py`
99
- `CHANGELOG.rst` (set date)
1010
- Commit and push this branch
@@ -24,7 +24,7 @@
2424
```
2525
cd scancode.io
2626
source .venv/bin/activate
27-
pip install build
27+
python -m pip install build
2828
python -m build --sdist --wheel --outdir dist/ .
2929
```
3030

docs/introduction.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ The **Django framework** is leveraged for many aspects of ScanCode.io:
9191

9292
.. note::
9393
Multiple applications from the Django eco-system are also included,
94-
see the `setup.cfg <https://github.com/aboutcode-org/scancode.io/blob/main/setup.cfg>`_ file
95-
for an exhaustive list of dependencies.
94+
see the `pyproject.toml <https://github.com/aboutcode-org/scancode.io/blob/main/pyproject.toml>`_
95+
file for an exhaustive list of dependencies.
9696

9797
The second essential part of ScanCode.io is the **ScanCode Toolkit**, which is used
9898
for archives extraction and as the scanning engine.

docs/policies.rst

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,39 @@ structure similar to the following:
2020
- license_key: mit
2121
label: Approved License
2222
compliance_alert: ''
23+
2324
- license_key: mpl-2.0
2425
label: Restricted License
2526
compliance_alert: warning
27+
2628
- license_key: gpl-3.0
2729
label: Prohibited License
2830
compliance_alert: error
2931
30-
- In the example above, licenses are referenced by the ``license_key``,
31-
such as `mit` and `gpl-3.0`, which represent the ScanCode license keys used to
32-
match against licenses detected in scan results.
33-
- Each policy is defined with a ``label`` and a ``compliance_alert``.
34-
You can customize the labels as desired.
35-
- The ``compliance_alert`` field accepts three values:
32+
- license_key: OFL-1.1
33+
compliance_alert: warning
34+
35+
- license_key: LicenseRef-scancode-public-domain
36+
compliance_alert: ''
37+
38+
- license_key: LicenseRef-scancode-unknown-license-reference
39+
compliance_alert: error
40+
41+
- In the example above, licenses are referenced using the ``license_key`` field.
42+
These keys can be either **ScanCode license identifiers** (e.g., "mit", "gpl-3.0"),
43+
or **SPDX license identifiers** (e.g., "OFL-1.1",
44+
"LicenseRef-scancode-public-domain").
45+
These values are used to match against the licenses detected in scan results.
46+
47+
- Each policy entry includes a ``label`` and a ``compliance_alert`` field.
48+
The ``label`` is a customizable description used for display or reporting purposes.
49+
50+
- The ``compliance_alert`` field determines the severity level for a license and
51+
supports the following values:
3652

37-
- ``''`` (empty string)
38-
- ``warning``
39-
- ``error``
53+
- ``''`` (empty string) — No action needed; the license is approved.
54+
- ``warning`` — Use with caution; the license may have some restrictions.
55+
- ``error`` — The license is prohibited or incompatible with your policy.
4056

4157
Creating Clarity Thresholds Files
4258
---------------------------------

docs/rest-api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ File content
556556
This displays the content of a ``project`` file resource provided using the
557557
``?path=<resource_path>`` argument.
558558

559-
``GET /api/projects/d4ed9405-5568-45ad-99f6-782a9b82d1d2/file_content/?path=setup.py``
559+
``GET /api/projects/d4ed9405-5568-45ad-99f6-782a9b82d1d2/file_content/?path=filename.ext``
560560

561561
.. code-block:: json
562562

pyproject.toml

Lines changed: 156 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,156 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "scancodeio"
7+
version = "35.1.0"
8+
description = "Automate software composition analysis pipelines"
9+
readme = "README.rst"
10+
requires-python = ">=3.10,<3.14"
11+
license = "Apache-2.0"
12+
license-files = ["LICENSE", "NOTICE", "scan.NOTICE"]
13+
authors = [
14+
{ name = "nexB Inc.", email = "[email protected]" }
15+
]
16+
keywords = [
17+
"open source", "scan", "license", "package", "dependency",
18+
"copyright", "filetype", "author", "extract", "licensing",
19+
"scancode", "scanpipe", "docker", "rootfs", "vm",
20+
"virtual machine", "pipeline", "code analysis", "container"
21+
]
22+
classifiers = [
23+
"Development Status :: 5 - Production/Stable",
24+
"Intended Audience :: Developers",
25+
"Intended Audience :: Information Technology",
26+
"Intended Audience :: Legal Industry",
27+
"Programming Language :: Python",
28+
"Programming Language :: Python :: 3 :: Only",
29+
"Programming Language :: Python :: 3.10",
30+
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12",
32+
"Programming Language :: Python :: 3.13",
33+
"Topic :: Utilities"
34+
]
35+
dependencies = [
36+
"importlib-metadata==8.7.0",
37+
"setuptools==80.9.0",
38+
# Django related
39+
"Django==5.1.11",
40+
"django-environ==0.12.0",
41+
"django-crispy-forms==2.4",
42+
"crispy-bootstrap3==2024.1",
43+
"django-filter==25.1",
44+
"djangorestframework==3.16.0",
45+
"django-taggit==6.1.0",
46+
# Database
47+
"psycopg[binary]==3.2.9",
48+
# wait_for_database Django management command
49+
"django-probes==1.7.0",
50+
# Task queue
51+
"rq==2.4.0",
52+
"django-rq==3.0.1",
53+
"redis==6.2.0",
54+
# WSGI server
55+
"gunicorn==23.0.0",
56+
# Docker
57+
"container-inspector==33.0.0",
58+
# ScanCode-toolkit
59+
"scancode-toolkit[packages]==32.4.0",
60+
"extractcode[full]==31.0.0",
61+
"commoncode==32.3.0",
62+
"Beautifulsoup4[chardet]==4.13.4",
63+
"packageurl-python==0.17.1",
64+
# FetchCode
65+
"fetchcode-container==1.2.3.210512; sys_platform == 'linux'",
66+
# Inspectors
67+
"elf-inspector==0.0.3",
68+
"go-inspector==0.5.0",
69+
"rust-inspector==0.1.0",
70+
"binary-inspector==0.1.2",
71+
"python-inspector==0.14.0",
72+
"source-inspector==0.7.0; sys_platform != 'darwin' and platform_machine != 'arm64'",
73+
"aboutcode-toolkit==11.1.1",
74+
# Utilities
75+
"XlsxWriter==3.2.5",
76+
"openpyxl==3.1.5",
77+
"requests==2.32.4",
78+
"GitPython==3.1.44",
79+
# Profiling
80+
"pyinstrument==5.0.2",
81+
# CycloneDX
82+
"cyclonedx-python-lib==10.2.0",
83+
"jsonschema==4.24.0",
84+
# MatchCode-toolkit
85+
"matchcode-toolkit==7.2.2",
86+
# Univers
87+
"univers==31.0.0",
88+
# Markdown
89+
"markdown-it-py==3.0.0",
90+
"bleach==6.2.0",
91+
# Antivirus
92+
"clamd==1.0.2",
93+
# FederatedCode
94+
"aboutcode.hashid==0.2.0",
95+
# AboutCode pipeline
96+
"aboutcode.pipeline==0.2.1",
97+
"scipy==1.15.3"
98+
]
99+
100+
[project.optional-dependencies]
101+
dev = [
102+
# Validation
103+
"ruff==0.12.0",
104+
"doc8==2.0.0",
105+
# Debug
106+
"django-debug-toolbar==5.2.0",
107+
# Documentation
108+
"Sphinx==8.1.3",
109+
"sphinx-rtd-theme==3.0.2",
110+
"sphinx-rtd-dark-mode==1.3.0",
111+
"sphinxcontrib-django==2.5",
112+
]
113+
android_analysis = [
114+
"android_inspector==0.0.1"
115+
]
116+
117+
[project.urls]
118+
Homepage = "https://github.com/aboutcode-org/scancode.io"
119+
Documentation = "https://scancodeio.readthedocs.io/"
120+
Repository = "https://github.com/aboutcode-org/scancode.io.git"
121+
Issues = "https://github.com/aboutcode-org/scancode.io/issues"
122+
Changelog = "https://github.com/aboutcode-org/scancode.io/blob/main/CHANGELOG.rst"
123+
124+
[project.scripts]
125+
scanpipe = "scancodeio:command_line"
126+
run = "scancodeio:combined_run"
127+
128+
[project.entry-points."scancodeio_pipelines"]
129+
analyze_docker_image = "scanpipe.pipelines.analyze_docker:Docker"
130+
analyze_root_filesystem_or_vm_image = "scanpipe.pipelines.analyze_root_filesystem:RootFS"
131+
analyze_windows_docker_image = "scanpipe.pipelines.analyze_docker_windows:DockerWindows"
132+
collect_strings_gettext = "scanpipe.pipelines.collect_strings_gettext:CollectStringsGettext"
133+
collect_symbols_ctags = "scanpipe.pipelines.collect_symbols_ctags:CollectSymbolsCtags"
134+
collect_symbols_pygments = "scanpipe.pipelines.collect_symbols_pygments:CollectSymbolsPygments"
135+
collect_symbols_tree_sitter = "scanpipe.pipelines.collect_symbols_tree_sitter:CollectSymbolsTreeSitter"
136+
enrich_with_purldb = "scanpipe.pipelines.enrich_with_purldb:EnrichWithPurlDB"
137+
find_vulnerabilities = "scanpipe.pipelines.find_vulnerabilities:FindVulnerabilities"
138+
inspect_elf_binaries = "scanpipe.pipelines.inspect_elf_binaries:InspectELFBinaries"
139+
inspect_packages = "scanpipe.pipelines.inspect_packages:InspectPackages"
140+
load_inventory = "scanpipe.pipelines.load_inventory:LoadInventory"
141+
load_sbom = "scanpipe.pipelines.load_sbom:LoadSBOM"
142+
map_deploy_to_develop = "scanpipe.pipelines.deploy_to_develop:DeployToDevelop"
143+
match_to_matchcode = "scanpipe.pipelines.match_to_matchcode:MatchToMatchCode"
144+
populate_purldb = "scanpipe.pipelines.populate_purldb:PopulatePurlDB"
145+
publish_to_federatedcode = "scanpipe.pipelines.publish_to_federatedcode:PublishToFederatedCode"
146+
resolve_dependencies = "scanpipe.pipelines.resolve_dependencies:ResolveDependencies"
147+
scan_codebase = "scanpipe.pipelines.scan_codebase:ScanCodebase"
148+
scan_for_virus = "scanpipe.pipelines.scan_for_virus:ScanForVirus"
149+
scan_single_package = "scanpipe.pipelines.scan_single_package:ScanSinglePackage"
150+
151+
[tool.setuptools.packages.find]
152+
where = ["."]
153+
1154
[tool.ruff]
2155
line-length = 88
3156
extend-exclude = ["migrations", "var"]
@@ -11,9 +164,12 @@ select = [
11164
"D", # pydocstyle
12165
"F", # Pyflakes
13166
"UP", # pyupgrade
167+
"DJ", # flake8-django
14168
"S", # flake8-bandit
15169
"I", # isort
16170
"C9", # McCabe complexity
171+
"FIX", # flake8-fix
172+
"FURB", # refurb
17173
]
18174
ignore = ["D1", "D203", "D205", "D212", "D400", "D415"]
19175

@@ -35,6 +191,5 @@ max-complexity = 10
35191
[tool.ruff.lint.per-file-ignores]
36192
# Allow the usage of assert in the test_spdx file.
37193
"**/test_spdx.py*" = ["S101"]
38-
"scanpipe/pipes/spdx.py" = ["UP006", "UP035"]
39194
# Allow complexity in management commands
40195
"scanpipe/management/commands/*" = ["C901"]

scancodeio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
import git
3030

31-
VERSION = "35.0.0"
31+
VERSION = "35.1.0"
3232

3333
PROJECT_DIR = Path(__file__).resolve().parent
3434
ROOT_DIR = PROJECT_DIR.parent

scancodeio/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@
292292
SCANCODEIO_WORKSPACE_LOCATION = tempfile.mkdtemp()
293293
SCANCODEIO_REQUIRE_AUTHENTICATION = True
294294
SCANCODEIO_SCAN_FILE_TIMEOUT = 120
295+
SCANCODEIO_POLICIES_FILE = None
295296
# The default password hasher is rather slow by design.
296297
# Using a faster hashing algorithm in the testing context to speed up the run.
297298
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]

0 commit comments

Comments
 (0)