python eggs (ro)
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 serverTRANSCRIPT
Python Eggs
Alin Voinea @ Eau de Web
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
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
1. Python Package Index (pypi)
$ pip* install helloworld
$ pip* install http://eggrepo.com/helloworld
*easy_install
2. Structura unui egg
helloworld/setup.pyREADME.rstsrc/
__init__.py
3. Utilitare şi şablonane
● zopeskel● templer.core
3.1 ZopeSkel
$ pip install zopeskel$ zopeskel --list-templates$ zopeskel basic_namespace
3.1 Custom ZopeSkel templates
$ pip install eea.package$ zopeskel --list-templates$ zopeskel eea
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
4.1 setup.py$ vim setup.py
from setuptools import setupsetup(
name=”hello.world”, version=”1.0”, …
)
4.1 setup.py
● Metadata:○ https://docs.python.org/3/distutils/setupscript.html#meta-data
● Classifiers:○ https://pypi.python.org/pypi?%3Aaction=list_classifiers
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
5 Automatizare
● zest.releaser
● jarn.mkrelease
● eea.eggmonkey
5.1 zest.releaser“Software releasing made easy and repeatable”
$ pip install zest.releaser
$ cd hello.world$ prerelease$ release$ postrelease
$ fullrelease
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
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
6. Mirroring“collective.eggproxy”
$ vim buildout.cfg
[buildout]index = http://eggrepo.eea.europa.eu/pypi/
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
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
9. Alte întrebări?