Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Packaging pratique (fr) - pycon.fr 2014
Search
xordoquy
October 25, 2014
Programming
1
170
Packaging pratique (fr) - pycon.fr 2014
Présentation général du packaging Python
xordoquy
October 25, 2014
Tweet
Share
More Decks by xordoquy
See All by xordoquy
pycon.fr 2018 - Django REST framework workshop
xordoquy
0
310
mauvaises bonnes idées pour REST
xordoquy
1
370
Authentication and Permissions with Django REST framework
xordoquy
0
180
Buildbot 0.9
xordoquy
0
100
Performances Django REST framework - DjangoCong 2016
xordoquy
0
130
Présentation de l'architecture REST - meetup Django Paris
xordoquy
0
110
Django REST framework workshop @Djangocon Europe 2015
xordoquy
0
120
Django REST framework - DjangoConG 2015
xordoquy
3
140
Django REST framework workshop - DjangoCong 2015
xordoquy
1
120
Other Decks in Programming
See All in Programming
TFLintカスタムプラグインで始める Terraformコード品質管理
bells17
2
350
One Enishi After Another
snoozer05
PRO
0
140
20251016_Rails News ~Rails 8.1の足音を聴く~
morimorihoge
2
660
CSC305 Lecture 09
javiergs
PRO
0
300
Pythonに漸進的に型をつける
nealle
1
100
Server Side Kotlin Meetup vol.16: 内部動作を理解して ハイパフォーマンスなサーバサイド Kotlin アプリケーションを書こう
ternbusty
3
230
あなたとKaigi on Rails / Kaigi on Rails + You
shimoju
0
170
その面倒な作業、「Dart」にやらせませんか? Flutter開発者のための業務効率化
yordgenome03
1
140
コード生成なしでモック処理を実現!ovechkin-dm/mockioで学ぶメタプログラミング
qualiarts
0
240
なぜGoのジェネリクスはこの形なのか? - Featherweight Goが明かす設計の核心
qualiarts
0
230
Google Opalで使える37のライブラリ
mickey_kubo
3
130
ALL CODE BASE ARE BELONG TO STUDY
uzulla
27
6.6k
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
Balancing Empowerment & Direction
lara
5
700
Understanding Cognitive Biases in Performance Measurement
bluesmoon
31
2.7k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Building Adaptive Systems
keathley
44
2.8k
Building Applications with DynamoDB
mza
96
6.7k
Typedesign – Prime Four
hannesfritz
42
2.8k
Mobile First: as difficult as doing things right
swwweet
225
10k
Large-scale JavaScript Application Architecture
addyosmani
514
110k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.5k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.5k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
Transcript
packaging xavier ordoquy
@linovia_net
Changer une miriade de scripts
en un système contrôlé.
Distribution: Une « distribution » Python est un fichier d’archive
versionné qui contient des paquets Python, des modules et d’autres fichiers de ressources qui sont utilisés pour distribuer une « Release ». Ce fichier de distribution est ce qu’un utilisateur final téléchargera d’Internet et installera.
Par la suite: packaging == distribution
exemple : pip install sentry[postgres]
Packaging Python : pourquoi ?
multi plateformes
Packaging Python : comment ?
3 outils + du code !!
virtualenv pyenv
Isoler le projet du reste
y compris avec docker, lxc, vagrant…
gain: fin des conflits
dépôt pypi
dépôt ‘officiel’ pypi.python.org
dépôt privé devpi
gain: distribution simple
pip
pip install -e
pip freeze (-l)
requirements: pip install -r
gain: gestion des dépendances
setup.py
use setuptools
recopiez !!
versions: PEP440 1.2.4.dev3557 1.2.4a1 1.2.4b1 1.2.4c1 == 1.2.4rc1 1.2.4 1.2.4.post1
images, css..: MANIFEST.in
gain: application web
executables : entry_points
gain : aucun chemin en dur
requirements : extra_requires
exemple : pip install sentry[postgres] pip install -e .[tests,dev]
gain: uniformisation des méthodes
Bonus: wheel
gain: temps
Bonus 2: stevedore
Bonus 3: du code !
setup( name='project', version='0.1.3a4', description='Some description', long_description=open('README.rst').read(), author='Xavier Ordoquy', author_email='
[email protected]
', url='http://github.com/xx/yy',
packages=find_packages(exclude=[‘tests']), zip_safe=False, include_package_data=True, classifiers=[ 'Framework :: Django', ] ) exemple:
setup( … install_requires=install_requires, extras_require={ 'tests': tests_require, 'dev': dev_requires, 'postgres': install_requires
+ pg_requires, } ) exemple:
setup( … entry_points={ 'console_scripts': [ 'sentry = sentry.utils.runner:main', ], },
) exemple:
class PyTest(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) self.test_args = ['tests'] self.test_suite =
True def run_tests(self): import pytest errno = pytest.main(self.test_args) sys.exit(errno) setup( … cmdclass={'test': PyTest}, ) exemple:
Présentation http://bit.ly/1skB3K4 Python Packaging User Guide http://bit.ly/1ww8Nbz setup.py Sentry http://bit.ly/1FMMCnG
Merci