I was reading Hynek Schlawack’s excellent article on becoming a Python core developer and decided to find out just how hard it would be to get set up on my machine so that I could be ready to do core development myself, should I ever get the honor of being a part of the team. Since I run on Windows the most, I’m just going to talk about how I got set up for that OS. I’ve been thinking about trying to help with core development for a while anyway, so now’s as good a time as any. Let’s find out just how easy or hard the setting up process is!
What You’ll Need
To get up and running as a developer of Python on Windows, you’ll need a Mercurial client to download Python, update and create patches. You can use a command-line tool or you can get TortoiseHg, a shell GUI. Once you have that configured correctly, you can do a
hg clone http://hg.python.org/cpython
Or use Tortoise to check out the repository. This will get you the latest Python 3.x version. If you want to help with a maintenance release, then you’ll want to read the documentation. The last major tool you’ll need is a compiler and the one that’s needed for the latest Python is Microsoft Visual Studio 2010. Fortunately, you don’t need to purchase the whole thing. In fact, you can just get the Express version of Visual C++ 2010 and you’ll be good to go. Note that this tool is not lightweight and ends up taking over one gigabyte of space on disc. Sad, but true.
Compiling Python on Windows 7
As you may have guessed, we’ll be doing the compiling of Python on Windows 7. I have Windows XP too, but that OS is practically dead now, so I’m not going to cover it. I doubt it’s much different anyway. Regardless, according to the dev guide documentation, you need to go into the repo that you just created on your machine and go into the PCBuild folder. Then find the pcbuild.sln file and run it with your new Visual Studio C++ application. You may see a warning from it about how the Express version doesn’t support Solutions, but just ignore that. Once the project is loaded, go into the Debug menu and select Build Solution. Oddly enough, the official docs say to go into the Build menu, NOT the Debug menu, but my copy doesn’t have a Build menu to choose from.
When I ran the build I got the following result at the end:
========== Build: 20 succeeded, 8 failed, 0 up-to-date, 3 skipped ==========
Looking through the log, it looks like it was unable to find the header files for sqlite3 and tcl and it had some issues with the bzip lib. It also complained that I don’t have ActivePerl / openssh installed. However, it still compiled Python and I had a fresh python_d.exe file in my PCBuild folder that I could run. I ran it by double-clicking it, but you can also run it from within Visual Studio using F5 or by going to the Debug menu and clicking Start Debugging.
I think at this point, I’m ready to figure out how to create a patch. If I do, I may try patching that messed up documentation so that people won’t spend time looking for a non-existent menu. Then I’ll write an article about how to submit a patch and use the issue tracker system for Python.
4 thoughts on “Python on Windows: How to Get Set Up to Help with Core Development”
Don’t worry too much about the extension modules that could not be compiled. You can do without them, unless you intend to work on issues specifically aimed at the relevant modules.
That’s good to know. Thanks for the information!
We actually debated that question for a while – we eventually left it as a separate repo because it’s independent of the Python version, so it didn’t make sense to try to wedge it into the main CPython repo’s branch management approach.
Pingback: Visto nel Web – 28 « Ok, panico
Comments are closed.