Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve packaging #3459 #3761

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0a746f3
Switch to pyproject.toml using flot #3459
pombredanne Apr 26, 2024
e45c74b
Introduce new pyproject for packaged code #3459
pombredanne Apr 26, 2024
b13df3d
Split license data/indexin in new wheels #3459
pombredanne Apr 26, 2024
98cbc93
Add CHANGELOG for new packaging #3459
pombredanne Apr 26, 2024
f87d920
Use proper scripts for release #3459
pombredanne Apr 26, 2024
00b5f77
Add README.rst to license data packaging #3459
pombredanne Apr 26, 2024
1cd163b
Improve license data packaging #3459
pombredanne Apr 26, 2024
286c272
Ensure flot is always available #3459
pombredanne Apr 26, 2024
7fb0a10
No longer include license data #3459
pombredanne Apr 26, 2024
042d2d5
Adjust configure script to use flot #3459
pombredanne Apr 26, 2024
520685e
Do not include tests in builds #3459
pombredanne Apr 26, 2024
4860e92
Adjust release scripts for flot #3459
pombredanne Apr 26, 2024
d5f3569
Use explicit pyproject for ScanCode builds
pombredanne May 6, 2024
5c7bd64
Refine packagedcode packaging
pombredanne May 6, 2024
2b1d2e7
Refine packagedcode packaging
pombredanne May 6, 2024
80c72bc
Build only modesl in packagedcode
pombredanne May 6, 2024
064c646
Move packagedcode.__init__.py code to handlers.py
pombredanne May 7, 2024
70c5116
Split BSD-licensed code in own module
pombredanne May 7, 2024
7e0e5b5
Improve formattings and docstrings
pombredanne May 7, 2024
451d56a
Guard imports of external packages
pombredanne May 7, 2024
46cb7e8
Remove unused import
pombredanne May 7, 2024
8d780b7
Package packagedcode as two wheels
pombredanne May 7, 2024
94f32ce
Position comment before the commented section
pombredanne May 7, 2024
b33a6fc
Build scancode and packagedcode for Pypi
pombredanne May 7, 2024
c64d47d
Import prospectively license-expression
pombredanne May 7, 2024
383318a
Merge latest develop
pombredanne May 7, 2024
ff47535
Ensure all licensing usage are guarded
pombredanne May 7, 2024
3a04ec5
Update changelog for packagedcode
pombredanne May 7, 2024
67b7ef7
Document vendored flot
pombredanne May 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 50 additions & 44 deletions .github/workflows/scancode-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ on:
permissions: {}
jobs:

build_scancode_wheel_for_pypi:
build_scancode_wheels_for_pypi:
permissions:
contents: read # to fetch code (actions/checkout)

name: Build PyPI wheels
name: Build PyPI packages
runs-on: ubuntu-22.04

defaults:
Expand All @@ -34,7 +34,7 @@ jobs:
strategy:
fail-fast: true
matrix:
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"]
pyver: ["3.8"]

steps:
- uses: actions/checkout@v4
Expand All @@ -44,46 +44,14 @@ jobs:
with:
python-version: ${{ matrix.pyver }}

- name: Install requirements then build main and mini wheel
run: etc/release/scancode-create-pypi-wheel.sh

- name: Collect built wheels for ${{ matrix.pyver }}
uses: actions/upload-artifact@v3
with:
name: wheels-${{ matrix.pyver }}
path: dist/*.whl


build_scancode_sdist_for_pypi:
permissions:
contents: read # to fetch code (actions/checkout)

name: Build PyPI sdist archives
runs-on: ubuntu-22.04

defaults:
run:
shell: bash

strategy:
fail-fast: true

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install requirements then build all PyPI packages
run: etc/release/scancode-create-pypi-wheel-and-sdist.sh

- name: Install requirements then build main and mini sdist
run: etc/release/scancode-create-pypi-sdist.sh

- name: Collect built sdist
- name: Collect built wheels and dist
uses: actions/upload-artifact@v3
with:
name: sdists
path: dist/*.tar.gz
name: wheels
path: dist/*


build_scancode_for_release_linux:
Expand All @@ -93,6 +61,9 @@ jobs:
name: Build app Release for linux
runs-on: ubuntu-22.04

needs:
- build_scancode_wheels_for_pypi

defaults:
run:
shell: bash
Expand All @@ -110,6 +81,12 @@ jobs:
with:
python-version: ${{ matrix.pyver }}

- name: Download wheels artifact
uses: actions/download-artifact@v3
with:
name: wheels
path: dist

- name: Build linux app archive
run: etc/release/scancode-create-release-app-linux.sh ${{ matrix.pyver }}

Expand All @@ -127,6 +104,9 @@ jobs:
name: Build app Release for mac
runs-on: ubuntu-22.04

needs:
- build_scancode_wheels_for_pypi

defaults:
run:
shell: bash
Expand All @@ -137,13 +117,20 @@ jobs:
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:

- uses: actions/checkout@v4

- name: Set up Python on ${{ matrix.pyver }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.pyver }}

- name: Download wheels artifact
uses: actions/download-artifact@v3
with:
name: wheels
path: dist

- name: Build mac app archive
run: etc/release/scancode-create-release-app-macos.sh ${{ matrix.pyver }}

Expand All @@ -161,6 +148,9 @@ jobs:
name: Build app Release for windows
runs-on: ubuntu-22.04

needs:
- build_scancode_wheels_for_pypi

defaults:
run:
shell: bash
Expand All @@ -178,6 +168,12 @@ jobs:
with:
python-version: ${{ matrix.pyver }}

- name: Download wheels artifact
uses: actions/download-artifact@v3
with:
name: wheels
path: dist

- name: Build windows app archive
run: etc/release/scancode-create-release-app-windows.sh ${{ matrix.pyver }}

Expand All @@ -195,9 +191,13 @@ jobs:
name: Build app source
runs-on: ubuntu-22.04

needs:
- build_scancode_wheels_for_pypi

defaults:
run:
shell: bash

strategy:
fail-fast: true

Expand All @@ -209,6 +209,12 @@ jobs:
with:
python-version: "3.10"

- name: Download wheels artifact
uses: actions/download-artifact@v3
with:
name: wheels
path: dist

- name: Build source archive with deps
run: etc/release/scancode-create-release-app-sources.sh

Expand All @@ -235,7 +241,7 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ubuntu-22.04, ubuntu-22.04, macos-11, macos-12]
os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12]
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
Expand All @@ -249,7 +255,7 @@ jobs:
- name: Download wheels artifact
uses: actions/download-artifact@v3
with:
name: wheels-${{ matrix.pyver }}
name: wheels
path: dist

- name: test install wheels
Expand All @@ -258,7 +264,7 @@ jobs:
rm -rf venv; \
python -m venv venv
venv/bin/python -m pip install --upgrade pip wheel setuptools
for f in `find dist -type f -name "*${{ matrix.pyver }}*"`; \
for f in `find dist -type f -name "scancode*${{ matrix.pyver }}*"`; \
do \
venv/bin/python -m pip install --force-reinstall "$f[full]" ; \
venv/bin/scancode -clipeu --json-pp - some.file ; \
Expand Down Expand Up @@ -295,7 +301,7 @@ jobs:
- name: Download wheels artifact
uses: actions/download-artifact@v3
with:
name: wheels-${{ matrix.pyver }}
name: wheels
path: dist

- name: test install wheel
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Changelog
v33.0.0 (next next, roadmap)
----------------------------

- We changed the way licenses text are packaged to help creating smaller packages for publishing
on PyPI. If you relied on actual license text files present in the wheels, you will now need
to install the package scancode-toolkit[licenses] that will also contain the files. However, the
better and preferred way is to run the command line "scancode-license-data" that will create
a directory with all license files, and this works with all builds of scancode-toolkit.

- We now support new package manifest formats:

- OpenWRT packages.
Expand Down Expand Up @@ -34,7 +40,11 @@ v33.0.0 (next next, roadmap)
of these in other summary plugins.
See https://github.com/nexB/scancode-toolkit/issues/1745

v32.1.0 (next, roadmap)
- The Python API of the packagedcode module has changed. The package datafile "handlers" registry
that used to be in packagedcode/__init__.py has been moved to packagedcode/handlers.py


v32.1.0 2024-03-22
----------------------------

New CLI options:
Expand Down
21 changes: 8 additions & 13 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,12 @@ if [[ $OSTYPE == 'darwin'* ]]; then
fi

# Requirement arguments passed to pip and used by default or with --dev.
REQUIREMENTS="--editable $BASE --constraint requirements.txt --constraint requirements-linux.txt"
DEV_REQUIREMENTS="--editable $BASE_DEV --constraint requirements.txt --constraint requirements-linux.txt --constraint requirements-dev.txt"
DOCS_REQUIREMENTS="--editable .[docs] --constraint requirements.txt"
REL_REQUIREMENTS="--requirement etc/scripts/requirements.txt"
PROD_REQUIREMENTS="scancode_toolkit*.whl"
REQUIREMENTS="--no-build-isolation --editable $BASE --constraint requirements.txt --constraint requirements-linux.txt"
DEV_REQUIREMENTS="--no-build-isolation --editable $BASE_DEV --constraint requirements.txt --constraint requirements-linux.txt --constraint requirements-dev.txt"
DOCS_REQUIREMENTS="--no-build-isolation --editable .[docs] --constraint requirements.txt"
REL_REQUIREMENTS="--no-build-isolation --requirement etc/scripts/requirements.txt"
PROD_REQUIREMENTS="--no-build-isolation scancode_toolkit*.whl"
FLOT_REQUIREMENTS="etc/thirdparty/flot*.whl"

# where we create a virtualenv
VIRTUALENV_DIR=venv
Expand All @@ -175,16 +176,10 @@ CFG_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CFG_BIN_DIR=$CFG_ROOT_DIR/$VIRTUALENV_DIR/bin


################################
# Install with or without and index. With "--no-index" this is using only local wheels
# This is an offline mode with no index and no network operations
# NO_INDEX="--no-index "
NO_INDEX=""


################################
# Thirdparty package locations and index handling
# Find packages from the local thirdparty directory if present
# offline mode for scancode installation with no Pypi index at all
thirddir=$CFG_ROOT_DIR/thirdparty
if [[ "$(echo $thirddir/*.whl)x" != "$thirddir/*.whlx" ]]; then
PIP_EXTRA_ARGS="--no-index --find-links $CFG_ROOT_DIR/thirdparty"
Expand Down Expand Up @@ -257,7 +252,6 @@ install_packages() {

"$CFG_BIN_DIR/pip" install \
--upgrade \
--no-build-isolation \
$CFG_QUIET \
$PIP_EXTRA_ARGS \
$1
Expand Down Expand Up @@ -320,6 +314,7 @@ PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS"

find_python
create_virtualenv "$VIRTUALENV_DIR"
install_packages "$FLOT_REQUIREMENTS"
install_packages "$CFG_REQUIREMENTS"
. "$CFG_BIN_DIR/activate"

Expand Down
20 changes: 14 additions & 6 deletions configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@
@rem ################################

@rem # Requirement arguments passed to pip and used by default or with --dev.
set "REQUIREMENTS=--editable . --constraint requirements.txt"
set "DEV_REQUIREMENTS=--editable .[testing] --constraint requirements.txt --constraint requirements-dev.txt"
set "DOCS_REQUIREMENTS=--editable .[docs] --constraint requirements.txt"
set "REL_REQUIREMENTS=--requirement etc/scripts/requirements.txt"
set "REQUIREMENTS=--no-build-isolation --editable . --constraint requirements.txt"
set "DEV_REQUIREMENTS=--no-build-isolation --editable .[testing] --constraint requirements.txt --constraint requirements-dev.txt"
set "DOCS_REQUIREMENTS=--no-build-isolation --editable .[docs] --constraint requirements.txt"
set "REL_REQUIREMENTS=--no-build-isolation --requirement etc/scripts/requirements.txt"
set "PROD_REQUIREMENTS=--no-build-isolation scancode_toolkit*.whl"
set "FLOT_REQUIREMENTS=etc/thirdparty/flot*.whl"


@rem # where we create a virtualenv
set "VIRTUALENV_DIR=venv"
Expand All @@ -54,7 +57,7 @@ set "CFG_BIN_DIR=%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts"
@rem ################################
@rem # Thirdparty package locations and index handling
@rem # Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
@rem # offline mode for scancode installation with no index at all
@rem # offline mode for scancode installation with no Pypi index at all
if exist "%CFG_ROOT_DIR%\thirdparty" (
set PIP_EXTRA_ARGS=--no-index --find-links "%CFG_ROOT_DIR%\thirdparty"
for %%i in (scancode_toolkit*.whl) do set "CFG_REQUIREMENTS=%CFG_ROOT_DIR%\%%i[full]"
Expand Down Expand Up @@ -164,7 +167,12 @@ if %ERRORLEVEL% neq 0 (

"%CFG_BIN_DIR%\pip" install ^
--upgrade ^
--no-build-isolation ^
%CFG_QUIET% ^
%PIP_EXTRA_ARGS% ^
%FLOT_REQUIREMENTS%

"%CFG_BIN_DIR%\pip" install ^
--upgrade ^
%CFG_QUIET% ^
%PIP_EXTRA_ARGS% ^
%CFG_REQUIREMENTS%
Expand Down
34 changes: 0 additions & 34 deletions etc/release/scancode-create-pypi-sdist.sh

This file was deleted.

Loading
Loading