background preloader

Packaging and distribution

Facebook Twitter

PyInstaller. Tutorial - py2exe.org. Py2exe turns Python programs into packages that can be run on other Windows computers without needing to install Python on those computers.

Tutorial - py2exe.org

The ExeMaker Tool. Updated October 12, 2004 | October 10, 2004 | Fredrik Lundh “Outstanding utility.

The ExeMaker Tool

It isn’t just neat, it’s indispensable. ” ExeMaker is a small tool that takes a Python script, copies it to a program directory, and creates a Windows EXE file in the same directory. When you run that EXE, it automatically runs the script. To see how it works, let’s look at an example: Setuptools - The PEAK Developers' Center. Basic Use For basic use of setuptools, just import things from setuptools instead of the distutils.

setuptools - The PEAK Developers' Center

Here's a minimal setup script using setuptools: from setuptools import setup, find_packages setup( name = "HelloWorld", version = "0.1", packages = find_packages(), ) As you can see, it doesn't take much to use setuptools in a project. Just by doing the above, this project will be able to produce eggs, upload to PyPI, and automatically include all packages in the directory where the setup.py lives. Welcome to Distribute’s documentation! — Distribute documentation. Installing the Package Tools — The Hitchhiker's Guide to Packaging v1.0 documentation. In the current state of packaging in Python, one needs a set of tools to easily manipulate the packaging ecosystem.

Installing the Package Tools — The Hitchhiker's Guide to Packaging v1.0 documentation

There are two tools in particular that are extremely handy in the current ecosystem. There is a third tool, Virtual Environments, that will be discussed later in this documentation that will assist in isolating a packaging ecosystem from the global one. The combination of these tools will help to find, install and uninstall packages. Distribute. EasyInstall - The PEAK Developers' Center. Installing "Easy Install" Please see the setuptools PyPI page for download links and basic installation instructions for each of the supported platforms.

EasyInstall - The PEAK Developers' Center

You will need at least Python 2.3.5, or if you are on a 64-bit platform, Python 2.4. An easy_install script will be installed in the normal location for Python scripts on your platform. Note that the instructions on the setuptools PyPI page assume that you are are installling to Python's primary site-packages directory. If this is not the case, you should consult the section below on Custom Installation Locations before installing. Note that easy_install normally works by downloading files from the internet. (Alternately, if you do not wish easy_install to actually download anything, you can restrict it from doing so with the --allow-hosts option; see the sections on restricting downloads with --allow-hosts and command-line options for more details.) Troubleshooting Windows Notes. Virtual Environments — The Hitchhiker's Guide to Packaging v1.0 documentation.

Pip — pip 1.1.post1 documentation. Python eggs. Requirements for `account number` generator: Issue pseudo random consistent number (must be unique for dozen millions of records)Easy check validity (without a need to make a database call) We will use Feistel cipher to generate pseudo random number (positive only) from a sequential numbers (e.g. returned by nextval() for a posgresql sequence).

Python eggs

This algorithm is taken as basis for the `make_feistel_number` function available in wheezy.core package. Setup environment before proceed: $ virtualenv env $ env/bin/easy_install wheezy.core $ env/bin/python Let play a bit how numbers are generated (notice, the function is reversal and consistent, all numbers are unique, no collision): Working With Packages in Python. Using pip to Manage Python Packages Like many useful programming ecosystems, Python provides a powerful and easy-to-use package management system called pip.

Working With Packages in Python

It is written to replace an older tool called easy_install. From a high-level point of view, pip has the following advantages over easy_install: All packages are downloaded before installation to prevent partial (thus broken) installation.Output information is pre-processed, so it's more useful than eccentric messages.It keeps record of why actions are performed. For example, the reason why a package was required is recorded for future reference.Packages can be installed as flat modules, which makes library-code debugging much easier than egg archives.Native support for other version control systems.

Setting up virtualenv and pip to perform simple operations. Distributing Python Modules — Python v2.7. Packaging Python Libraries - Dive Into Python 3. You are here: Home ‣ Dive Into Python 3 ‣ Difficulty level: ♦♦♦♦♢ ❝ You’ll find the shame is like the pain; you only feel it once. ❞— Marquise de Merteuil, Dangerous Liaisons Diving In# So you want to release a Python script, library, framework, or application.

Packaging Python Libraries - Dive Into Python 3

Excellent. Python 3 comes with a packaging framework called Distutils. All of these facets of Distutils center around the setup script, traditionally called setup.py. In this chapter, you’ll learn how the setup scripts for chardet and httplib2 work, and you’ll step through the process of releasing your own Python software. skip over this code listing.