Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building an egg of my python project

Can somebody please guide me with step-by-step procedure on how to eggfy my existing python project? The documentation is keep mentioning something about setup.py within a package but I cannot find it in my project...

thank you,

like image 556
Jin-Dominique Avatar asked Dec 09 '13 00:12

Jin-Dominique


2 Answers

You can use setuptools to achieve that. In two steps, you just need to:

Create the setup.py script

This file calls the setuptools API that takes care of building your package. A very simple setup.py would look like this:

from setuptools import setup, find_packages

setup(
    name='mypackage',
    version='0.1.0',
    description='A short description',
    long_description='I would just open("README.md").read() here',
    author='Author of the Project',
    author_email='[email protected]',
    url='https://github.com/user/proj',
    packages=find_packages(exclude=['*tests*']),
)

Generate the .egg file

That's definitely the easier part. You just have to call

$ python setup.py bdist_egg

Just look at the dist directory created and you'll find the .egg file.

I'd suggest you to take a look in a very good tutorial about setuptools: http://pythonhosted.org/an_example_pypi_project/setuptools.html

like image 91
clarete Avatar answered Sep 21 '22 22:09

clarete


assuming scrapy daemon run on localhost, it should be as simple as:

cd /root/of/scrapy/project/where/scrapy.cfg/is
scrapy deploy

otherwise, insert another entry in scrapy.cfg file, for example:

[deploy:scrapyd2]
url = http://scrapyd.mydomain.com/api/scrapyd/
username = john
password = secret

for more info see scrapyd documentation

like image 34
Guy Gavriely Avatar answered Sep 20 '22 22:09

Guy Gavriely