From e8d8ccf5406521a0ee097724c80ae95e666181d7 Mon Sep 17 00:00:00 2001 From: stonebig Date: Sun, 6 Jul 2025 16:15:59 +0200 Subject: [PATCH 1/4] clean-up no-more-used modules and create_installer option --- generate_a_winpython_distro.bat | 2 +- make.py | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/generate_a_winpython_distro.bat b/generate_a_winpython_distro.bat index 522a5239..0b64a596 100644 --- a/generate_a_winpython_distro.bat +++ b/generate_a_winpython_distro.bat @@ -61,7 +61,7 @@ call %my_buildenv%\scripts\env.bat REM Create basic build infrastructure echo "(%date% %time%) Create basic build infrastructure">>%my_archive_log% -python.exe -c "from make import *;make_all(%my_release%, '%my_release_level%', basedir_wpy=r'%my_WINPYDIRBASE%', verbose=True, flavor='%my_flavor%', install_options=r'%my_install_options%', find_links=r'%my_find_links%', source_dirs=r'%my_source_dirs%', toolsdirs=r'%my_toolsdirs%', create_installer='False')">>%my_archive_log% +python.exe -c "from make import *;make_all(%my_release%, '%my_release_level%', basedir_wpy=r'%my_WINPYDIRBASE%', verbose=True, flavor='%my_flavor%', install_options=r'%my_install_options%', find_links=r'%my_find_links%', source_dirs=r'%my_source_dirs%', toolsdirs=r'%my_toolsdirs%')">>%my_archive_log% REM Check infrastructure is in place echo "(%date% %time%) Check infrastructure">>%my_archive_log% diff --git a/make.py b/make.py index 43c48175..bb76c605 100644 --- a/make.py +++ b/make.py @@ -9,10 +9,8 @@ import os import re import shutil -import subprocess -import sys from pathlib import Path -from wppm import wppm, utils, diff +from wppm import wppm, utils # Define constant paths for clarity PORTABLE_DIRECTORY = Path(__file__).parent / "portable" @@ -183,7 +181,7 @@ def build(self, rebuild: bool = True, winpy_dir: Path = None): self.distribution.patch_standard_packages(package_name) def make_all(build_number: int, release_level: str, basedir_wpy: Path = None, - verbose: bool = False, rebuild: bool = True, create_installer: str = "True", install_options=["--no-index"], + verbose: bool = False, rebuild: bool = True, install_options=["--no-index"], flavor: str = "", find_links: str | list[Path] = None, source_dirs: Path = None, toolsdirs: str | list[Path] = None, ): @@ -195,7 +193,6 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None, basedir_wpy: top directory of the build (c:\...\Wpy...) verbose: Enable verbose output (bool). rebuild: Whether to rebuild the distribution (bool). - create_installer: Type of installer to create (str). install_options: pip options (r'--no-index --pre --trusted-host=None') flavor: WinPython flavor (str). find_links: package directories (r'D:\Winpython\packages.srcreq') From 5633e31f33b76ff065b9d2ee44ee1792683498e1 Mon Sep 17 00:00:00 2001 From: stonebig Date: Sun, 6 Jul 2025 17:13:19 +0200 Subject: [PATCH 2/4] remove no-more-used markdown property and rebuild flag --- make.py | 61 +++++++++++++++++++++------------------------------------ 1 file changed, 22 insertions(+), 39 deletions(-) diff --git a/make.py b/make.py index bb76c605..445b8d1d 100644 --- a/make.py +++ b/make.py @@ -14,7 +14,6 @@ # Define constant paths for clarity PORTABLE_DIRECTORY = Path(__file__).parent / "portable" -NODEJS_RELATIVE_PATH = "n" # Relative path within WinPython dir # Ensure necessary directories exist at the start assert PORTABLE_DIRECTORY.is_dir(), f"Portable directory not found: {PORTABLE_DIRECTORY}" @@ -81,17 +80,6 @@ def _get_python_zip_file(self) -> Path: return source_item raise RuntimeError(f"Could not find Python zip package in {self.wheels_directory}") - @property - def package_index_markdown(self) -> str: - """Generates a Markdown formatted package index page.""" - return self.distribution.generate_package_index_markdown( - self.python_executable_directory, - self.winpyver2, - self.flavor, - self.architecture_bits, - self.release_level - ) - @property def winpython_version_name(self) -> str: """Returns the full WinPython version string.""" @@ -150,38 +138,36 @@ def _create_initial_batch_scripts(self): with open(self.winpython_directory / "scripts" / "env.ini", "w") as f: f.writelines([f'{a}={b}\n' for a, b in init_variables]) - def build(self, rebuild: bool = True, winpy_dir: Path = None): + def build(self, winpy_dir: Path = None): """Make or finalise WinPython distribution in the target directory""" print(f"Building WinPython with Python archive: {self.python_zip_file.name}") if winpy_dir is None: raise RuntimeError("WinPython base directory to create is undefined") self.winpython_directory = winpy_dir - if rebuild: - self._print_action(f"Creating WinPython {self.winpython_directory} base directory") - if self.winpython_directory.is_dir(): - shutil.rmtree(self.winpython_directory) - os.makedirs(self.winpython_directory, exist_ok=True) - # preventive re-Creation of settings directory - (self.winpython_directory / "settings" / "AppData" / "Roaming").mkdir(parents=True, exist_ok=True) - self._extract_python_archive() + self._print_action(f"Creating WinPython {self.winpython_directory} base directory") + if self.winpython_directory.is_dir(): + shutil.rmtree(self.winpython_directory) + os.makedirs(self.winpython_directory, exist_ok=True) + # preventive re-Creation of settings directory + (self.winpython_directory / "settings" / "AppData" / "Roaming").mkdir(parents=True, exist_ok=True) + self._extract_python_archive() self.distribution = wppm.Distribution(self.python_executable_directory, verbose=self.verbose) - if rebuild: - self._copy_essential_files() - self._create_initial_batch_scripts() - utils.python_execmodule("ensurepip", self.distribution.target) - self.distribution.patch_standard_packages("pip") - essential_packages = ["pip", "setuptools", "wheel", "wppm"] - for package_name in essential_packages: - actions = ["install", "--upgrade", "--pre", package_name] + self.install_options - self._print_action(f"Piping: {' '.join(actions)}") - self.distribution.do_pip_action(actions) - self.distribution.patch_standard_packages(package_name) + self._copy_essential_files() + self._create_initial_batch_scripts() + utils.python_execmodule("ensurepip", self.distribution.target) + self.distribution.patch_standard_packages("pip") + essential_packages = ["pip", "setuptools", "wheel", "wppm"] + for package_name in essential_packages: + actions = ["install", "--upgrade", "--pre", package_name] + self.install_options + self._print_action(f"Piping: {' '.join(actions)}") + self.distribution.do_pip_action(actions) + self.distribution.patch_standard_packages(package_name) def make_all(build_number: int, release_level: str, basedir_wpy: Path = None, - verbose: bool = False, rebuild: bool = True, install_options=["--no-index"], + verbose: bool = False, install_options=["--no-index"], flavor: str = "", find_links: str | list[Path] = None, source_dirs: Path = None, toolsdirs: str | list[Path] = None, ): @@ -192,7 +178,6 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None, release_level: release level (e.g. 'beta1', '') [str] basedir_wpy: top directory of the build (c:\...\Wpy...) verbose: Enable verbose output (bool). - rebuild: Whether to rebuild the distribution (bool). install_options: pip options (r'--no-index --pre --trusted-host=None') flavor: WinPython flavor (str). find_links: package directories (r'D:\Winpython\packages.srcreq') @@ -207,10 +192,8 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None, find_links_options = [f"--find-links={link}" for link in find_links_dirs_list + [source_dirs]] winpy_dir = Path(basedir_wpy) - if rebuild: - utils.print_box(f"Making WinPython at {winpy_dir}") - os.makedirs(winpy_dir, exist_ok=True) - + utils.print_box(f"Making WinPython at {winpy_dir}") + os.makedirs(winpy_dir, exist_ok=True) builder = WinPythonDistributionBuilder( build_number, release_level, winpy_dir.parent, wheels_directory=source_dirs, tools_directories=[Path(d) for d in tools_dirs_list], @@ -218,7 +201,7 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None, install_options=install_options_list + find_links_options, flavor=flavor ) - builder.build(rebuild=rebuild, winpy_dir=winpy_dir) + builder.build(winpy_dir=winpy_dir) if __name__ == "__main__": From 60848a704f178fa27b6aebd39b6304133c529a5b Mon Sep 17 00:00:00 2001 From: stonebig Date: Sun, 6 Jul 2025 18:45:36 +0200 Subject: [PATCH 3/4] get spyder config directory portable --- portable/launchers_final/scripts/WinPythonIni.py | 2 ++ portable/launchers_final/scripts/env.bat | 1 + 2 files changed, 3 insertions(+) diff --git a/portable/launchers_final/scripts/WinPythonIni.py b/portable/launchers_final/scripts/WinPythonIni.py index 7bc11bb9..ddc0c2e7 100644 --- a/portable/launchers_final/scripts/WinPythonIni.py +++ b/portable/launchers_final/scripts/WinPythonIni.py @@ -17,6 +17,7 @@ USERPROFILE = %HOME% [environment] ## Uncomment lines to override environment variables +#SPYDER_CONFDIR = %HOME%\settings\.spyder-py3 #JUPYTERLAB_SETTINGS_DIR = %HOME%\.jupyter\lab #JUPYTERLAB_WORKSPACES_DIR = %HOME%\.jupyter\lab\workspaces #R_HOME=%WINPYDIRBASE%\t\R @@ -26,6 +27,7 @@ #JULIA=%JULIA_HOME%%JULIA_EXE% #JULIA_PKGDIR=%WINPYDIRBASE%\settings\.julia #QT_PLUGIN_PATH=%WINPYDIR%\Lib\site-packages\pyqt5_tools\Qt\plugins + ''' def get_file(file_name): diff --git a/portable/launchers_final/scripts/env.bat b/portable/launchers_final/scripts/env.bat index 316f6587..952df8e4 100644 --- a/portable/launchers_final/scripts/env.bat +++ b/portable/launchers_final/scripts/env.bat @@ -30,6 +30,7 @@ rem set PYTHONUTF8=1 creates issues in "movable" patching set HOME=%WINPYDIRBASE%\settings rem see https://github.com/winpython/winpython/issues/839 rem set USERPROFILE=%HOME% +set SPYDER_CONFDIR=%HOME%\settings\.spyder-py3 set JUPYTER_DATA_DIR=%HOME% set JUPYTER_CONFIG_DIR=%WINPYDIR%\etc\jupyter set JUPYTER_CONFIG_PATH=%WINPYDIR%\etc\jupyter From 511c6dd9bb3172d5a809c27cf16f652e80306b60 Mon Sep 17 00:00:00 2001 From: stonebig Date: Sun, 6 Jul 2025 20:50:45 +0200 Subject: [PATCH 4/4] update readme for wppm package switch --- README.rst | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/README.rst b/README.rst index 9a1e05cf..de5208ae 100644 --- a/README.rst +++ b/README.rst @@ -6,7 +6,7 @@ Copyright @ 2012-2013 Pierre Raybaut Copyright @ 2014-2025+ The Winpython development team https://github.com/winpython/ Licensed under the terms of the MIT License -(see winpython/__init__.py for details) +(see wppm/__init__.py for details) Overview @@ -15,17 +15,22 @@ Overview WinPython is a portable distribution of the Python programming language for Windows (https://winpython.github.io). -This is the `winpython` Python package, not the distribution itself. +This is the `wppm` Python package and build toolchain repository, not the distribution itself. It includes two main features: WinPython Package Manager (WPPM) a complementary tool to navigate provided packages, install packages from included Wheelhouse, or register WinPython. - pip is the recommanded way to add or remove packages + pip is the recommanded way to add or remove packages otherwise WinPython build toolchain - make.py is the script used to + generate_a_winpython_distro.bat and make.py are the toolchain used to build a WinPython distribution from (almost) scratch. +WinPython set of Wheel + You can get also the equivalent of the WinPython distribution by using one of the provided pylock.toml + or by using provided requirements-with-hash.txt until pip does support pylock.toml files + + Dependencies ------------ @@ -38,20 +43,27 @@ Requirements * installer can be 7-Zip or nothing (just .zip-it) -Installation ------------- +Wppm build +---------- From the source package (see section 'Building dependencies'), you may -install WinPython using the following commands: +build WPPM using the following commands: **python -m pip install flit** **python -m flit build** -**python -m pip install --no-index --trusted-host=None --find-links=.\dist winpython** +Winpython Distribution wheels installation +------------------------------------------ + +To only install the wheels assembled per WinPython Distribution, you may +**python -m pip install --no-deps --require-hashes https://github.com/winpython/winpython/releases/download/16.6.20250620final/requir.64-3_13_5_0slim.txt + +A pylock file is also available, when you package manager can handle it +**https://github.com/winpython/winpython/releases/download/16.6.20250620final/pylock.64-3_13_5_0slim.toml But the easiest way to install the last stable release of WinPython is -by using an executable installer: https://winpython.github.io/ +by using a zipped distribution with or without auto-extractor: https://winpython.github.io/ More informations ----------------- @@ -60,4 +72,4 @@ More informations * Development, bug reports, discussions and feature requests: https://github.com/winpython/winpython -* Discussions: https://groups.google.com/group/winpython +* Discussions: https://github.com/winpython/winpython/discussions