Skip to content

Commit ce4cae0

Browse files
authored
Upgrade Django to version 5.0.0 #1020 (#1021)
* Upgrade multiple dependencies to latest version #1020 Signed-off-by: tdruez <tdruez@nexb.com> * Upgrade Django to version 5.0.0 #1020 Signed-off-by: tdruez <tdruez@nexb.com> * Upgrade the virtualenv package #1020 Signed-off-by: tdruez <tdruez@nexb.com> * Fix some DeprecationWarning #1020 Signed-off-by: tdruez <tdruez@nexb.com> * Remove support for Python 3.8 and 3.9 #1020 Signed-off-by: tdruez <tdruez@nexb.com> * Migrate to POST-only logout view #1020 Signed-off-by: tdruez <tdruez@nexb.com> * Silent the warning about DB access during app initialization #1020 Signed-off-by: tdruez <tdruez@nexb.com> * Fix failing test #1020 Signed-off-by: tdruez <tdruez@nexb.com> * Add changelog entry #1020 Signed-off-by: tdruez <tdruez@nexb.com> * Fix the python_inspector import reference #1020 Signed-off-by: tdruez <tdruez@nexb.com> * Improve unit test support across OSes #1020 Signed-off-by: tdruez <tdruez@nexb.com> --------- Signed-off-by: tdruez <tdruez@nexb.com>
1 parent e7cfcda commit ce4cae0

19 files changed

Lines changed: 84 additions & 76 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
strategy:
3232
max-parallel: 4
3333
matrix:
34-
python-version: ["3.8", "3.9", "3.10", "3.11"]
34+
python-version: ["3.10", "3.11"]
3535

3636
steps:
3737
- name: Checkout code

CHANGELOG.rst

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

4-
v32.8.0 (unreleased)
4+
v33.0.0 (unreleased)
55
--------------------
66

7+
- Upgrade Django to version 5.0 and drop support for Python 3.8 and 3.9
8+
https://github.com/nexB/scancode.io/issues/1020
9+
710
- Refactor run_scancode to not fail on scan errors happening at the resource level,
811
such as a timeout. Project error message are created instead.
912
https://github.com/nexB/scancode.io/issues/1018

docs/custom-pipelines.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ the entry point to the pipeline under the ``[options.entry_points]`` section.
240240
packages=find:
241241
include_package_data = true
242242
zip_safe = false
243-
python_requires = >=3.8
243+
python_requires = >=3.10
244244
setup_requires = setuptools_scm[toml] >= 4
245245
246246
[options.packages.find]

docs/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ Pre-installation Checklist
224224

225225
Before you install ScanCode.io, make sure you have the following prerequisites:
226226

227-
* **Python: versions 3.8 to 3.11** found at https://www.python.org/downloads/
227+
* **Python: versions 3.10 to 3.11** found at https://www.python.org/downloads/
228228
* **Git**: most recent release available at https://git-scm.com/
229229
* **PostgreSQL**: release 11 or later found at https://www.postgresql.org/ or
230230
https://postgresapp.com/ on macOS

etc/thirdparty/virtualenv.pyz

13.7 KB
Binary file not shown.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
about_resource: virtualenv.pyz
22
name: get-virtualenv
3-
version: 20.24.6
4-
download_url: https://github.com/pypa/get-virtualenv/raw/20.24.6/public/virtualenv.pyz
3+
version: 20.25.0
4+
download_url: https://github.com/pypa/get-virtualenv/raw/20.25.0/public/virtualenv.pyz
55
description: virtualenv is a tool to create isolated Python environments.
66
homepage_url: https://github.com/pypa/virtualenv
77
license_expression: lgpl-2.1-plus AND (bsd-new OR apache-2.0) AND mit AND python AND bsd-new
@@ -10,4 +10,4 @@ copyright: Copyright (c) The Python Software Foundation and others
1010
redistribute: yes
1111
attribute: yes
1212
track_changes: yes
13-
package_url: pkg:github/pypa/get-virtualenv@20.24.6#public/virtualenv.pyz
13+
package_url: pkg:github/pypa/get-virtualenv@20.25.0#public/virtualenv.pyz

scanpipe/apps.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import inspect
2424
import logging
2525
import sys
26+
import warnings
2627
from importlib.machinery import SourceFileLoader
2728
from pathlib import Path
2829

@@ -74,6 +75,12 @@ def ready(self):
7475
# before its running process death.
7576
# In ASYNC mode, the cleanup is handled by the "ScanCodeIOWorker" worker.
7677
if not settings.SCANCODEIO_ASYNC and "runserver" in sys.argv:
78+
warnings.filterwarnings(
79+
"ignore",
80+
message="Accessing the database during app initialization",
81+
category=RuntimeWarning,
82+
module="django",
83+
)
7784
self.sync_runs_and_jobs()
7885

7986
def load_pipelines(self):
@@ -82,9 +89,7 @@ def load_pipelines(self):
8289
pipelines Python files found at `SCANCODEIO_PIPELINES_DIRS` locations.
8390
"""
8491
entry_points = importlib_metadata.entry_points()
85-
86-
# Ignore duplicated entries caused by duplicated paths in `sys.path`.
87-
pipeline_entry_points = set(entry_points.get("scancodeio_pipelines"))
92+
pipeline_entry_points = set(entry_points.select(group="scancodeio_pipelines"))
8893

8994
for entry_point in sorted(pipeline_entry_points):
9095
self.register_pipeline(name=entry_point.name, cls=entry_point.load())

scanpipe/pipes/__init__.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -302,19 +302,6 @@ def get_bin_executable(filename):
302302
return str(Path(sys.executable).parent / filename)
303303

304304

305-
def remove_prefix(text, prefix):
306-
"""
307-
Remove the `prefix` from `text`.
308-
Note that build-in `removeprefix` was added in Python3.9 but we need to keep
309-
this one for Python3.8 support.
310-
https://docs.python.org/3.9/library/stdtypes.html#str.removeprefix
311-
"""
312-
if text.startswith(prefix):
313-
prefix_len = len(prefix)
314-
return text[prefix_len:]
315-
return text
316-
317-
318305
class LoopProgress:
319306
"""
320307
A context manager for logging progress in loops.

scanpipe/pipes/d2d.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,8 @@ def flag_whitespace_files(project):
14021402
whitespace_set = set(b" \n\r\t\f\b")
14031403

14041404
for resource in resources:
1405-
binary_data = open(resource.location, "rb").read()
1405+
with open(resource.location, "rb") as f:
1406+
binary_data = f.read()
14061407
binary_set = set(binary_data)
14071408
non_whitespace_bytes = binary_set - whitespace_set
14081409

scanpipe/pipes/resolve.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from packagedcode import APPLICATION_PACKAGE_DATAFILE_HANDLERS
3131
from packagedcode.licensing import get_license_detections_and_expression
3232
from packageurl import PackageURL
33-
from python_inspector.resolve_cli import resolver_api
33+
from python_inspector.api import resolve_dependencies
3434
from scancode.api import get_package_data
3535

3636
from scanpipe.models import DiscoveredPackage
@@ -64,7 +64,7 @@ def resolve_pypi_packages(input_location):
6464
python_version = f"{sys.version_info.major}{sys.version_info.minor}"
6565
operating_system = "linux"
6666

67-
inspector_output = resolver_api(
67+
inspector_output = resolve_dependencies(
6868
requirement_files=[input_location],
6969
python_version=python_version,
7070
operating_system=operating_system,

0 commit comments

Comments
 (0)