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
Structuring Your Python Project
Search
Matt Bachmann
January 20, 2016
Programming
4k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Structuring Your Python Project
For people who know some Python and want to structure their first project
Matt Bachmann
January 20, 2016
More Decks by Matt Bachmann
See All by Matt Bachmann
Property Based Testing: Hypothesis
bachmann1234
0
810
Diff-Cover
bachmann1234
1
290
Opening The Floodgates: Unicode Identifiers in Python
bachmann1234
0
370
Other Decks in Programming
See All in Programming
Kiroで創り、AgentCoreで繋ぐ!AWSで実践する「AI-DLC」から「AIエージェント統合」までの最新地図
licux
2
350
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
140
20260828_品質と開発生産性を両立させる、AI時代のE2Eテストの考え方
magicpod
0
160
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
0
380
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
420
Hono + Inertia + React で LP を構築した話
oukayuka
2
210
From 6 People Classroom Meetup to 100 People Regional Conference / FOSS4G Hiroshima 2026
furukawayasuto
0
110
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
PyO3 で既存 Python 評価器を Rust core 化する ー wasm-bindgen でブラウザにも配るための設計
kdash
1
470
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
500
私のClaude Code活用法 (個人開発編) - PHPerKaigi mini #4(2026/08/24)
panda_program
1
210
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
0
440
Featured
See All Featured
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
470
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
260
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
290
WENDY [Excerpt]
tessaabrams
12
39k
Accessibility Awareness
sabderemane
1
200
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
The SEO Collaboration Effect
kristinabergwall1
1
550
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
870
How to Ace a Technical Interview
jacobian
281
24k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Transcript
Structuring Your Python Project Matt Bachmann
Agenda • Directory Structure • Isolating Your Environment • Installing
Dependencies • Packaging Your Project • Releasing to the World
Our Project • Display Current Weather > forcastio 42.3907 -71.1157
Currently: rain - Mixed precipitation tomorrow through Thursday, with temperatures falling to 41°F on Monday.
Project Structure
The Code
Style Checking Your Code
The Tests
Running Your Tests
License
Documentation
Documentation • All projects should have a readme ◦ Description
◦ Installation ◦ Usage • Moving Beyond Readme! ◦ Sphinx • Write docs in reStructuredText ◦ Renders in Github and PyPi. PyPi does not support Markdown
Specifying Dependencies and Isolating Your Project
Isolate Your Project • Install virtualenv > pip install virtualenv
• Create an isolated environment > virtualenv venv • Turn that environment on > source venv/bin/activate
Installing Dependencies Install a package pip install <package name> Upgrade
a package pip install -U <package name> Uninstall a package pip uninstall <package name> List Installed packages pip freeze Install packages from a file pip install -r <requirements file>
Installing Dependencies • requirements.txt requests==2.8.1 • test-requirements.txt coverage==4.0.3 flake8==2.5.0 mock==1.3.0
pyflakes==1.0.0 pytest==2.8.3
Deploying Your Project
Setup.py setup( name='displayforecastio', version='1.0', author='Matt Bachmann', url='https://github.com/Bachmann1234/displayforecastio', description='Display the current
weather in your terminal', license='Apache 2.0', packages=[‘displayforecastio'], install_requires=['requests==2.8.1'], entry_points={ 'console_scripts': ['forcastio = displayforecastio.app:run'], } )
What This Gives You • Install your project from project
root > pip install . • After installation you have a command! > forecastio 42.3907 -71.1157 • Share your project with the world
Pip Editable Installs • pip install -e <path to your
project> ◦ Installs a project by pointing to it ◦ Won’t work over pypi • Change your code, your installation reflects the changes • Super handy debugging tool • Fun way to explore other people’s projects!
Deploying Your Project To PyPI Step 1: Register for an
account
Deploying Your Project To PyPI Step 2: Create a .pypirc
in your home directory > cat .pypirc [server-login] username:Matt.Bachmann password:NotAChance
Deploying Your Project To PyPI Step 3: Register Your package
(from project root) > python setup.py register <Name>
Deploying Your Project To PyPI DONE!
Deploying Your Project To PyPI > pip install displayforecastio >
forecastio 42.3907 -71.1157 Currently: rain - Mixed precipitation tomorrow through Thursday, with temperatures falling to 42°F on Saturday.
Deploying Your Project To PyPI • Deploying Updates ◦ After
updating the version in setup.py > python setup.py sdist upload
References • Documentation ◦ https://readthedocs.org/ ◦ http://sphinx-doc.org/contents.html • Example Projects
◦ https://github.com/Bachmann1234/terminalweather ◦ https://github.com/pypa/sampleproject • Flake8 ◦ https://flake8.readthedocs.org/en/latest/ ◦ https://www.youtube.com/watch?v=wf-BqAjZb8M (Not about flake8 but an important lesson for anyone caring about style) • Folder Structure ◦ http://learnpythonthehardway.org/book/ex46.html • Licensing ◦ http://choosealicense.com/ • Pip ◦ http://pip.readthedocs.org/en/stable/user_guide/
References • PyPi ◦ https://pypi.python.org • reStructuredText ◦ http://docutils.sourceforge.net/ •
Setup.py ◦ https://docs.python.org/2/distutils/setupscript.html • Virtualenv ◦ http://virtualenv.readthedocs.org/en/latest/userguide.html