• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

Directory.Build.propsD25-Apr-2025249 53

Directory.Build.targetsD25-Apr-2025245 53

_asyncio.vcxprojD25-Apr-20254.3 KiB110109

_asyncio.vcxproj.filtersD25-Apr-2025733 2121

_bz2.vcxprojD25-Apr-20255.3 KiB128128

_bz2.vcxproj.filtersD25-Apr-20252.1 KiB5959

_ctypes.vcxprojD25-Apr-20255 KiB125124

_ctypes.vcxproj.filtersD25-Apr-20251.7 KiB4747

_ctypes_test.vcxprojD25-Apr-20254.4 KiB112112

_ctypes_test.vcxproj.filtersD25-Apr-20251,021 2929

_decimal.vcxprojD25-Apr-20257.7 KiB160159

_decimal.vcxproj.filtersD25-Apr-20255.1 KiB127127

_elementtree.vcxprojD25-Apr-20255.7 KiB136135

_elementtree.vcxproj.filtersD25-Apr-20253.2 KiB8686

_freeze_module.vcxprojD25-Apr-202520.6 KiB434424

_freeze_module.vcxproj.filtersD25-Apr-202516.1 KiB479477

_hashlib.vcxprojD25-Apr-20254.5 KiB116115

_hashlib.vcxproj.filtersD25-Apr-2025731 2121

_lzma.vcxprojD25-Apr-20255 KiB123122

_lzma.vcxproj.filtersD25-Apr-2025730 2121

_msi.vcxprojD25-Apr-20254.5 KiB115115

_msi.vcxproj.filtersD25-Apr-2025718 2121

_multiprocessing.vcxprojD25-Apr-20254.7 KiB118118

_multiprocessing.vcxproj.filtersD25-Apr-20251.1 KiB3232

_overlapped.vcxprojD25-Apr-20254.5 KiB114114

_overlapped.vcxproj.filtersD25-Apr-2025729 2121

_queue.vcxprojD25-Apr-20254.3 KiB110109

_queue.vcxproj.filtersD25-Apr-2025731 2121

_socket.vcxprojD25-Apr-20254.6 KiB117117

_socket.vcxproj.filtersD25-Apr-20251,005 2929

_sqlite3.vcxprojD25-Apr-20255.9 KiB138138

_sqlite3.vcxproj.filtersD25-Apr-20252.7 KiB7777

_ssl.vcxprojD25-Apr-20254.9 KiB122122

_ssl.vcxproj.filtersD25-Apr-2025836 2424

_testbuffer.vcxprojD25-Apr-20254.3 KiB109109

_testbuffer.vcxproj.filtersD25-Apr-2025730 2121

_testcapi.vcxprojD25-Apr-20254.4 KiB110110

_testcapi.vcxproj.filtersD25-Apr-2025734 2121

_testconsole.vcxprojD25-Apr-20254.5 KiB115115

_testconsole.vcxproj.filtersD25-Apr-2025919 2323

_testembed.vcxprojD25-Apr-20254.4 KiB112112

_testembed.vcxproj.filtersD25-Apr-2025923 2323

_testimportmultiple.vcxprojD25-Apr-20254.4 KiB111110

_testimportmultiple.vcxproj.filtersD25-Apr-2025738 2121

_testinternalcapi.vcxprojD25-Apr-20254.4 KiB111110

_testinternalcapi.vcxproj.filtersD25-Apr-2025736 2121

_testmultiphase.vcxprojD25-Apr-20254.5 KiB115115

_testmultiphase.vcxproj.filtersD25-Apr-2025927 2323

_tkinter.vcxprojD25-Apr-20255.9 KiB136136

_tkinter.vcxproj.filtersD25-Apr-2025832 2424

_uuid.vcxprojD25-Apr-20254.5 KiB115115

_uuid.vcxproj.filtersD25-Apr-2025804 2222

_zoneinfo.vcxprojD25-Apr-20254.3 KiB110109

_zoneinfo.vcxproj.filtersD25-Apr-2025728 2121

blurb.batD25-Apr-2025885 2924

build.batD25-Apr-20257.3 KiB186168

build_env.batD25-Apr-202526 21

clean.batD25-Apr-2025133 64

env.batD25-Apr-20251.3 KiB2824

env.ps1D25-Apr-2025105 32

field3.pyD25-Apr-2025974 3617

find_msbuild.batD25-Apr-20252.9 KiB6451

find_python.batD25-Apr-20253.7 KiB9071

fix_encoding.pyD25-Apr-2025952 3722

get_external.pyD25-Apr-20252.3 KiB7865

get_externals.batD25-Apr-20254.4 KiB11899

idle.batD25-Apr-2025713 2822

lib.pyprojD25-Apr-202590.3 KiB1,8311,830

libffi.propsD25-Apr-20251 KiB2121

liblzma.vcxprojD25-Apr-202514.5 KiB247244

liblzma.vcxproj.filtersD25-Apr-202517.7 KiB435435

openssl.propsD25-Apr-20251.7 KiB3434

openssl.vcxprojD25-Apr-20255.8 KiB139125

pcbuild.projD25-Apr-20257.7 KiB160134

pcbuild.slnD25-Apr-2025116.6 KiB1,5141,513

prepare_libffi.batD25-Apr-20257.4 KiB213175

prepare_ssl.batD25-Apr-20252.1 KiB5947

prepare_ssl.pyD25-Apr-20256.7 KiB204148

prepare_tcltk.batD25-Apr-20252.2 KiB6047

pyexpat.vcxprojD25-Apr-20254.9 KiB120119

pyexpat.vcxproj.filtersD25-Apr-20251.4 KiB4141

pylauncher.vcxprojD25-Apr-20254.5 KiB115114

pylauncher.vcxproj.filtersD25-Apr-20251 KiB2828

pyproject.propsD25-Apr-202515.1 KiB253223

pyshellext.vcxprojD25-Apr-20254.6 KiB117117

pyshellext.vcxproj.filtersD25-Apr-20251 KiB2828

python.propsD25-Apr-202516.2 KiB254163

python.vcxprojD25-Apr-20257.2 KiB163162

python.vcxproj.filtersD25-Apr-2025850 2726

python3dll.vcxprojD25-Apr-20254.4 KiB110110

python3dll.vcxproj.filtersD25-Apr-2025904 2323

python_uwp.vcxprojD25-Apr-20255.1 KiB129128

python_uwp.vcxproj.filtersD25-Apr-2025848 2626

pythoncore.vcxprojD25-Apr-202531.9 KiB613607

pythoncore.vcxproj.filtersD25-Apr-202545.1 KiB1,2991,298

pythonw.vcxprojD25-Apr-20254.4 KiB111111

pythonw.vcxproj.filtersD25-Apr-2025723 2121

pythonw_uwp.vcxprojD25-Apr-20255.1 KiB129128

pythonw_uwp.vcxproj.filtersD25-Apr-2025850 2626

pywlauncher.vcxprojD25-Apr-20254.5 KiB114114

pywlauncher.vcxproj.filtersD25-Apr-20251 KiB2828

readme.txtD25-Apr-202511.2 KiB292242

regen.targetsD25-Apr-20256.7 KiB131116

rmpyc.pyD25-Apr-2025409 2012

rt.batD25-Apr-20252.7 KiB7968

select.vcxprojD25-Apr-20254.4 KiB113113

select.vcxproj.filtersD25-Apr-2025731 2121

sqlite3.vcxprojD25-Apr-20255.5 KiB122121

sqlite3.vcxproj.filtersD25-Apr-20251.1 KiB3232

tcl.vcxprojD25-Apr-20253.2 KiB7770

tcltk.propsD25-Apr-20254.6 KiB6756

tix.vcxprojD25-Apr-20254.1 KiB10192

tk.vcxprojD25-Apr-20253.5 KiB8377

unicodedata.vcxprojD25-Apr-20254.5 KiB113113

unicodedata.vcxproj.filtersD25-Apr-20251.1 KiB3232

urlretrieve.pyD25-Apr-20251.2 KiB4033

venvlauncher.vcxprojD25-Apr-20254.7 KiB118117

venvlauncher.vcxproj.filtersD25-Apr-2025847 2626

venvwlauncher.vcxprojD25-Apr-20254.7 KiB118117

venvwlauncher.vcxproj.filtersD25-Apr-2025847 2626

winsound.vcxprojD25-Apr-20254.5 KiB115115

winsound.vcxproj.filtersD25-Apr-2025796 2222

xxlimited.vcxprojD25-Apr-20254.4 KiB112111

xxlimited.vcxproj.filtersD25-Apr-2025445 1313

xxlimited_35.vcxprojD25-Apr-20254.4 KiB112111

xxlimited_35.vcxproj.filtersD25-Apr-2025450 1413

readme.txt

1Quick Start Guide
2-----------------
3
41.  Install Microsoft Visual Studio 2017 with Python workload and
5    Python native development component.
61a. Optionally install Python 3.6 or later.  If not installed,
7    get_externals.bat (via build.bat) will download and use Python via
8    NuGet.
92.  Run "build.bat" to build Python in 32-bit Release configuration.
103.  (Optional, but recommended) Run the test suite with "rt.bat -q".
11
12
13Building Python using Microsoft Visual C++
14------------------------------------------
15
16This directory is used to build CPython for Microsoft Windows on 32- and 64-
17bit platforms.  Using this directory requires an installation of
18Microsoft Visual Studio (MSVC) with the *Python workload* and
19its optional *Python native development* component selected.
20
21Building from the command line is recommended in order to obtain any
22external dependencies. To build, simply run the "build.bat" script without
23any arguments. After this succeeds, you can open the "pcbuild.sln"
24solution in Visual Studio to continue development.
25
26To build an installer package, refer to the README in the Tools/msi folder.
27
28The solution currently supports two platforms.  The Win32 platform is
29used to build standard x86-compatible 32-bit binaries, output into the
30win32 sub-directory.  The x64 platform is used for building 64-bit AMD64
31(aka x86_64 or EM64T) binaries, output into the amd64 sub-directory.
32The Itanium (IA-64) platform is no longer supported.
33
34Four configuration options are supported by the solution:
35Debug
36    Used to build Python with extra debugging capabilities, equivalent
37    to using ./configure --with-pydebug on UNIX.  All binaries built
38    using this configuration have "_d" added to their name:
39    python310_d.dll, python_d.exe, parser_d.pyd, and so on.  Both the
40    build and rt (run test) batch files in this directory accept a -d
41    option for debug builds.  If you are building Python to help with
42    development of CPython, you will most likely use this configuration.
43PGInstrument, PGUpdate
44    Used to build Python in Release configuration using PGO, which
45    requires Premium Edition of Visual Studio.  See the "Profile
46    Guided Optimization" section below for more information.  Build
47    output from each of these configurations lands in its own
48    sub-directory of this directory.  The official Python releases may
49    be built using these configurations.
50Release
51    Used to build Python as it is meant to be used in production
52    settings, though without PGO.
53
54
55Building Python using the build.bat script
56----------------------------------------------
57
58In this directory you can find build.bat, a script designed to make
59building Python on Windows simpler.  This script will use the env.bat
60script to detect either Visual Studio 2017 or 2015, either of
61which may be used to build Python. Currently Visual Studio 2017 is
62officially supported.
63
64By default, build.bat will build Python in Release configuration for
65the 32-bit Win32 platform.  It accepts several arguments to change
66this behavior, try `build.bat -h` to learn more.
67
68
69C Runtime
70---------
71
72Visual Studio 2017 uses version 14.0 of the C runtime (vcruntime140).
73The executables no longer use the "Side by Side" assemblies used in
74previous versions of the compiler.  This simplifies distribution of
75applications.
76
77The run time libraries are available under the redist folder of your
78Visual Studio distribution. For more info, see the Readme in the
79redist folder.
80
81
82Sub-Projects
83------------
84
85The CPython project is split up into several smaller sub-projects which
86are managed by the pcbuild.sln solution file.  Each sub-project is
87represented by a .vcxproj and a .vcxproj.filters file starting with the
88name of the sub-project.  These sub-projects fall into a few general
89categories:
90
91The following sub-projects represent the bare minimum required to build
92a functioning CPython interpreter.  If nothing else builds but these,
93you'll have a very limited but usable python.exe:
94pythoncore
95    .dll and .lib
96python
97    .exe
98
99These sub-projects provide extra executables that are useful for running
100CPython in different ways:
101pythonw
102    pythonw.exe, a variant of python.exe that doesn't open a Command
103    Prompt window
104pylauncher
105    py.exe, the Python Launcher for Windows, see
106        https://docs.python.org/3/using/windows.html#launcher
107pywlauncher
108    pyw.exe, a variant of py.exe that doesn't open a Command Prompt
109    window
110_testembed
111    _testembed.exe, a small program that embeds Python for testing
112    purposes, used by test_capi.py
113
114These are miscellaneous sub-projects that don't really fit the other
115categories:
116_freeze_module
117    _freeze_module.exe, used to regenerate frozen modules in Python
118    after changes have been made to the corresponding source files
119    (e.g. Lib\importlib\_bootstrap.py).
120pyshellext
121    pyshellext.dll, the shell extension deployed with the launcher
122python3dll
123    python3.dll, the PEP 384 Stable ABI dll
124xxlimited
125    builds an example module that makes use of the PEP 384 Stable ABI,
126    see Modules\xxlimited.c
127xxlimited_35
128    ditto for testing the Python 3.5 stable ABI, see
129    Modules\xxlimited_35.c
130
131The following sub-projects are for individual modules of the standard
132library which are implemented in C; each one builds a DLL (renamed to
133.pyd) of the same name as the project:
134_asyncio
135_ctypes
136_ctypes_test
137_zoneinfo
138_decimal
139_elementtree
140_hashlib
141_msi
142_multiprocessing
143_overlapped
144_socket
145_testbuffer
146_testcapi
147_testconsole
148_testimportmultiple
149_testmultiphase
150_tkinter
151pyexpat
152select
153unicodedata
154winsound
155
156The following Python-controlled sub-projects wrap external projects.
157Note that these external libraries are not necessary for a working
158interpreter, but they do implement several major features.  See the
159"Getting External Sources" section below for additional information
160about getting the source for building these libraries.  The sub-projects
161are:
162_bz2
163    Python wrapper for version 1.0.8 of the libbzip2 compression library
164    Homepage:
165        http://www.bzip.org/
166_lzma
167    Python wrapper for version 5.2.2 of the liblzma compression library
168    Homepage:
169        https://tukaani.org/xz/
170_ssl
171    Python wrapper for version 1.1.1u of the OpenSSL secure sockets
172    library, which is downloaded from our binaries repository at
173    https://github.com/python/cpython-bin-deps.
174
175    Homepage:
176        https://www.openssl.org/
177
178    Building OpenSSL requires Perl on your path, and can be performed by
179    running PCbuild\prepare_ssl.bat. This will retrieve the version of
180    the sources matched to the current commit from the OpenSSL branch
181    in our source repository at
182    https://github.com/python/cpython-source-deps.
183
184    To use an alternative build of OpenSSL completely, you should replace
185    the files in the externals/openssl-bin-<version> folder with your own.
186    As long as this folder exists, its contents will not be downloaded
187    again when building.
188
189_sqlite3
190    Wraps SQLite 3.42.0, which is itself built by sqlite3.vcxproj
191    Homepage:
192        https://www.sqlite.org/
193_tkinter
194    Wraps version 8.6.6 of the Tk windowing system, which is downloaded
195    from our binaries repository at
196    https://github.com/python/cpython-bin-deps.
197
198    Homepage:
199        https://www.tcl.tk/
200
201    Building Tcl and Tk can be performed by running
202    PCbuild\prepare_tcltk.bat. This will retrieve the version of the
203    sources matched to the current commit from the Tcl and Tk branches
204    in our source repository at
205    https://github.com/python/cpython-source-deps.
206
207    The two projects install their respective components in a
208    directory alongside the source directories called "tcltk" on
209    Win32 and "tcltk64" on x64.  They also copy the Tcl and Tk DLLs
210    into the current output directory, which should ensure that Tkinter
211    is able to load Tcl/Tk without having to change your PATH.
212
213
214Getting External Sources
215------------------------
216
217The last category of sub-projects listed above wrap external projects
218Python doesn't control, and as such a little more work is required in
219order to download the relevant source files for each project before they
220can be built.  However, a simple script is provided to make this as
221painless as possible, called "get_externals.bat" and located in this
222directory.  This script extracts all the external sub-projects from
223    https://github.com/python/cpython-source-deps
224and
225    https://github.com/python/cpython-bin-deps
226via a Python script called "get_external.py", located in this directory.
227If Python 3.6 or later is not available via the "py.exe" launcher, the
228path or command to use for Python can be provided in the PYTHON_FOR_BUILD
229environment variable, or get_externals.bat will download the latest
230version of NuGet and use it to download the latest "pythonx86" package
231for use with get_external.py.  Everything downloaded by these scripts is
232stored in ..\externals (relative to this directory).
233
234It is also possible to download sources from each project's homepage,
235though you may have to change folder names or pass the names to MSBuild
236as the values of certain properties in order for the build solution to
237find them.  This is an advanced topic and not necessarily fully
238supported.
239
240The get_externals.bat script is called automatically by build.bat
241unless you pass the '-E' option.
242
243
244Profile Guided Optimization
245---------------------------
246
247The solution has two configurations for PGO. The PGInstrument
248configuration must be built first. The PGInstrument binaries are linked
249against a profiling library and contain extra debug information. The
250PGUpdate configuration takes the profiling data and generates optimized
251binaries.
252
253The build_pgo.bat script automates the creation of optimized binaries.
254It creates the PGI files, runs the unit test suite or PyBench with the
255PGI python, and finally creates the optimized files.
256
257See
258    https://docs.microsoft.com/en-us/cpp/build/profile-guided-optimizations
259for more on this topic.
260
261
262Static library
263--------------
264
265The solution has no configuration for static libraries. However it is
266easy to build a static library instead of a DLL. You simply have to set
267the "Configuration Type" to "Static Library (.lib)" and alter the
268preprocessor macro "Py_ENABLE_SHARED" to "Py_NO_ENABLE_SHARED". You may
269also have to change the "Runtime Library" from "Multi-threaded DLL
270(/MD)" to "Multi-threaded (/MT)".
271
272
273Visual Studio properties
274------------------------
275
276The PCbuild solution makes use of Visual Studio property files (*.props)
277to simplify each project. The properties can be viewed in the Property
278Manager (View -> Other Windows -> Property Manager) but should be
279carefully modified by hand.
280
281The property files used are:
282 * python (versions, directories and build names)
283 * pyproject (base settings for all projects)
284 * openssl (used by projects dependent upon OpenSSL)
285 * tcltk (used by _tkinter, tcl, tk and tix projects)
286
287The pyproject property file defines all of the build settings for each
288project, with some projects overriding certain specific values. The GUI
289doesn't always reflect the correct settings and may confuse the user
290with false information, especially for settings that automatically adapt
291for different configurations.
292