20
Python Eggs Alin Voinea @ Eau de Web

Python eggs (RO)

Embed Size (px)

DESCRIPTION

Index egg-uri Python Structura unui egg Python Utilitare şi şabloane pentru crearea unui egg Distribuirea unui egg Automatizare Proxy eggs server / PyPI mirror Custom / Private eggs server

Citation preview

Page 1: Python eggs (RO)

Python Eggs

Alin Voinea @ Eau de Web

Page 2: Python eggs (RO)

Cuprins

● Index egg-uri Python● Structura unui egg Python● Utilitare şi şabloane pentru crearea unui egg● Distribuirea unui egg● Automatizare● Proxy eggs server / PyPI mirror● Custom / Private eggs server

Page 3: Python eggs (RO)

1. Python Package Index (pypi)

“O metoda* mai simpla de a distribui şi instala un pachet python”

pypi.python.org

*similar cu RPM, DEB, APK, IPK, etc

Page 4: Python eggs (RO)

1. Python Package Index (pypi)

$ pip* install helloworld

$ pip* install http://eggrepo.com/helloworld

*easy_install

Page 5: Python eggs (RO)

2. Structura unui egg

helloworld/setup.pyREADME.rstsrc/

__init__.py

Page 6: Python eggs (RO)

3. Utilitare şi şablonane

● zopeskel● templer.core

Page 7: Python eggs (RO)

3.1 ZopeSkel

$ pip install zopeskel$ zopeskel --list-templates$ zopeskel basic_namespace

Page 8: Python eggs (RO)

3.1 Custom ZopeSkel templates

$ pip install eea.package$ zopeskel --list-templates$ zopeskel eea

Page 9: Python eggs (RO)

4. Distribuirea unui egg python

● Direct Install$ python setup.py install

● Upload PyPI$ python setup.py register -r pypi$ python setup.py sdist upload$ pip install hello.world

Page 10: Python eggs (RO)

4.1 setup.py$ vim setup.py

from setuptools import setupsetup(

name=”hello.world”, version=”1.0”, …

)

Page 11: Python eggs (RO)

4.1 setup.py

● Metadata:○ https://docs.python.org/3/distutils/setupscript.html#meta-data

● Classifiers:○ https://pypi.python.org/pypi?%3Aaction=list_classifiers

Page 12: Python eggs (RO)

4.1 .pypirc*https://docs.python.org/3/distutils/packageindex.html#pypirc

$ vim /home/user/.pypirc[distutils]index-servers =

pypi

[pypi]repository: http://pypi.python.org/pypi/username: gigelpassword: secret

Page 13: Python eggs (RO)

5 Automatizare

● zest.releaser

● jarn.mkrelease

● eea.eggmonkey

Page 14: Python eggs (RO)

5.1 zest.releaser“Software releasing made easy and repeatable”

$ pip install zest.releaser

$ cd hello.world$ prerelease$ release$ postrelease

$ fullrelease

Page 15: Python eggs (RO)

5.2 jarn.mkrelease“Python egg releaser”

$ pip install jarn.mkrelease$ vim /home/user/.mkrelease

[defaults]

distdefault = eea

[aliases]

all =

pypi

plone

$ mkrelease -d all hello.world

Page 16: Python eggs (RO)

5.3 eea.eggmonkey“Automate releasing eggs with jarn.mkrelease”

$ vim buildout.cfg[buildout]extensions +=

mr.developereea.eggmonkey

$ bin/monkey -d eea hello.world$ bin/print_unreleased_packages

Page 17: Python eggs (RO)

6. Mirroring“collective.eggproxy”

$ vim buildout.cfg

[buildout]index = http://eggrepo.eea.europa.eu/pypi/

Page 18: Python eggs (RO)

7. Custom eggs server“ClueReleaseManager”

$ vim buildout.cfg[buildout]find-links = http://eggrepo.eea.europa.eu/simple

$ python setup.py register -r http://eggrepo.eea.europa.eu

Page 19: Python eggs (RO)

8. Legături externe● http://taskman.eionet.europa.eu/projects/zope/wiki/WebDevelopmentCycle● http://taskman.eionet.europa.eu/projects/zope/wiki/HowToReleaseAnEgg● http://taskman.eionet.europa.eu/projects/zope/wiki/Eggmonkey● https://docs.python.org/3.1/distutils/uploading.html● http://mrtopf.de/blog/en/a-small-introduction-to-python-eggs/● https://docs.python.org/3/distutils/packageindex.html● https://docs.python.org/3/distutils/setupscript.html#meta-data● https://pypi.python.org/pypi?%3Aaction=list_classifiers● https://docs.python.org/3/distutils/packageindex.html#pypirc● https://pypi.python.org/pypi/zest.releaser● https://pypi.python.org/pypi/jarn.mkrelease● https://pypi.python.org/pypi/eea.eggmonkey● https://pypi.python.org/pypi/collective.eggproxy● https://pypi.python.org/pypi/ClueReleaseManager● http://stackoverflow.com/questions/3220404/why-use-pip-over-easy-install

Page 20: Python eggs (RO)

9. Alte întrebări?