Тёмный

my python project setup (+ all tools) (intermediate) anthony explains  

anthonywritescode
Подписаться 39 тыс.
Просмотров 21 тыс.
50% 1

today I go over all the tools I use to set up my projects, as well as the differences between 1-file libraries, multi-file libraries, and applications!
- python packaging src layout (which I don't use): • python packaging: src ...
- declarative metadata / setup.cfg: • python packaging: basi...
playlist: • anthony explains
==========
twitch: / anthonywritescode
dicsord: / discord
twitter: / codewithanthony
github: github.com/asottile
stream github: github.com/anthonywritescode
I won't ask for subscriptions / likes / comments in videos but it really helps the channel. If you have any suggestions or things you'd like to see please comment below!

Наука

Опубликовано:

 

15 фев 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 49   
@JohnZakaria
@JohnZakaria 2 года назад
Anthony is a living python legend. Wrote his own "black" Works on pytest, precommit. Still humble to teach us his ways. ♥️ Meanwhile my helloworld project never took off 😂
@jamesmunroe6558
@jamesmunroe6558 Год назад
Preach, friend! What a library of knowledge this one developer is!
@nexovec
@nexovec 2 года назад
"Hey, I wrote eveything except for the language itself, use my stuff, it's free..." legend.
@adityakumarseth8934
@adityakumarseth8934 Год назад
Man, I just feel like will I ever be even half the developer you are. You have such a vast knowledge base in python, CI, git and everything.
@francesconuzzo5883
@francesconuzzo5883 2 года назад
Damn, you developed all those amazing libraries? I can't thank you enough for pre-commit, so useful. This video was extremely educational and full of very valuable information, thank you!
@Bryft
@Bryft 2 года назад
Great video! I've looked at your config files before, and it all now makes more sense ;-]
@leiverandres
@leiverandres Год назад
You are great! Always high value content
@hasanulislam3112
@hasanulislam3112 2 года назад
Lovely! Pretty helpful content. Learns a lot.
@brodie659
@brodie659 2 года назад
I stumbled on your channel a few weeks ago and you have amazing content. I really appreciate you sharing your setup!
@esparafucio
@esparafucio 11 месяцев назад
I'm still a beginner so some parts flew over my head but this is inspiring stuff. A goal to work towards and use as a reference.
@hiyadmn9damy
@hiyadmn9damy 2 года назад
Very useful ,thans
@giovannipcarvalho
@giovannipcarvalho 2 года назад
I understood that you want to know when a dependency of your library becomes incompatible, but how do you track the last working (dependency) versions before said breakage? Also how does it affect your users at install time if the dependencies are not pinned? Sorry if I might have misunderstood this part. Thanks for the great video!
@anthonywritescode
@anthonywritescode 2 года назад
there's no need to track it, you can simply bisect the versions when a breakage occurs (and for the ~60ish libraries I maintain this has really only happened a handful of times in the last decade so it's not really worth any extra hassle). it doesn't really affect users if you don't pin, only if you do (where users will be often unable to install due to pip's conflict resolution)
@Alecor_studio
@Alecor_studio 2 года назад
Would you do a video about best practices migrating from old code to new? Example python 2 to 3 :D library dependencies?
@anthonywritescode
@anthonywritescode 2 года назад
I have a whole playlist about 2-to-3, though it's kind of old: ru-vid.com/group/PLWBKAf81pmOZOukFi2KyQJ7QMNDzcq2yT
@moonman8567
@moonman8567 Год назад
For applications would you consider using a pyproject.toml as standard for putting all requirements into one place (and the file can be used to configure other aspects) to reduce requirements file bloat?
@anthonywritescode
@anthonywritescode Год назад
no I would not -- did you watch the video? I showed my application setup as well
@subjekt5577
@subjekt5577 Год назад
Any reason you forego pyproject.toml completely? Or just historical inertia?
@teoconserv9954
@teoconserv9954 Год назад
How do you version, tag, package and release?
@anthonywritescode
@anthonywritescode Год назад
ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Gre2W5z4iLE.html
@matthiashomann6381
@matthiashomann6381 5 месяцев назад
For a single file library, isn't it possible to include `ty.typed` via the `[options.package_data]` section entry `astpretty = py.typed` ?
@anthonywritescode
@anthonywritescode 5 месяцев назад
it is not, try it
@StanislavSchmidt1
@StanislavSchmidt1 2 года назад
How do you run the code in the application project without installing it? By modifying PYTHONPATH? Or is it always single files that can be run as scripts?
@anthonywritescode
@anthonywritescode 2 года назад
`PYTHONPATH` is always wrong, and scripts are almost always wrong -- use `python -m module.name`
@StanislavSchmidt1
@StanislavSchmidt1 2 года назад
@@anthonywritescode Gotcha, thanks! I'm still wondering how one would deal with multiple source files and imports. E.g. if I have app/x.py and app/y.py running python -m app.x works, but writing "import y" in x.py doesn't. How would one go about structuring this?
@anthonywritescode
@anthonywritescode 2 года назад
always use absolute imports to import `app/y.py` you'd use `app.y` as your import
@StanislavSchmidt1
@StanislavSchmidt1 2 года назад
@@anthonywritescode that does the job, thanks :)
@ArielVolovik
@ArielVolovik 8 месяцев назад
If you dont pin dependencies for libraries, doesnt that mean that when you later clone a repo, you cant run it, because you wont knoe what dependencies you need to pip install?
@anthonywritescode
@anthonywritescode 8 месяцев назад
pinning means ==, the dependencies are still listed
@CushTuse
@CushTuse 2 года назад
a big +1 to single quotes. black's reasoning around double quotes is some of the dumbest I've read
@jrib
@jrib 2 года назад
In a single-file project with just a single test file at the root level, how do you exclude that test file from mypy?
@anthonywritescode
@anthonywritescode 2 года назад
I don't do that, but it's not different from what I show in the video
@jrib
@jrib 2 года назад
​@@anthonywritescode It is different in that your tests aren't typed. So you tell mypy to ignore the whole tests/ dir. Just wondering how to do that for single files. This doesn't work [mypy-test_file_name] disallow_untyped_defs = false
@anthonywritescode
@anthonywritescode 2 года назад
works fine for me, you must have a typo
@b_0rk
@b_0rk 2 года назад
Hello sir kindly would you consider relicensing all of your projects under the B0RK V1000 license
@anthonywritescode
@anthonywritescode 2 года назад
is it a derivative of the WTFPL?
@b_0rk
@b_0rk 2 года назад
@@anthonywritescode no, it's a derivative of Yu-Gi-Oh
@DavidDellsperger
@DavidDellsperger 2 года назад
But, what if I don't have tests because I write flawless code the first time?
@anthonywritescode
@anthonywritescode 2 года назад
couldn't be me
@hunnydoh
@hunnydoh 2 года назад
Speaking of favoring single files why not get rid of tox.ini and just incorporate into setup.cfg?
@anthonywritescode
@anthonywritescode 2 года назад
they have different interpolation modes
@hunnydoh
@hunnydoh 2 года назад
would be curious to know what the behavioral differences are then between setup.cfg and tox.ini. Other than cosmetic [tox:tox] in setup.cfg vs [tox] in tox.ini for example.
@anthonywritescode
@anthonywritescode 2 года назад
well for starters tox uses curly braces and setuptools uses % substitution and there's a lot of situations where one breaks the other. it's some of the motivation for using an actual structured data format (toml / etc.)
@jake115577
@jake115577 28 дней назад
You wrote pre-commit?? 😮
@longstoryveryshort
@longstoryveryshort 2 месяца назад
any updates since this upload?
@anthonywritescode
@anthonywritescode 2 месяца назад
still the same!
@MrHaste12
@MrHaste12 2 года назад
Hey Anthony, why did you stop using vim?
@anthonywritescode
@anthonywritescode 2 года назад
I never used vim
Далее
Setup a Python project with PDM
12:22
Просмотров 4,3 тыс.
15 Python Libraries You Should Know About
14:54
Просмотров 372 тыс.
Don't Use Pip For Big Projects - Use These Instead
7:56
100+ Linux Things you Need to Know
12:23
Просмотров 740 тыс.
why I will never use python-poetry
9:09
Просмотров 55 тыс.
Как разблокировать айфон?
0:27
Просмотров 154 тыс.