Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does `setup.py sdist` work?

I'm trying to make a source distribution of my project with setup.py sdist. I already have a functioning setup.py that I can install with. But when I do the sdist, all I get is another my_project folder inside my my_project folder, a MANIFEST file I have no interest in, and a zip file which contains two text files, and not my project.

What am I doing wrong? Where is the documentation on sdist?

Update:

Here's my setup.py:

#!/usr/bin/env python

import os
from distutils.core import setup
import distutils
from general_misc import package_finder

try:
    distutils.dir_util.remove_tree('build', verbose=True)
except:
    pass

my_long_description = \
'''\
GarlicSim is a platform for writing, running and analyzing simulations. It can
handle any kind of simulation: Physics, game theory, epidemic spread,
electronics, etc.
'''

my_packages = package_finder.get_packages('', include_self=True,
                                          recursive=True)

setup(
    name='GarlicSim',
    version='0.1',
    description='A Pythonic framework for working with simulations',
    author='Ram Rachum',
    author_email='[email protected]',
    url='http://garlicsim.org',
    packages=my_packages,
    package_dir={'': '..'},
    license= "LGPL 2.1 License",
    long_description = my_long_description,

)

try:
    distutils.dir_util.remove_tree('build', verbose=True)
except:
    pass
like image 832
Ram Rachum Avatar asked Oct 23 '09 15:10

Ram Rachum


People also ask

What does setup py Sdist do?

the "sdist" command is for creating a "source" distribution of a package. Usually, one would combine this command with the "upload" command to distribute the package through Pypi (for example).

How does Sdist work?

The sdist command processes this template and generates a manifest based on its instructions and what it finds in the filesystem. If you prefer to roll your own manifest file, the format is simple: one filename per line, regular files (or symlinks to them) only.

What is a python Sdist?

Python Source Distributions A source distribution, or more commonly sdist, is a distribution that contains all of the python source code (i.e. . py files), any data files that the library requires, and a setup.py file which describes to the setuptools module how your python code should be packaged.


2 Answers

Tarek Ziade explained this, and related software packaging tools, in this article (broken original link) called Writing a Package in Python.

Basically, it creates a simple package by creating a release tree where everything needed to run the package is copied. This tree is then archived in one or many archived files (often, it just creates one tar ball). The archive is basically a copy of the source tree.

like image 121
Michael Dillon Avatar answered Sep 28 '22 04:09

Michael Dillon


the "sdist" command is for creating a "source" distribution of a package. Usually, one would combine this command with the "upload" command to distribute the package through Pypi (for example).

like image 41
jldupont Avatar answered Sep 28 '22 06:09

jldupont