8000 [pull] master from winpython:master by pull[bot] · Pull Request #90 · blog2i2j/winpython.._..winpython · GitHub
[go: up one dir, main page]

Skip to content

[pull] master from winpython:master #90

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

Merged
merged 8 commits into from
Jul 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 22 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
------------

Expand All @@ -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
-----------------
Expand All @@ -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
2 changes: 1 addition & 1 deletion generate_a_winpython_distro.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Expand Down
66 changes: 23 additions & 43 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
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"
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}"
Expand Down Expand Up @@ -83,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."""
Expand Down Expand Up @@ -152,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, create_installer: str = "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,
):
Expand All @@ -194,8 +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).
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')
Expand All @@ -210,18 +192,16 @@ 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],
verbose=verbose,
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__":
Expand Down
2 changes: 2 additions & 0 deletions portable/launchers_final/scripts/WinPythonIni.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
1 change: 1 addition & 0 deletions portable/launchers_final/scripts/env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
0