Podcasts about CPython

Python reference implementation

  • 29PODCASTS
  • 116EPISODES
  • 1h 2mAVG DURATION
  • 1EPISODE EVERY OTHER WEEK
  • Jul 5, 2025LATEST

POPULARITY

20172018201920202021202220232024


Best podcasts about CPython

Latest podcast episodes about CPython

捕蛇者说
Ep 55. 从文科转码到给 CPython 做贡献(纯文字稿)

捕蛇者说

Play Episode Listen Later Jul 5, 2025 0:10


本期节目应嘉宾的要求,我们只发布了文字稿。带来的不便还请各位听众谅解。 嘉宾 tanloong 链接 gh-133390: Support SQL keyword completion for sqlite3 CLI by tanloong · Pull Request #133393 · python/cpython SQLite Keywords QuantWiki - 中文量化百科 《阳光马达棒球场!》 文字稿 laike9m: 哈喽大家好,欢迎来到最新一期的《捕蛇者说》。我们今天请到了谭龙,然后让他来聊一聊给 CPython 做贡献的经历。谭龙其实最近给 CPython 提了一个 PR,然后也是他第一次给 CPython 做贡献。然后呢,这个贡献是给 SQLite 的那个命令行加了一些命令补全,就是可以补全 SQLite 的关键字。我们今天另外一位主播是 Manjusaka。 Manjusaka: 请叫我 Nadeshiko Manju,对吧?OK,大家好,好久不见,我又回来了。然后今天很高兴又来和 laike9m 进行搭档,来。 laike9m: 好,然后这是我们今天的嘉宾谭龙,你要不先简单介绍一下自己吧。 tanloong: Hello,大家好,我叫谭龙,我是山东的。然后 18 年的时候是来青岛上大学,然后大学本科毕业之后就在这找工作了。我本科不是计算机的,毕业之后找工作也找了一些计算机相关的工作,也有一些其他方面的工作,中间也换了好几次工作。最近是刚刚入职一家新的公司,然后是做数据分析方面的工作。谢谢。 laike9m: 所以你说你本科不是学计算机,方便透露一下吗?你本科学的是什么? tanloong: 我本科是英语的。 laike9m: 哦,这个跨度很大。 tanloong: 对,确实。其实我本科最开始填志愿的时候,我录取的专业也不是英语,是一个调剂的专业,叫生态学。然后我是大一下学期的时候想转专业,然后正好我们学校有转专业的政策,我就从高中学的那几门课里,我觉得英语我学得还可以,然后当时也比较喜欢,所以我就决定转英语了。直到后来快毕业的时候才有点接触到这个计算机方面的这个东西。 laike9m: 然后就发现自己还是更喜欢计算机一些。那所以你之后是进行一些自学吗?然后就去找工作还是? tanloong: 对,基本上是自学。最开始接触计算机是大一的寒假,我们辅导员让学生回家的时候在假期要学点东西,然后开学让交学习笔记。我当时从一个中国大学 MOOC 上注册了一个账号,然后它弹出来的,第一个给我推荐的课程就是 Python。那我就学这个吧。所以当时我就学,就学了这个。当时学得很不明白,然后就把 PPT 跟着敲了一遍,但是也云里雾里的。直到后来后面的几个寒暑假才看了一些成体系的 Python 的入门的书,然后算是入门 Python 了。 laike9m: 所以换句话说就是你其实一开始学,你并不知道 Python 是干嘛的,就是并没有特别地抱着某种目的,比如说我就想找一个程序员的工作这样子。 tanloong: 没有,开始的原因只是巧合,但后面坚持下来,应该也算是因为比较喜欢吧。我觉得比较有意思。 laike9m: 那还是挺有意思的,对,感觉是命运的安排。 Manjusaka: 咱行看起来都是转行的。诶,那 laike9m 你是转行吗? laike9m: 我本科也不是学计算机的,然后我知道你本科也不是,所以。 Manjusaka: 对,那看起来大家这三个人跟少女乐队一样,这三个人里面抽不出一张计算机本科学位。 laike9m: 对,但我觉得还是你的英语这个跨度最大。 Manjusaka: 啊,对,然后,哇,卧槽。啊,现在要是学日语的,我突然就想问一下为什么要学日语。 laike9m: 学日语的转计算机还真没见过,但是很多程序员都会日语。 Manjusaka: 有,可能在大连那边还真有。 laike9m: 啊,对,大连日本人比较多。 Manjusaka: 对,对,对,日语外包会多一些。 laike9m: 嗯,好,对,说回正题,就是你相当于一开始接触的编程语言就是 Python, 然后后来相当于你在工作中可以理解也是主要用 Python, 对吗? tanloong: 对的,我有两份工作是跟计算机相关,然后都是写 Python 的。第一个工作是之前的一份是写图形界面的,用的是 PySide, 然后就写一个称重系统。他们是一个建桥公司,就是他们需要统计他们的货车送多少货进他们工厂,然后运多少货出来,写一个这个图形界面,然后放在那个他们的磅站去,然后货车过磅的时候来统计数据。另一个工作是现在的工作是在一个私募公司做数据分析。我之前没接触过股票证券这方面的东西,现在还在学习。 laike9m: 你是开发算法吗,还是给他们开发一些内部工具或者界面之类的? tanloong: 内部工具,我们组三个人有写算法的,但是我是属于比较初级的那种,只能写一些帮他们节省时间的工具。 laike9m: OK,对,因为我感觉那种像交易的算法可能更需要用 C++ 一些,对吧?还是说其实也有用 Python,比较好奇。 tanloong: 我们公司开发部应该是写 C++ 的,然后应该也有写 Python, 但是数据分析我们那个组主要是做一些因子的构建,就分析哪些因子它对你的这个股票的收益率贡献比较大,就这种的,我们就主要是写 Python,不写 C++。 laike9m: 明白,好的。所以就是到了今天我们要聊这个话题,然后你给 CPython 做了一个贡献。那我相信就是百分之可能 99.99% 的用过 Python 的人都没有给 Python 做过贡献,那么你一开始是怎么有这个想法的?然后就是后来你是怎么去一步一步实施这个的? tanloong: 我最开始有这个想法是应该从天哥,就是 B 站的那个,对,他当时成为 Python Core Dev 之后,在直播的时候就有人在直播间问一个给 Python 做贡献的问题,做贡献难不难呢?这些之类的。但是天哥说,如果你想给 Python 做贡献,你是会发现有很多事可以做的,做贡献并不难。然后后来就是之前我在写称重系统的时候,需要用到 SQLite 去查用户存的那个本地的数据库。然后当时我就发现 Python 的 SQLite 的命令行界面有点不好使,就是如果它能有那个补全就好了,所以当时是有那个想法。然后实施是在后来我前段时间没有工作,然后就每天比较闲,然后我想找点事做,然后我想起来之前我想给那个 SQLite 的加补全的这个想法,我就试试吧。然后我就去 GitHub 上找,我就试了一下。然后试的时候我发现,我本来觉得这个应该是挺难的,因为我完全不知道它这个补全要怎么实现。但是我去看了一下 PDB,就是天哥维护的那个 PDB 里面的代码,它里面实现补全是那样写的,然后我就照着 PDB 的补全,然后给 SQLite 加了一个补全,然后就交了 PR。 laike9m: 所以其实也是从你的实际工作需求出发,然后加上高天的激励。对,你知道高天也来过我们这边好几次吧? tanloong: 对,两次。 laike9m: 老听众,看来是。对,然后我觉得这个还挺有意思,就是也是算是榜样的力量吧。就是我不知道还有没有其他人是这样,就是因为听到就是有个人跟他说,哎,其实做贡献没有那么难,然后去做了,但这样挺好的。我算吧。你也算吗? Manjusaka: 对,我算。当时我是先认识张翔老师,然后后面然后跟他聊了一些,就包括我可能当时,那位你可能还认识,那个 Ezio Melotti。谁?18 年北京的那位嘉宾,Ezio。 laike9m: 你说 PyCon。 Manjusaka: 对,就是当时我们不是邀请到另外一位来北京。 laike9m: 哦。PyCon China Beijing 2018。2018 吗?2018 我去了吗?我有点不记得了。没事你继续说吧。 Manjusaka: 你在北京,你当时还没 transfer 去美国,然后你从上海来北京。 laike9m: OK。 Manjusaka: 然后我当时聊了一下,就后面开始,正好 18 年,后面我就说我正好在休息,后面就开始陆陆续续提一些贡献,对。 laike9m: 嗯,对对,其实我觉得翔哥一定程度上也是当时给了我一些激励或者指导嘛,对。 Manjusaka: 对,张翔老师还是非常 nice 的。 laike9m: 对,就给听众们如果有不知道,就是张翔是中国的第一个 CPython core developer, 第一个核心开发者,对,然后高天是第二个。 Manjusaka: 对,然后张翔老师应该是在 16 年晋升的。嗯,反正是老前辈了,老前辈了。 laike9m: 但其实他当时就是更多是因为工作中会需要改一些 CPython 代码,他当时在华为嘛,对吧? Manjusaka: 然后。哦,不不不,他晋升成为 CPython Core 的时候,我记得没错,是在新浪,然后他就开始编的。 laike9m: 哦,新浪,OK。 Manjusaka: 对,然后他去华为其实做的也不是跟 CPython 本身相关的,他是去做的 OpenStack 相关的东西。对,然后他对就是说是整个生态工具链会比较熟,所以说他可能跟高天老师就是说是有一点不一样,是张翔老师对于各种非常疑难问题的 debug 非常擅长,这也是我记得介绍人给他在他的 promote 介绍里面说的,对。 laike9m: 嗯,我记得他当时那个演讲。 Manjusaka: 对对对,然后我的很多 debug 技巧也来自于张翔老师,对。 laike9m: Anyway,我觉得后人都是在前人的一些基础上去做工作的。 Manjusaka: 是的,没错。 laike9m: 好,那说回谭龙的这个 PR,我其实也简单看了一下,其实我原来也不知道补全要怎么加,但发现其实还真的挺简单的。你可以跟听众们大概说一下这个流程吗?比如说我要给一个像 Python 的 SQLite 命令行加补全,它大概要做些什么工作? tanloong: 它是写一个 context manager,然后在你进那个 readline 的时候,你把 readline 的那个 completor 给替换成你自己的函数,然后在退出的时候再把它替换回你替换之前的那个函数,就你替换之前的那种 readline 的默认的 completor。然后你自己写的那个函数是还有一个 state, 就是 readline 调你的函数拿补全的时候,它会先给你发一个 state 等于 0, 这个时候你判断了 state 等于 0 的时候,你去生成一个完整的,就根据用户当前输入的那个 text, 生成一个完整的 completion candidate 的列表。然后 readline 会继续给你发 state 等于 1, 2, 3,这个时候你把你之前生成的 candidates 按照它发的 state 做个 index, 返回你的 candidates 对应的要补全的词。然后这中间就是 state=0 的时候,你的 candidates 最好需要缓存一下,不要在每次 readline 给你发 state=1, 2, 3 的时候你再重新生成,那样会比较耗时间,注意一下性能的问题。然后基本就是这样。 laike9m: OK,我说一下我看到的那个 PR 里面,我觉得比较关键的地方就是它其实就是一个首字母的匹配,就相当于首先你有一个关键词的列表,对吧?你要构建一个说哪些单词是 SQLite 关键词,比如说 SELECT 啊 JOIN 这种。然后我发现你是当用户每输入一个字符,然后你就会去跟这些关键词的前缀做一个匹配,对吧?然后发现如果有能 match 上的,你就把它作为一个 candidate 返回,作为补全的一个。 tanloong: 就其实那个关键字最开始的,你要拿到那个 SQLite 的完整的关键字的列表,当时对我来说还是挺难的。我最开始是从 SQLite 的文档里直接复制它的完整的所有的 147 个关键字,然后硬编码到 Python 里。但是有 core dev 说这样写不太好,而且其中有一个关键字并不是在所有的 SQLite 编译出来的时候都会支持的,是一个 V 开头的关键字。希望就是这个 SQLite 这个关键字能够动态生成。然后我当时查了一下,就是如果你想动态生成需要在 C level 去写,但是我这个 C 学的不太好,虽然之前学过一个学期的公开课,但是我完全不知道就是用我查到的 SQLite 文档里说生成关键字列表的那两个函数,去生产,我不知道要怎么写,然后我也不知道怎么把它放进 Python, 所以我当时说这个对我有点难。后来有一天晚上我看到那个消息里,那位 core dev 又说了一遍,就是非常希望这个关键字列表它是能从 C 里拿到的,而不是从 Python 里拿。我当时其实有点理解错了,我以为他的意思是让我把那个硬编码的关键字列表从 Python 给移到 C 里,然后我当时就把它移到 C 里了。虽然我对那个 Python 的 C 要怎么写,然后怎么把它暴露出来,暴露给 Python 的代码去能够访问,我用了一下 AI,当时是用的豆包,问怎么在 Python 的那个 C 里面存一个列表,然后能让它暴露出来,给 Python 的代码调用。然后当时豆包写上,然后我试了一下豆包给的结果,然后是可以的,然后我就直接硬编码到 C 里,然后问那个 core dev 行不行。但是 core dev 后来回复说他的意思是不是在 C 里硬编码,而是在 C 里要动态生成。当时我就,我感觉我理解错了。然后后来是另一位 core dev 帮忙给写的,然后他写了之后给发了一个 PR 到我的那个 fork 里,然后我合并进去,然后我的 fork 再合并到 CPython 的 main。 laike9m: 我还在想,就是因为我也看到你的那个 keywords 那部分是从 C 的 module 里 import 的。这个他当时说为什么要动态生成,其实我还是不太理解。可能就是 OK,我明白,但就是你编译的时候,你会根据你的 CPython 版本有不同的关键词,这样你就不用在那个 Python 里面写,比如说 if 是什么版本,然后你的关键字要加或者减一些东西是吧? tanloong: 对的,SQLite 它应该是在编译的时候有一个选项,如果你开了某个选项,那么它的关键词会有变化。 laike9m: 明白明白。 tanloong: 哦。 laike9m: 这个确实还挺 tricky 的,对,感觉是这个 PR 里面最困难的部分。 tanloong: 确实。 Manjusaka: 嗯。 laike9m: 那所以就是总体这个流程下来你有什么感受吗?因为我知道你的那个 PR 还被因为把 test break 了还被 revert 了一次,对吧? tanloong: 对,它是有一个测试在运行那个 run_pty 的时候,它是用那个 run_pty 生成一个 sudo terminal, 就在一个伪终端里去模拟用户的输入,然后查看它给的 candidates 是不是符合预期。但是在那个伪终端里,它给的 candidates 是带颜色的。就是你的 candidates,它的两边会有那个控制符。 laike9m: 它那个颜色码嘛,然后就不对了。 tanloong: 对,然后测试就 fail 了。当时是在那个 buildbot 上跑构建,就是构建失败,我找了一下,但是我想就是在那个 buildbot 上最好能有一个 interactive 的,就我能像在终端里我手动敲命令一样,我可以人为的去测试,然后看一下它中间到底是什么样子,再修改那个测试。但是 buildbot 我找不到我要怎么就进那个交互式的模式,也可能根本就没有。然后这个问题我解决不了。然后当时是有个 core dev 说他去找那个 buildbot 的 owner,然后问他要 SSH 的权限,然后他去调试。 laike9m: 等一下,我有一个疑问,就是为什么你这个 PR 感觉大家都很 helpful? 因为你知道一般的 CPython PR 就是你提了之后,可能很长时间都没有人理。这点你是怎么看的?就是感觉大家都会去帮你去 debug 或者帮你写些代码,这个是自然的吗?还是说他们本来就对这个很有兴趣还是怎么样? Manjusaka: 嗯,从我的角度出发的话,我不太确定,高天老师那边可能有其他的 input, 但是就我观察来看,这个取决于 core dev 风格。不过他们整体来说,对新人是比较友好的。而且去 buildbot 里面调试这种东西的话,我觉得这个东西其实也还好,你去翻看 CPython 的 PR 其实这种事情也有不少,所以说我觉得这个相对来说还好。但是对于一些争议或者说是还在试图达成共识的过程中,那确实是比较头疼的。但是如果说是已经达成共识要去实施的一个 PR, 那我觉得相对来说会好一些。 laike9m: 明白,所以就是这种没有什么争议性的,只是实现或者一些 debug 问题就会推进的比较快,然后大家也会帮忙。 Manjusaka: 对,而且这种东西我理解主要是你添加新的 feature,而不是更改 API 的话,那这种东西就会好很多。就像我上周的时候,我当时想改 sys._enable_profile() 那个 API, 就是新增加的那个远程 debug 的接口,我想新增加在它的 audit event 里面增加一些元数据。这就牵扯到了 API 的更改以及更内部的一些细节上的更改。然后我就和三个 core dev,然后 Victor, Paul,还有哪一位,然后就 battle 了两天,然后最后 I gave up。 laike9m: 好吧,他们可能有一些 concern。 Manjusaka: 对,就这种你增加一些新的 API 之类的,就是会有一些比较 concern, 但是如果说你是实现一个全新的 feature, 大家觉得你这个 feature 不是为了实现而去实现,那这种情况下相对来说还是会比较顺利的。 laike9m: 嗯,嗯,理解。还有一点就是我知道那个 CPython 的不同模块,它其实是不同的人来维护的嘛。 Manjusaka: 啊,是的,没错。 laike9m: 就可能恰好就是 SQLite 这个维护者,他就是比较积极,比较热心,就是反应比较快,所以。 Manjusaka: 啊,是的,没错。它是比较活跃的,就是 SQLite 这种东西。我就又说到一个伤心事。在改一个东西,然后被 Mark 直接给拒了,然后我现在都还推不动,虽然大家都说有需求,但是 Mark 就觉得说这个东西没需求,然后但是就给拒了,对。 laike9m: 我知道 Mark Shannon 这个人比较固执,对,也是跟人的性格有很大关系。 Manjusaka: 对,是的,没错,跟这个看具体的开发者的问题,对。 laike9m: 对,就是其实你会发现像 Python,如果你不了解,可能会觉得 Python 是一个有一个很庞大团队去维护的这么一个精密复杂的系统,但你真正去看它里面到底是怎么实现的,或者说去提 PR 才会发现可能每一个文件它就是那么一两个人懂,然后你就是要找那一两个 stakeholder, 如果你想做一些更改的话,然后你只要能比如说说服他们,然后你就可以做你想做的。对,它相当的扁平吧。 Manjusaka: 对,我觉得主要还是怎么说服。 laike9m: OK,所以说回谭龙你这个 PR 的话,然后就你把那个 core developer 帮你把测试修好了,对吧?然后你就重新提交,这样子。 tanloong: 对的。就我感觉给 CPython 这个维护者,在这些维护者之间就是它是有一个小圈子的,然后你作为一个新人去给他们交 PR 也是一个交际的过程。就是你要积极主动一点,然后就一般新人你第一次交 PR 的时候,比较容易会被带着审视的态度去看你的工作。然后你交 PR 的时候,你最好是把你之前想到的一些可能会拒绝你 PR 的理由给解释清楚,然后你为什么这样做,然后让他们就是在他们提出问题之前就看到你的解释,这样会就是更容易沟通,然后更容易让你的 PR 更顺利一点。 Manjusaka: 嗯,对。 laike9m: 我看到你其实你之前提了一个 issue 对吧,就是你说你希望能够在 SQLite 的命令行里支持这些补全。所以你提那个 issue 的时候当时就想说自己去实现这个吗?还是说你本来期待说其他人可以去做这个? tanloong: 是的,我是准备自己实现的。因为 Python 的 dev guide 里面写,如果你想交一个 PR,你应该先写一个 issue, 除非你交的 PR 是 typo fix。所以我就是先写的那个 issue,然后就紧接着交了 PR。当然那个 issue 题目写得有点大了,我那个 PR 只做了关键字的补全,但是 issue 是所有的补全。比如说你以后也许还会需要补全你的那个 SQLite 里面的表名,还有列名,还有函数名,这些目前还不支持。 Manjusaka: 明白。 laike9m: 所以你未来打算就是继续在这方面做一些事情吗?还是说就先到此为止? tanloong: 也许会吧。但是这个刚才说的表名、列名、函数名,我目前还没有想到就是要怎么才能实现它。我看到就是 Python 的 PyPI 上有一个第三方的 SQLite 的命令行是支持表名、列名、函数名的,而且它是 context-sensitive,就是它会检测你当前是不是需要输入一个表名或者列名,比如说你是在 SELECT 后面,那它就会给你补全列名。就像这种就是非常智能的补全,我还没有想到就是怎么在 CPython 里支持,也许没有那个能力去支持它,总之就是还不确定。 laike9m: 明白。对,那个可能要就是回溯一下,不光得去做一个前缀匹配,对,会更复杂一点感觉。但我觉得是一个好的开始吧,就是你有一个这种框架,就会有更多人去加更多的 feature 进去。也许未来就会有。 tanloong: 是的,确实。就那个关键字的 PR 合进去之后,过了几天,有另一位 contributor 交了一个 dot commands completion 的 PR, 现在给加了那个 dot commands 的补全。目前 Python 的 SQLite 的命令行就有三个 dot commands,就是 .help, .version, .exit。.exit 还是 .quit 就来着,总之是推出的那个 .command。然后那个 PR 现在正是就是刚刚建不久,然后还没有 core dev 留言,但是它实现的有一点简单,就是有一些问题,但是应该后面会就是慢慢给修上,然后给合进去。 laike9m: 其实你可以去那个 review,因为你比较熟,你是最熟的其实。 tanloong: 是,我还真给看了一下,然后写了两个评论。但是写的第一个评论就是那位交 PR 的人,他觉得没有必要,就是他持反对意见。然后第二个评论,那位交 PR 的人还没有回复,然后其他人也没有回复。 laike9m: 嗯,我觉得挺好,就是因为我知道就是如果你比如说在一些 issue 里面回复的比较多,然后就会被那个提拔成 triager 的权限,对吧?然后其实这个是 core dev 之前的一步。 tanloong: 对,确实。然后我看就是交那个 dot command completion PR 的那个人,他的评论比较多,一般 CPython 有什么新的 issue,他都会先跑到底下去评论,然后有时候评论这个 issue 和之前的某个 issue 有联系。就像这种之类的,或者有人交 PR,然后他会去给 review。但是我还没有太多追踪 CPython 的那些 issue 和 PR,然后没有评论多少,就主要是我自己参与的那些 issue 跟 PR。 laike9m: 对,我觉得每个人有不同的风格吧,也不用一定去迫使自己要怎么样之类的。像高天那种,就是从 PDB 模块开始,然后把 PDB 弄得特别熟,然后通过成为 PDB 的维护者,然后来成为 core dev,这个路径也挺好的。我觉得可能更实际一点吧,因为我觉得你要去就是对于一些每一个 change 做一些评论,这个还挺难的。 tanloong: 确实从一个单独的模块开始做,你确实你的那个在 CPython 社区里面的成长会更容易一点。因为你是这个模块的专家,然后别人有什么问题就只能来找你。但是我也觉得这个也挺难的。天哥是从一个完全的 CPython 的陌生人,然后进入到 CPython 一点点做贡献,最后成为 core dev。就像你从一个外人进一家公司,然后慢慢走到管理层,都是非常难的步骤,你要获得信任,然后你做的每一个工作你都要给解释清楚,然后让别人就是认为你是可以承担更重要的角色。我觉得这也是非常难的一个过程。 laike9m: 嗯,是的是的。对,其实说回来就是那个,像给 CPython 做贡献不光是一个技术面上的事情,它还有很多这种交流,对吧?然后尤其是当你和这些外国人交流,你不是用你的母语,然后他们的一些交流的习惯可能也不太一样,所以这个方面也会有一些壁垒吧?就是谭龙,因为你是英文专业,所以这方面你觉得说你的本科教育有帮到你吗? tanloong: 我觉得是有的。如果我没有选英语专业,我应该还停留在高中的那个状态,就是虽然当时英文成绩还可以,但是如果让我看一个全英文的网站,我是心里发怵的,我是心里有那个牴触的心理。但是大学接触英语比较多,然后主要是你抵触心理没有了,然后你愿意去哪怕接受自己写出来的英语没有那么完美,哪怕也不像母语,也不够 native-like, 你也可以接受自己写出来的这些句子,然后去交流。因为你只要能把意思给表达清楚,让对方看懂就可以。其实你放下这个心理负担,你会发现写英语还是没有那么难的。 laike9m: 是的,是的,同意,对。 Manjusaka: 我现在是有一个做简单的 workflow, 然后我会交给 AI 来帮我润色,然后扩展一下我单纯的观点。对,我觉得这是 AI 的一个很好的使用场景。 laike9m: 你用的是哪个工具呢?还是就是手动复制? Manjusaka: 我是直接在 Claude AI 上面给他固定了一组 prompt。 laike9m: 明白,明白。 Manjusaka: 我觉得这就是这一块东西很好用的方式,特别是在我跟他们长篇大论地 battle 的时候,还是挺好用的。 laike9m: 帮我写一个回复去反驳这个人。 Manjusaka: 对,我一般是 prompt 就是说是我引用的那一段,然后我首先给他一个正面的肯定,然后其次列出我对他的观点,一 ABC,然后对,然后就这样。 laike9m: 你写 prompt 的时候是拿中文写吗? Manjusaka: 我拿中文写。 laike9m: 嗯,OK,这样表意更准确一些。 Manjusaka: 对对对,你可以看我群里发的那个 issue,然后那个就是很多大段的,就是我是用 AI 生成出来的。 laike9m: 我想到之前在推特上看到一个段子,就是说在 AI coding 的时代,以前不都是什么 “Talk is cheap, show me the code” 吗?现在是 “Code is cheap, show me the talk”。 Manjusaka: 确实。Code is cheap, show me the talk. laike9m: 一个哥们他在他的 GitHub repo 里面就是把所有的他的那个跟 AI 的聊天记录全都传上去了。这个就是挺好玩的。 Manjusaka: 挺好玩的,挺好玩的。 laike9m: 对,像谭龙,我觉得你之前本来要在 C 模块里面写死 keyword 的时候,你也是用 AI 生成的,虽然后来发现那个路径是不对的,但是至少这方面 AI 的助力还是挺大的。 tanloong: 确实,如果我当时在紧接着问 AI 怎么不要硬编码,然后整个动态生成的话,也许我当时就能直接把动态生成的代码给交进去了,而不是让另一位 core dev 帮忙给写。嗯。 Manjusaka: 是的。 laike9m: 所以就是你对于这个给 CPython 第一次做贡献的这个流程,你有什么其他的一些感受吗?就是我们刚才还没有聊到的,你想分享的。 tanloong: 我没有了。 laike9m: 哦,行,那也没关系,好。我们也是觉得给 CPython 做贡献的人越多越好,然后可能也是能够给听众们一个激励吧。然后感觉这期其实录的挺快的,然后不知道有没有什么你想推荐的东西,就是如果你听我们之前节目的话,你应该知道有这个环节,对吧? tanloong: 我推荐一个网站是跟量化金融有关的,算是一个给入门的学习者的一个索引吧。那个网站叫 QuantWiki。是量化金融中文百科,然后里面有一些就是量化金融相关的入门的概念,还有一些前沿的证券公司发的研究报告,还收录了其他的类似的 Python Data Training 这方面的 GitHub 的 repo 的链接。如果是这方面像我这样的刚入门的学习者的话,可以就是了解一下。 laike9m: 我看了一下,这个写的还挺好的,就是他把各种概念和一些工具都列出来了,对。嗯,我们之前也请过大伟来聊,就是他开发了一些交易相关的工具,所以其实这方面 Python 应用也是挺多的,对。 Manjusaka: 哎,反正我觉得给 Python 做贡献,就觉得还是希望像谭龙这样的人越来越多。是的,是的。对,而且现在他们就感觉是整体都非常缺人的感觉。 laike9m: 哪个看上去像不缺人? Manjusaka: 嗯,这倒也是,确实。反正就之前我给 Brandon 和 Ken Jin 然后请教问题的时候他们都表示很新奇,我操居然还有 Freshman 对我们现在做的这块感兴趣。对,居然还有新人对我们感兴趣?Freshman,哦 Freshman。啊对,反正我觉得从他们视野来看,就整体的很多的地方都会很缺人。 laike9m: 嗯,是的是的,尤其是像你做的那些 debugging 啊,然后 tracing 的一些东西,我觉得懂的人真的很少。 Manjusaka: 我觉得就没人管的状态。而且就我现在对他们的 tracing 的部分有很大的怨言,就主要是 Mark 上面说... 哎,我后面会试着再推一推,但是就哎,随缘吧。 laike9m: 嗯,行。好的。Manjusaka 你有没有什么想推荐的东西。 Manjusaka: 我推荐一部番吧,《阳光马达棒球场!》,非常很不错的一部番,我推荐大家去看看。然后可能国内有很多朋友对于传统的国外的可能说足球或者其他也好,这种体育文化他并不清楚,这种体育文化到底应该是怎么样的,它是怎么样遍布在人的日常生活中的,然后有些人不清楚,那么我建议大家可以去看一下,然后挺治愈的一部番。 laike9m: 嗯,好的好的。啊,我先不推荐了吧,以后再说吧。对,我最近在看一些书,但是还没有看完,所以,对。好,其实我们这期是比较短的一期,然后但是也希望听众们可以从中学到一些东西,然后如果要记住一点的话,就是可能给 CPython 做贡献也没有那么难。对,好,我们这期就到此结束,然后各位听众我们就下期再见,大家拜拜。 众人: 拜拜。

Talk Python To Me - Python conversations for passionate developers
#512: Building a JIT Compiler for CPython

Talk Python To Me - Python conversations for passionate developers

Play Episode Listen Later Jul 2, 2025 68:18 Transcription Available


Do you like to dive into the details and intricacies of how Python executes and how we can optimize it? Well, do I have an episode for you. We welcome back Brandt Bucher to give us an update on the upcoming JIT compiler for Python and why it differs from JITs for languages such as C# and Java. Episode sponsors Posit Talk Python Courses Links from the show Brandt Bucher: github.com/brandtbucher PyCon Talk: What they don't tell you about building a JIT compiler for CPython: youtube.com Specializing, Adaptive Interpreter Episode: talkpython.fm Watch this episode on YouTube: youtube.com Episode #512 deep-dive: talkpython.fm/512 Episode transcripts: talkpython.fm --- Stay in touch with us --- Subscribe to Talk Python on YouTube: youtube.com Talk Python on Bluesky: @talkpython.fm at bsky.app Talk Python on Mastodon: talkpython Michael on Bluesky: @mkennedy.codes at bsky.app Michael on Mastodon: mkennedy

Python Bytes
#436 Slow tests go last

Python Bytes

Play Episode Listen Later Jun 16, 2025 36:43 Transcription Available


Topics covered in this episode: * Free-threaded Python no longer “experimental” as of Python 3.14* typed-ffmpeg pyleak * Optimizing Test Execution: Running live_server Tests Last with pytest* Extras Joke Watch on YouTube About the show Sponsored by PropelAuth: pythonbytes.fm/propelauth66 Connect with the hosts Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky) Brian: @brianokken@fosstodon.org / @brianokken.bsky.social Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky) Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Brian #1: Free-threaded Python no longer “experimental” as of Python 3.14 “PEP 779 ("Criteria for supported status for free-threaded Python") has been accepted, which means free-threaded Python is now a supported build!” - Hugo van Kemenade PEP 779 – Criteria for supported status for free-threaded Python As noted in the discussion of PEP 779, “The Steering Council (SC) approves PEP 779, with the effect of removing the “experimental” tag from the free-threaded build of Python 3.14.” We are in Phase II then. “We are confident that the project is on the right path, and we appreciate the continued dedication from everyone working to make free-threading ready for broader adoption across the Python community.” “Keep in mind that any decision to transition to Phase III, with free-threading as the default or sole build of Python is still undecided, and dependent on many factors both within CPython itself and the community. We leave that decision for the future.” How long will all this take? According to Thomas Wouters, a few years, at least: “In other words: it'll be a few years at least. It can't happen before 3.16 (because we won't have Stable ABI support until 15) and may well take longer.” Michael #2: typed-ffmpeg typed-ffmpeg offers a modern, Pythonic interface to FFmpeg, providing extensive support for complex filters with detailed typing and documentation. Inspired by ffmpeg-python, this package enhances functionality by addressing common limitations, such as lack of IDE integration and comprehensive typing, while also introducing new features like JSON serialization of filter graphs and automatic FFmpeg validation. Features : Zero Dependencies: Built purely with the Python standard library, ensuring maximum compatibility and security. User-Friendly: Simplifies the construction of filter graphs with an intuitive Pythonic interface. Comprehensive FFmpeg Filter Support: Out-of-the-box support for most FFmpeg filters, with IDE auto-completion. Integrated Documentation: In-line docstrings provide immediate reference for filter usage, reducing the need to consult external documentation. Robust Typing: Offers static and dynamic type checking, enhancing code reliability and development experience. Filter Graph Serialization: Enables saving and reloading of filter graphs in JSON format for ease of use and repeatability. Graph Visualization: Leverages graphviz for visual representation, aiding in understanding and debugging. Validation and Auto-correction: Assists in identifying and fixing errors within filter graphs. Input and Output Options Support: Provide a more comprehensive interface for input and output options, including support for additional codecs and formats. Partial Evaluation: Enhance the flexibility of filter graphs by enabling partial evaluation, allowing for modular construction and reuse. Media File Analysis: Built-in support for analyzing media files using FFmpeg's ffprobe utility, providing detailed metadata extraction with both dictionary and dataclass interfaces. Michael #3: pyleak Detect leaked asyncio tasks, threads, and event loop blocking with stack trace in Python. Inspired by goleak. Use as context managers or function dectorators When using no_task_leaks, you get detailed stack trace information showing exactly where leaked tasks are executing and where they were created. Even has great examples and a pytest plugin. Brian #4: Optimizing Test Execution: Running live_server Tests Last with pytest Tim Kamanin “When working with Django applications, it's common to have a mix of fast unit tests and slower end-to-end (E2E) tests that use pytest's live_server fixture and browser automation tools like Playwright or Selenium. ” Tim is running E2E tests last for Faster feedback from quick tests To not tie up resources early in the test suite. He did this with custom “e2e” marker Implementing a pytest_collection_modifyitems hook function to look for tests using the live_server fixture, and for them automatically add the e2e marker to those tests move those tests to the end The reason for the marker is to be able to Just run e2e tests with -m e2e Avoid running them sometimes with -m "not e2e" Cool small writeup. The technique works for any system that has some tests that are slower or resource bound based on a particular fixture or set of fixtures. Extras Brian: Is Free-Threading Our Only Option? - Interesting discussion started by Eric Snow and recommended by John Hagen Free-threaded Python on GitHub Actions - How to add FT tests to your projects, by Hugo van Kemenade Michael: New course! LLM Building Blocks in Python Talk Python Deep Dives Complete: 600K Words of Talk Python Insights .folders on Linux Write up on XDG for Python devs. They keep pulling me back - ChatGPT Pro with o3-pro Python Bytes is the #1 Python news podcast and #17 of all tech news podcasts. Python 3.13.4, 3.12.11, 3.11.13, 3.10.18 and 3.9.23 are now available Python 3.13.5 is now available! Joke: Naming is hard

Python Bytes
#432 How To Fix Your Computer

Python Bytes

Play Episode Listen Later May 19, 2025 25:48 Transcription Available


Topics covered in this episode: pre-commit: install with uv PEP 773: A Python Installation Manager for Windows (Accepted) Changes for Textual The Best Programmers I Know Extras Joke Watch on YouTube About the show Sponsored by NordLayer: pythonbytes.fm/nordlayer Connect with the hosts Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky) Brian: @brianokken@fosstodon.org / @brianokken.bsky.social Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky) Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Brian #1: pre-commit: install with uv Adam Johnson uv tool works great at keeping tools you use on lots of projects up to date quickly, why not use it for pre-commit. The extension of pre-commit-uv will use uv to create virtual environments and install packages fore pre-commit. This speeds up initial pre-commit cache creation. However, Adam is recommending this flavor of using pre-commit because it's just plain easier to install pre-commit and dependencies than the official pre-commit install guide. Win-win. Side note: No Adam, I'm not going to pronounce uv “uhv”, I'll stick with “you vee”, even Astral tells me I'm wrong Michael #2: PEP 773: A Python Installation Manager for Windows (Accepted) via pycoders newsletter One manager to rule them all – PyManager. PEP 773 replaces all existing Windows installers (.exe “traditional” bundle, per-version Windows Store apps, and the separate py.exe launcher) with a single MSIX app called Python Install Manager (nick-named PyManager). PyManager should be mainstream by CPython 3.15, and the traditional installer disappears no earlier than 3.16 (≈ mid-2027). Simple, predictable commands. python → launches “the best” runtime already present or auto-installs the latest CPython if none is found. py → same launcher as today plus management sub-commands: py install, py uninstall, py list, py exec, py help. Optional python3 and python3.x aliases can be enabled by adding one extra PATH entry. Michael #3: Changes for Textual Bittersweet news: the business experiment ends, but the code lives on. Textual began as a hobby project layered on top of Rich, but it has grown into a mature, “makes-the-terminal-do-the-impossible” TUI framework with an active community and standout documentation. Despite Textual's technical success, the team couldn't pinpoint a single pain-point big enough to sustain a business model, so the company will wind down in the coming weeks. The projects themselves aren't going anywhere: they're stable, battle-tested, and will continue under the stewardship of the original author and the broader community. Brian #4: The Best Programmers I Know Matthias Endler “I have met a lot of developers in my life. Lately, I asked myself: “What does it take to be one of the best? What do they all have in common?”” The list Read the reference Know your tools really well Read the error message Break down problems Don't be afraid to get your hands dirty Always help others Write Never stop learning Status doesn't matter Build a reputation Have patience Never blame the computer Don't be afraid to say “I don't know” Don't guess Keep it simple Each topic has a short discussion. So don't just ready the bullet points, check out the article. Extras Brian: I had a great time in Munich last week. I a talk at a company event, met with tons of people, and had a great time. The best part was connecting with people from different divisions working on similar problems. I love the idea of internal conferences to get people to self organize by topic and meet people they wouldn't otherwise, to share ideas. Also got started working on a second book on the plane trip back. Michael: Talk Python Clips (e.g. mullet) Embrace your cloud firewall (example). Python 3.14.0 beta 1 is here Congrats to the new PSF Fellows. Cancelled faster CPython https://bsky.app/profile/snarky.ca/post/3lp5w5j5tws2i Joke: How To Fix Your Computer

52 Weeks of Cloud
Deno: The Modern TypeScript Runtime Alternative to Python

52 Weeks of Cloud

Play Episode Listen Later May 5, 2025 7:26


Deno: The Modern TypeScript Runtime Alternative to PythonEpisode SummaryDeno stands tall. TypeScript runs fast in this Rust-based runtime. It builds standalone executables and offers type safety without the headaches of Python's packaging and performance problems.KeywordsDeno, TypeScript, JavaScript, Python alternative, V8 engine, scripting language, zero dependencies, security model, standalone executables, Rust complement, DevOps tooling, microservices, CLI applicationsKey Benefits Over PythonBuilt-in TypeScript SupportFirst-class TypeScript integrationStatic type checking improves code qualityBetter IDE support with autocomplete and error detectionTypes catch errors before runtimeSuperior PerformanceV8 engine provides JIT compilation optimizationsSignificantly faster than CPython for most workloadsNo Global Interpreter Lock (GIL) limiting parallelismAsynchronous operations are first-class citizensBetter memory management with V8's garbage collectorZero Dependencies PhilosophyNo package.json or external package managerURLs as imports simplify dependency managementBuilt-in standard library for common operationsNo node_modules folderSimplified dependency auditingModern Security ModelExplicit permissions for file, network, and environment accessSecure by default - no arbitrary code executionSandboxed execution environmentSimplified Bundling and DistributionCompile to standalone executablesConsistent execution across platformsNo need for virtual environmentsSimplified deployment to productionReal-World Usage ScenariosDevOps tooling and automationMicroservices and API developmentData processing applicationsCLI applications with standalone executablesWeb development with full-stack TypeScriptEnterprise applications with type-safe business logicComplementing RustPerfect scripting companion to Rust's philosophyShared focus on safety and developer experienceUnified development experience across languagesPossibility to start with Deno and migrate performance-critical parts to RustComing in May: New courses on Deno from Pragmatic A-Lapse

Moscow Python: подкаст о Python на русском
Новости мира Python за апрель 2025

Moscow Python: подкаст о Python на русском

Play Episode Listen Later May 3, 2025 54:15


Python Day на Positive Hack Days 2025 — https://clck.ru/3KW4fm Ведущие – Григорий Петров и Михаил Корнеев Новости выпуска: В Python закончили затаскивать криптографию из HACL* — https://jonathan.protzenko.fr/2025/04/18/python.html Релиз Pydantic v2.11 — https://pydantic.dev/articles/pydantic-v2-11-release Dependency groups и экспериментальная поддержка pylock.toml в pip — https://ichard26.github.io/blog/2025/04/whats-new-in-pip-25.1/  Приняли PEP 768 – Safe external debugger interface for CPython — https://peps.python.org/pep-0768/ Приняли PEP 750 – Template Strings — https://peps.python.org/pep-0750/ Отклонили PEP 736 – Shorthand syntax for keyword arguments at invocation — https://peps.python.org/pep-0736/ Ссылки выпуска: Курс Learn Python — https://learn.python.ru/advanced Канал Миши в Telegram — https://t.me/tricky_python Канал Moscow Python в Telegram — https://t.me/moscow_python Все выпуски — https://podcast.python.ru Митапы Moscow Python — https://moscowpython.ru Канал Moscow Python на Rutube — https://rutube.ru/channel/45885590/ Канал Moscow Python в VK — https://vk.com/moscowpythonconf

Talk Python To Me - Python conversations for passionate developers
#499: BeeWare and the State of Python on Mobile

Talk Python To Me - Python conversations for passionate developers

Play Episode Listen Later Mar 31, 2025 67:47 Transcription Available


This episode is all about Beeware, the project that working towards true native apps built on Python, especially for iOS and Android. Russell's been at this for more than a decade, and the progress is now hitting critical mass. We'll talk about the Toga GUI toolkit, building and shipping your apps with Briefcase, the newly official support for iOS and Android in CPython, and so much more. I can't wait to explore how BeeWare opens up the entire mobile ecosystem for Python developers, let's jump right in. Episode sponsors Posit Python in Production Talk Python Courses Links from the show Anaconda open source team: anaconda.com PEP 730 – Adding iOS: peps.python.org PEP 738 – Adding Android: peps.python.org Toga: beeware.org Briefcase: beeware.org emscripten: emscripten.org Russell Keith-Magee - Keynote - PyCon 2019: youtube.com Watch this episode on YouTube: youtube.com Episode transcripts: talkpython.fm --- Stay in touch with us --- Subscribe to Talk Python on YouTube: youtube.com Talk Python on Bluesky: @talkpython.fm at bsky.app Talk Python on Mastodon: talkpython Michael on Bluesky: @mkennedy.codes at bsky.app Michael on Mastodon: mkennedy

Podcast proConf
#160 PyCascades 2025 - CPython 3.13 | GIL теперь все | Потная асинхронщина | Монорепы или нет

Podcast proConf

Play Episode Listen Later Mar 26, 2025 132:24


Доклады: Goodbye GIL: Exploring the Free-threaded mode in Python 3.13 - Adarsh Divakaran (https://youtu.be/7NvgI3jDprg) Unlocking Concurrency and Performance in Python with ASGI and Async I/O - Allen Y, M Aswin Kishore (https://youtu.be/s5UGRvdrb_Q) Quantifying Nebraska - Adam Harvey (https://youtu.be/vH9xOxryqW8) Error Culture - Ryan Cheley (https://youtu.be/FBMg2Bp4I-Q) Mono-repositories in Python - Avik Basu (https://youtu.be/VIlcodf9Wrg) You Should Build a Robot (MicroPython) (https://youtu.be/UygK5W3txTM) As easy as breathing: manage your workflows with Airflow! - Madison Swain-Bowden (https://youtu.be/dWZSVY79-SM) Optimal Performance Over Basic as a Perfectionist with Deadlines - Velda Kiara (https://youtu.be/dvxzJDk6x9Q) Нас можно найти: 1. Telegram: https://t.me/proConf 2. Youtube: https://www.youtube.com/c/proconf 3. SoundCloud: https://soundcloud.com/proconf 4. Itunes: https://podcasts.apple.com/by/podcast/podcast-proconf/id1455023466 5. Spotify: https://open.spotify.com/show/77BSWwGavfnMKGIg5TDnLz

Python Bytes
#424 We Will Test in Production

Python Bytes

Play Episode Listen Later Mar 17, 2025 27:23 Transcription Available


Topics covered in this episode: The weird quirk with rounding in Python Python interpreter adds tail calls Remove punctuation from a string with translate and maketrans Extra, extra, extra Extras Joke Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training The Complete pytest Course Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky) Brian: @brianokken@fosstodon.org / @brianokken.bsky.social Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky) Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Brian #1: The weird quirk with rounding in Python Tom Nijhof-Verheesb With numbers ending in .5, Python always rounds to an even number. round(0.5) → 0 round(1.5) → 2 etc This follows IEEE 754 You can use decimal if you need a different behavior. Michael #2: Python interpreter adds tail calls Ken Jin, a member of the project, has merged a new set of changes that have been benchmarked as improving performance by 10% for some architectures. "Speedup is roughly equal to 2 minor CPython releases worth of improvements. For example, CPython 3.12 roughly sped up by 5%.” Brian #3: Remove punctuation from a string with translate and maketrans Rodrigo “Don't use the method replace to remove punctuation from a Python string. Instead, use the method translate.” Michael #4: Extra, extra, extra Animation v Coding, hello world to transformers TypeScript rewritten in Go Firefox lies PyCon's Startup Row Python in Production Book Extras Joke: Startrek Testing

Moscow Python: подкаст о Python на русском
Итоги года мира Python 2024

Moscow Python: подкаст о Python на русском

Play Episode Listen Later Feb 8, 2025 58:38


Предварительная запись на офлайн-курс Learn Python в Москве — https://forms.gle/wE7Lit97U9Q2q3oT9   Ведущие – Григорий Петров и Михаил Корнеев Новости выпуска: Safe external debugger interface for CPython — https://peps.python.org/pep-0768/ результат опроса Facebook об аннотациях типов в Python — https://engineering.fb.com/2024/12/09... возможность указывать SBOM-файлы в pyproject.toml — https://peps.python.org/pep-0770/ Сравнение Django и FastAPI — https://www.david-dahan.com/blog/comp... предложение по добавлению выравнивания в PEP 8 — https://discuss.python.org/t/pep-8-mo...   Ссылки выпуска: Курс Learn Python — https://learn.python.ru/advanced Канал Миши в Telegram — https://t.me/tricky_python Канал Moscow Python в Telegram — https://t.me/moscow_python Все выпуски — https://podcast.python.ru Митапы Moscow Python — https://moscowpython.ru Канал Moscow Python на Rutube — https://rutube.ru/channel/45885590/ Канал Moscow Python в YouTube — https://www.youtube.com/@moscowdjangoru Канал Moscow Python в VK — https://vk.com/moscowpythonconf

core.py
Episode 17: Argparse, JIT, and balloons with Savannah Ostrowski

core.py

Play Episode Listen Later Nov 19, 2024 105:06


Meet our newest member of the core developer team, Savannah! Currently at Snowflake, she also worked with development tools at Docker and Microsoft, but also flew drones over forests. In terms of CPython, Savannah works on argparse and the JIT, but that's not her last word. # Timestamps (00:00:00) INTRO (00:01:26) PART 1: INTERVIEW WITH SAVANNAH OSTROWSKI (00:02:12) Beginnings as a Python user (00:04:14) Carol Willing's nudge (00:06:55) First PR (00:08:56) Psychological damage from asyncio (00:11:51) Savannah at ***** Maps (00:14:04) Chipotle Claim to Fame (00:16:14) The most funky CPython discoveries (00:19:06) What if you could break backwards compatibility in argparse? (00:23:51) How do the JIT internals look to new eyes? (00:27:33) Is Savannah team typing? (00:33:55) Somebody's jealous (00:37:29) Favorite PEP and least favorite PEP (00:42:10) Big Fish (00:52:58) Hard conversations (01:02:31) Polska (01:06:37) Do it scared (01:08:14) PART 2: PR OF THE WEEK (01:08:22) Łukasz (01:12:01) Pabluco (01:14:46) Savannah (01:18:27) PART 3: WHAT'S GOING ON IN CPYTHON (01:21:21) Features (01:29:59) Bug fixes (01:33:42) Performance (01:40:12) Security (01:43:23) OUTRO

Python Bytes
#404 The Lost Episode

Python Bytes

Play Episode Listen Later Oct 7, 2024 31:15 Transcription Available


Topics covered in this episode: Python 3.13.0 released Oct 7 PEP 759 – External Wheel Hosting pytest-freethreaded pytest-edit Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Brian #1: Python 3.13.0 released Oct 7 That's today! What's New In Python 3.13 Interpreter (REPL) improvements exit works (really, this is worth the release right here) Multiline editing with history preservation. history sticks around between sessions Direct support for REPL-specific commands like help, exit, and quit, without the need to call them as functions. Prompts and tracebacks with color enabled by default. Interactive help browsing using F1 with a separate command history. History browsing using F2 that skips output as well as the >>> and … prompts. “Paste mode” with F3 that makes pasting larger blocks of code easier (press F3 again to return to the regular prompt). exit now works without parens Improved error messages Colorful tracebacks Better messages for naming a script/module the same name as a stdlib module. naming a script/module the same name as an installed third party module. misspelling a keyword argument Free threaded CPython Included in official installers on Windows and macOS Read these links to figure out how - it's not turned on by default Lot's more. see the What's new page Michael #2: PEP 759 – External Wheel Hosting pypi.org ships over 66 petabytes / month backed by Fastly There are hard project size limits for publishers to PyPI We can host the essence of a .whl as a .rim file, then allow an external download URL Security: Several factors as described in this proposal should mitigate security concerns with externally hosted wheels, such as: Wheel file checksums MUST be included in .rim files, and once uploaded cannot be changed. Since the checksum stored on PyPI is immutable and required, it is not possible to spoof an external wheel file, even if the owning organization lost control of their hosting domain. Externally hosted wheels MUST be served over HTTPS. In order to serve externally hosted wheels, organizations MUST be approved by the PyPI admins. Brian #3: pytest-freethreaded PyCon JP 2024 Team: This extension was created at PyCon JP sprints with Anthony Shaw and 7 other folks listed in credits. “A pytest plugin for helping verify that your tests and libraries are thread-safe with the Python 3.13 experimental freethreaded mode.” Testing your project for compatibility with freethreaded Python. Testing in single thread doesn't test that. Neither does testing with pytest-xdist, because it uses multiprocessing to parallelize tests. So, Ant and others “made this plugin to help you run your tests in a thread-pool with the GIL disabled, to help you identify if your tests are thread-safe.” “And the first library we tested it on (which was marked as compatible) caused a segmentation fault in CPython! So you should give this a go if you're a package maintainer.” Michael #4: pytest-edit A simple Pytest plugin for opening editor on the failed tests. Type pytest --edit to open the failing test code Be sure to set your favorite editor in the ENV variables Extras Michael: New way to explore Talk Python courses via topics This has been in our mobile apps since their rewrite but finally comes to the web Let's go easy on PyPI, OK? essay Hynek's video: uv IS the Future of Python Packaging djade-pre-commit Polyfill.io, BootCDN, Bootcss, Staticfile attack traced to 1 operator PurgeCSS CLI Python 3.12.7 released Incremental GC and pushing back the 3.13.0 release uv making the rounds LLM fatigue, is it real? Take the Python Developers Survey 2024 Joke: Funny 404 pages We have something at least interesting at pythonbytes.fm

Talk Python To Me - Python conversations for passionate developers

Every year the core developers meet to discuss and propose the major changes and trends in Python itself. This invite-only conference of about 50 people happens inside PyCon in the US. Because it's private, we rarely get detailed looks inside this event. On this episode, we have Seth Michael Larson here to give us his account of the sessions and proposals. It's a unique look into the zeitgeist of CPython. Episode sponsors Posit Talk Python Courses Links from the show Seth on Mastodon: @sethmlarson@fosstodon.org Seth on Twitter: @sethmlarson Seth on Github: github.com The Python Language Summit 2024: blogspot.com PEP 2026: Calendar versioning for Python: github.com PSF authorized as a CVE Numbering Authority: python.org Recommends Memory-Safe Programming Languages: blogspot.com Watch this episode on YouTube: youtube.com Episode transcripts: talkpython.fm --- Stay in touch with us --- Subscribe to us on YouTube: youtube.com Follow Talk Python on Mastodon: talkpython Follow Michael on Mastodon: mkennedy

Python Bytes
#397 So many PyCon videos

Python Bytes

Play Episode Listen Later Aug 20, 2024 22:21


Topics covered in this episode: pyawaitable Annotated area charts with plotnine DeltaDB PyCon US 2024 Recap + Videos are up Extras Joke Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training The Complete pytest Course Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Michael #1: pyawaitable CPython API for asynchronous functions. by Peter Bierma It was originally designed to be directly part of CPython - you can read the scrapped PEP about it. Since this library only uses the public ABI, it's better fit outside of CPython, as a library. Brian #2: Annotated area charts with plotnine Nicola Rennie This is a marvelous, very professional looking plot, and a tutorial for how to achieve it. Uses plotline, which is “.. an implementation of a grammar of graphics in Python based on ggplot2” I actually didn't know the gg in ggplot came from “grammar of graphics”. TIL Michael #3: DeltaDB A lightweight, comprehensive solution for managing delta tables built on polars and deltalake. Deltalake: Delta Lake is an open-source storage format that runs on top of existing data lakes. Polars: Dataframes powered by a multithreaded, vectorized query engine, written in Rust (aka fluent, rust-based pandas) See the docs. Brian #4: PyCon US 2024 Recap + Videos are up 95 countries attended total attendance of 2,991 2,551 in person 440 remote Videos available PyConUS I recommend Playlist → 2024 → view full playlist, as it's easier to see the talk titles. I've got Paul Gannsle's pytest for unittesters and Amitosh Swain's Testing Data Pipelines queued up Extras Brian: Hello, pytest! course available as of last Friday. Now the fastest way to get started using pytest. 16 lessons (really 12 + intro, outro, code download, pytest flag cheat sheet) The whole shebang is about 90 min. (faster if you bump up the video speed. :) Michael: Cutting back on digital distractions, trying Dumb Phone for iPhone. See screenshot Code in a Castle Event Joke: The Tao of Programming: 4.3 A master was explaining the nature of Tao of to one of his novices, "The Tao is embodied in all software -- regardless of how insignificant," said the master. "Is the Tao in a hand-held calculator?" asked the novice. "It is," came the reply. "Is the Tao in a video game?" continued the novice. "It is even in a video game," said the master. "And is the Tao in the DOS for a personal computer?" The master coughed and shifted his position slightly. "The lesson is over for today," he said.

Hacker News Recap
July 12th, 2024 | AT&T says criminals stole phone records of 'nearly all' customers in data breach

Hacker News Recap

Play Episode Listen Later Jul 13, 2024 13:06


This is a recap of the top 10 posts on Hacker News on July 12th, 2024.This podcast was generated by wondercraft.ai(00:33): AT&T says criminals stole phone records of 'nearly all' customers in data breachOriginal post: https://news.ycombinator.com/item?id=40944505&utm_source=wondercraft_ai(01:49): Use a Work Journal to Recover Focus Faster and Clarify Your ThoughtsOriginal post: https://news.ycombinator.com/item?id=40950584&utm_source=wondercraft_ai(03:03): Tau: Open-source PaaS – A self-hosted Vercel / Netlify / Cloudflare alternativeOriginal post: https://news.ycombinator.com/item?id=40946033&utm_source=wondercraft_ai(04:13): Free-threaded CPython is ready to experiment withOriginal post: https://news.ycombinator.com/item?id=40948806&utm_source=wondercraft_ai(05:20): Hackers Steal Phone, SMS Records for Nearly All AT&T CustomersOriginal post: https://news.ycombinator.com/item?id=40948035&utm_source=wondercraft_ai(06:18): Windows NT for Power MacintoshOriginal post: https://news.ycombinator.com/item?id=40945076&utm_source=wondercraft_ai(07:34): Crafting InterpretersOriginal post: https://news.ycombinator.com/item?id=40950235&utm_source=wondercraft_ai(08:41): CISA broke into a US federal agency, and no one noticed for a full 5 monthsOriginal post: https://news.ycombinator.com/item?id=40948064&utm_source=wondercraft_ai(09:54): What could explain the gallium anomaly?Original post: https://news.ycombinator.com/item?id=40948202&utm_source=wondercraft_ai(11:07): Beating the CompilerOriginal post: https://news.ycombinator.com/item?id=40948353&utm_source=wondercraft_aiThis is a third-party project, independent from HN and YC. Text and audio generated using AI, by wondercraft.ai. Create your own studio quality podcast with text as the only input in seconds at app.wondercraft.ai. Issues or feedback? We'd love to hear from you: team@wondercraft.ai

Python Bytes
#390 Coding in a Castle

Python Bytes

Play Episode Listen Later Jul 2, 2024 36:39


Topics covered in this episode: Joining Strings in Python: A "Huh" Moment 10 hard-to-swallow truths they won't tell you about software engineer job My thoughts on Python in Excel Extra, extra, extra Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Brian #1: Joining Strings in Python: A "Huh" Moment Veronica Berglyd Olsen Standard solution to “read lines from a file, do some filtering, create a multiline string”: f = open("input_file.txt") filtered_text = "n".join(x for x in f if not x.startswith("#")) This uses a generator, file reading, and passes the generator to join. Another approach is to add brackets and pass that generator to a list comprehension: f = open("input_file.txt") filtered_text = "n".join([x for x in f if not x.startswith("#")]) At first glance, this seems to just be extra typing, but it's actually faster by 16% on CPython due to the implementation of .join() doing 2 passes on input if passed a generator. From Trey Hunner: “I do know that it's not possible to do 2 passes over a generator (since it'd be exhausted after the first pass) so from my understanding, the generator version requires an extra step of storing all the items in a list first.” Michael #2: 10 hard-to-swallow truths they won't tell you about software engineer job College will not prepare you for the job You will rarely get greenfield projects Nobody gives a BLANK about your clean code You will sometimes work with incompetent people Get used to being in meetings for hours They will ask you for estimates a lot of times Bugs will be your arch-enemy for life Uncertainty will be your toxic friend It will be almost impossible to disconnect from your job You will profit more from good soft skills than from good technical skills Brian #3: My thoughts on Python in Excel Felix Zumstein Interesting take on one person's experience with trying Python in Excel. “We wanted an alternative to VBA, but got an alternative to the Excel formula language” “Python runs in the cloud on Azure Container Instances and not inside Excel.” “DataFrames are great, but so are NumPy arrays and lists.” … lots of other interesting takaways. Michael #4: Extra, extra, extra Code in a castle - Michael's Python Zero to Hero course in Tuscany Polyfill.io JavaScript supply chain attack impacts over 100K sites Now required reading: Reasons to avoid Javascript CDNs Mac users served info-stealer malware through Google ads HTMX for the win! ssh to run remote commands > ssh user@server "command_to_run --arg1 --arg2" Extras Brian: A fun reaction to AI - I will not be showing the link on our live stream, due to colorful language. Michael: Coding in a Castle Developer Education Event Polyfill.io JavaScript supply chain attack impacts over 100K sites See Reasons to avoid Javascript CDNs Joke: HTML Hacker

core.py
Episode 9: Py Day with Emily Morehouse-Valcarcel

core.py

Play Episode Listen Later Mar 14, 2024 69:44


Let's talk about the Steering Council, running a small consultancy business, the Walrus, and pet peeves with our special guest today! ## Outline (00:00:00)  INTRO (00:00:56)  PART 1: Emily Morehouse (00:02:15)  Running a small consultancy business (00:04:39)  What features of JS do you miss in Python? (00:05:50)  Łukasz outnumbered in a world of Steering Council members (00:06:12)  Upgrading to new Python versions (00:07:00)  It depends on who deployed the project (00:09:44)  Second term as a Steering Council member (00:11:33)  Barry, play some bass for us (00:13:04)  Let's hear a recent war story (00:15:17)  Is this progress bar even working? (00:17:40)  The Villain Origin Story (00:21:37)  Emily, The Bringer of Doom (00:22:37)  Consensus within the Steering Council (00:25:52)  Syntax changes in Python are rare, right? Right? (00:28:22)  On implementing PEP 572 (00:32:52)  How would PyCon 2020 in Pittsburgh feel? (00:34:18)  How can you be mad about the Walrus? (00:36:10)  Favorite parts of the standard library (00:38:10)  Is hacking on Python a good experience to newcomers? (00:40:26)  Emily's pet peeve about Python, take 1 (00:42:17)  Emily's favorite change in Python in recent years (00:44:34)  Emily's pet peeve about Python, take 2 (00:46:34)  Łukasz's pet peeve (00:48:25)  Surprise extra question (00:49:42)  At core.py we are professionals (00:51:00)  PART 2: PR of the Week (00:54:00)  CALL TO ACTION: Upgrade Python.org to Django 4! (00:56:22)  PART 3: What's Going On in CPython? (00:56:38)  Faster Python updates (01:00:10)  Free threading: GIL can be disabled but we're not done yet! (01:04:17)  New defaults for SSL context flags (01:05:39)  python -m asyncio and sys.__interactivehook__ (01:06:24)  Surprise question: what is sys.__interactivehook__ even doing? (01:08:11)  OUTRO

core.py
Episode 8: The New Parser

core.py

Play Episode Listen Later Mar 1, 2024 102:36


The suspense was killing us! OK, the old parser was then... but what about NOW? We're finally answering this question... in more detail than you dared to ask for. PEG, memoization, funky secrets, and how a certain auto-formatter self-inflicted an existential crisis on itself. It's all there, told in barely 100 minutes! Can you believe it? # Timestamps (00:00:00)  INTRO (00:00:54)  PART 1: What even is PEG? (00:04:02)  You can't prove anything! (00:05:03)  What's a "parsing expression"? (00:08:23)  Our old LL1 parser wasn't doing its job (00:09:37)  "Soft keywords" in LL1: A Horror Story (00:13:16)  PART 2: How PEG was adopted by Python (00:17:10)  Why not LALR? (00:22:11)  The PEG paper wasn't enough either, if we're honest (00:26:26)  Less obvious advantages of the new parser (00:31:28)  Black is stuck with LL1, can it cope? (00:36:24)  Hedging against Łukasz, the bringer of doom (00:41:14)  PART 3: How does the PEG parser of CPython work? (00:44:30)  Pedantic Pablo on "exponential" (00:45:14)  Fresh news from literally yesterday last week (00:46:39)  Pedantic Pablo on "infinite" (00:47:32)  Memoization in the PEG parser (00:50:41)  Parse once, and if it fails, try again! (00:52:14)  How to model a grammar of programming mistakes? (00:56:36)  Why is there C code in my grammar file? (00:59:57)  Bro, do you even lift? (01:01:45)  How soft keywords work today: it's not free lunch (01:04:29)  Funky grammar secrets (01:09:07)  PART 4: PR OF THE WEEK (01:09:15)  audioop.c license shenanigans (01:14:56)  The secret profiler inside CPython (tests) (01:22:45)  PART 5: WHAT'S GOING ON IN CPYTHON? (01:23:30)  Free-threading changes (01:28:15)  Faster Python changes (01:35:39)  End of an era: docs get rid of Python 2 migration info (01:36:45)  Python --help output is now nicer (01:38:43) SQLite as a dbm backend (01:41:08)  OUTRO

Moscow Python: подкаст о Python на русском
Как стать core-разработчиком CPython?

Moscow Python: подкаст о Python на русском

Play Episode Listen Later Feb 28, 2024 64:32


Спонсор подкаста — https://learn.python.ru Ведущие – Григорий Петров и Михаил Корнеев Ссылки Никиты: GitHub — github.com/sobolevn Youtube — @sobolevn Ссылки выпуска: Курс Learn Python — https://learn.python.ru/ Канал Миши в Telegram — https://t.me/tricky_python Канал Moscow Python в Telegram — https://t.me/moscow_python Все выпуски — https://podcast.python.ru Митапы MoscowPython — https://moscowpython.ru

Inside Facebook Mobile
59: Meta ❤️ Python 3.12

Inside Facebook Mobile

Play Episode Listen Later Jan 31, 2024 38:13


For the second time in just a few months, we are talking Python on the Meta Tech Podcast. Python 3.12 features a whole range of new features, many of which were contributed by Meta. Carl and Itamar join Pascal to talk about their contributions to the latest release, including new hooks that allow for custom JITs like Cinder, Immortal Objects, improvements to the type system, faster comprehensions and much more. In their discussion, they talk not just about how and why those features were built but also the process of upstreaming and engaging with the community.  Got feedback? Send it to us on Threads (https://threads.net/@metatechpod), Twitter (https://twitter.com/metatechpod), Instagram (https://instagram.com/metatechpod) and don't forget to follow our host @passy (https://twitter.com/passy, https://mastodon.social/@passy, and https://threads.net/@passy_). Fancy working with us? Check out https://www.metacareers.com/. Links “Lazy is the new fast: How Lazy Imports and Cinder accelerate machine learning at Meta” - https://engineering.fb.com/2024/01/18/developer-tools/lazy-imports-cinder-machine-learning-meta/ “How Meta built the infrastructure for Threads” - https://engineering.fb.com/2023/12/19/core-infra/how-meta-built-the-infrastructure-for-threads/ Cinder on GitHub - https://github.com/facebookincubator/cinder “Meta contributes new features to Python 3.12” - https://engineering.fb.com/2023/10/05/developer-tools/python-312-meta-new-features/ Timestamps Intro 0:06 Carl Intro 2:09 Itamar Intro 3:27 Teams and Missions 5:10 Python 3 Faster Coroutines 8:57 Code Watchers and JIT Hooks 12:10 When to upstream 13:53 How to upstream to CPython 16:19 History of Cinder 21:35 Why not upstream Cinder? 25:48 Cinder hooks in CPython 29:34 Free Threading 34:10 Outro 37:08

core.py
Episode 5 - Cinder with Carl Meyer

core.py

Play Episode Listen Later Dec 11, 2023 81:19


This time we're hosting a special guest: Carl Meyer from Meta. What is Cinder, how does it work, and how does it intersect with the future of Python 3? Find out in today's episode. 100% serious stuff! # Timestamps (00:00:00)  INTRO (00:00:53)  Carl Meyer's war story (00:02:27)  CINDER (00:03:22)  Static Python makes things significantly faster (00:08:15)  Cinder JIT and how it's tuned for Instagram (00:11:57)  Strict Python and the joy of import side effects (00:16:35)  The static typing controversy (00:18:52)  Upstreaming changes from Cinder? (00:22:53)  PEP 709: Comprehension inlining (00:28:35)  pip install CinderX (00:31:19)  Immortal instances (00:35:15)  asyncio.eager_task_factory() (00:39:39)  Carl's pet peeve with Python (00:44:49)  PR OF THE WEEK: PyPy's REPL in CPython (00:52:07)  WHAT'S GOING ON IN CPYTHON (00:52:22)  Python 3.12.1 (00:53:17)  Python 3.11.7 (00:54:45)  multiprocessing.SharedMemory track (00:56:49)  Fine-grained error locations for multi-line expressions (01:00:03)  libedit tab completion is fixed (01:02:14)  Colored exception tracebacks (01:05:11)  Removing testing modules from sys.modules, correctly (01:06:47)  SBOMs are a very serious matter (01:09:08)  Arrays by value on ARM (01:12:24)  Remove development environments and CAPS LOCK (01:15:30)  Interpreter cases generator refactored (01:16:17)  Free-threading news (01:20:01)  OUTRO

Talk Python To Me - Python conversations for passionate developers

You've probably heard the term "syntactic sugar", that is, syntax within a programming language that is designed to make things easier to read or to express. It makes the language "sweeter" for human use. It turns out Brett Cannon has spent 2 years diving into and writing about Python's sweet language features and how they really work down inside CPython. He joins me on the show today to dive into a few of the more relevant posts he's written about it. Links from the show Brett Cannon: @brettcannon@fosstodon.org Syntactic sugar series: snarky.ca Syntactic sugar: wikipedia.org Unravelling attribute access in Python: snarky.ca Unravelling binary arithmetic operations: snarky.ca Unravelling the import statement: snarky.ca record-type: pypi.org Watch this episode on YouTube: youtube.com Episode transcripts: talkpython.fm --- Stay in touch with us --- Subscribe to us on YouTube: youtube.com Follow Talk Python on Mastodon: talkpython Follow Michael on Mastodon: mkennedy --- Episode sponsors --- Talk Python Training

Python Bytes
#359 gil--;

Python Bytes

Play Episode Listen Later Nov 2, 2023 43:04


Topics covered in this episode: PyCon 2024 is up? Ruff formatter is production ready gil--; Why is the Django Admin “Ugly”? Extras Joke Watch on YouTube About the show Sponsored by Scout APM Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: PyCon 2024 is up? May 15 - May 23, 2024 - Pittsburgh, Pennsylvania Conference breakdown: Tutorials: May 15 - 16, 2024 Main Conference and Online: May 17 - 19, 2024 Job Fair: May 19, 2024 Sprints: May 20 - May 23, 2024 Tickets aren't on sale yet Unfortunately, I'm not going (see health and safety guidelines) Attendance numbers over time on Wikipedia Brian #2: Ruff formatter is production ready We reported the alpha release in September It's fast, 30x faster than Black Provides >99.9% compatibility with Black, with a list of known deviations More configurable Bundled with ruff, ruff format Still in Beta, but considered production-ready Integration extensions for VSCode and PyCharm Michael #3: gil--; The Python Steering Council has now formally accepted PEP 703 ("Making the Global Interpreter Lock Optional in CPython") The global interpreter lock will remain the default for CPython builds and python.org downloads. A new build configuration flag, --disable-gil will be added to the configure script that will build CPython with support for running without the global interpreter lock. "In short, the SC accepts PEP 703, but with clear provisio: that the rollout be gradual and break as little as possible, that we can roll back any changes that turn out to be too disruptive – which includes potentially rolling back all of PEP 703 entirely if necessary (however unlikely or undesirable we expect that to be)." Removing the global interpreter lock requires substantial changes to CPython internals, but relatively few changes to the public Python and C APIs. The implementation changes can be grouped into the following four categories: Reference counting Memory management Container thread-safety Locking and atomic APIs Brian #4: Why is the Django Admin “Ugly”? Vince Salvino Some great quotes from the article: "The Django admin is not ugly, rather, no effort was made to make it a beautiful end-user tool.” - Ken Whitesell “The admin's recommended use is limited to an organization's internal management tool. It's not intended for building your entire front end around.” - Django docs “The Django admin was built for Phil.” - Jacob Kaplan-Moss “Even in the 0.9x days we used to have a image that said “Admin: it's not your app”.” - Curtis Maloney As Curtis put it, “encouraging people to build their own management interface, and treat admin as a DB admin tool, has saved a lot of people pain... the effort to customise it grows far faster than the payoffs.” Extras Brian: Local Conferences: Big Potential Michael: Data Science Jumpstart with 10 Projects course is out! PSF is X-ed out (or are they?) GPT4All is pretty excellent Fosstodon invites from us (expires Nov 7 2023) Joke: Searching YouTube for bug fixes

core.py
Episode 1 - Core Sprint in Brno & Python 3.13.0 alpha 1

core.py

Play Episode Listen Later Oct 30, 2023 71:59


In this first episode Pablo and Łukasz talk about what happened in at the 2023 Cpython Core Developer sprint. Join us and learn from our ramblings about a possible new CPython new JIT compiler, how we are making the REPL easier, what in the world is a memory hive, and how we are trying to make a new C API without making everyone mad. Timestamps (00:00:00) Intro (00:01:02) Cpython core developer sprint (00:04:54) Pablo's highlights (00:06:09) Łukasz's highlights (00:08:08) Coverage in the standard library (00:12:20) Improving CPython's REPL (00:20:38) Copy and patch JIT compiler prototype (00:28:16) Tier1 and Tier2 interpreter (00:41:25) Python 3.13.0 alpha 1 and doing CPython releases (00:52:08) C-API improvements (00:58:28) Sprint experience and tourism (01:01:49) Steering council Q&A (01:08:19) Closing thoughts

Talk Python To Me - Python conversations for passionate developers
#431: Visualizing CPython Release Process

Talk Python To Me - Python conversations for passionate developers

Play Episode Listen Later Sep 29, 2023 62:12


Every year Python has a new major release. This year it's Python 3.12 and it'll come out on October 2, 2023. That's 4 days from when this episode was published. There is quite process involved to test, build, and ship Python across many platforms and channels. We have Seth Michael Larson here to give us a detailed rundown on what exactly is involved in releasing CPython. Links from the show Seth on Mastodon: fosstodon.org/@sethmlarson Seth on Twitter: @sethmlarson Seth on Github: github.com Announcing Security Developer-in-Residence: sethmlarson.dev Visualizing the CPython Release Process: sethmlarson.dev PEP 101: peps.python.org CPython on Github: github.com Best Open SSF: best.openssf.org pip-audit: github.com PyPA Advisory Database: github.com Omnivore App: omnivore.app What's New in 3.12: docs.python.org release-tools package: github.com Talk Python's HTMX + Django course: talkpython.fm/htmx-django Watch this episode on YouTube: youtube.com Episode transcripts: talkpython.fm --- Stay in touch with us --- Subscribe to us on YouTube: youtube.com Follow Talk Python on Mastodon: talkpython Follow Michael on Mastodon: mkennedy Sponsors PyCharm Talk Python Training

Talk Python To Me - Python conversations for passionate developers
#425: Memray: The endgame Python memory profiler

Talk Python To Me - Python conversations for passionate developers

Play Episode Listen Later Aug 4, 2023 70:28


Understanding how your Python application is using memory can be tough. First, Python has it's own layer of reused memory (arenas, pools, and blocks) to help it be more efficient. And many important Python packages are built in natively compiled languages like C and Rust often times making that section of your memory opaque. But with Memray, you can way deeper insight into your memory usage. We have Pablo Galindo Salgado and Matt Wozniski back on the show to dive into Memray, the sister project to their pystack one we recently covered. Links from the show Pablo Galindo Salgado: @pyblogsal Matt Wozniski: github.com pytest-memray: github.com PEP 669 – Low Impact Monitoring for CPython: peps.python.org Memray discussions: github.com Mandlebrot Flamegraph example: bloomberg.github.io Python allocators: bloomberg.github.io Profiling in Python: docs.python.org PEP 693 – Python 3.12 Release Schedule: peps.python.org Watch this episode on YouTube: youtube.com Episode transcripts: talkpython.fm --- Stay in touch with us --- Subscribe to us on YouTube: youtube.com Follow Talk Python on Mastodon: talkpython Follow Michael on Mastodon: mkennedy Sponsors PyCharm influxdata Talk Python Training

Python Bytes
#346 Have you lost your GIL?

Python Bytes

Play Episode Listen Later Aug 2, 2023 28:09


Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Python People Podcast Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: A Steering Council notice about PEP 703 (Making the Global Interpreter Lock Optional in CPython) Thomas Wouters Suggested by John Hagen “We intend to accept PEP 703, although we're still working on the acceptance details.” Moving forward in 3 stages short-term, no-GIL experimental build in 3.13 or 3.14 mid-term, declare support for no-GIL version long-term, no-GIL becomes default and remove any vestiges of the GIL No commitment and timeframe is nebuous long-term means 5+ years Need community support “We want to be able to change our mind if it turns out, any time before we make no-GIL the default, that it's just going to be too disruptive for too little gain.” Michael #2: Google's post-cookie world could turn into DRM for the internet A new authentication system could let websites block extensions or jailbroken devices. Google has been trying to implement plans to move beyond cookies for years without denying its partners the means to sell targeted ads. One recent proposal to guarantee user privacy and security could come at the cost of freedom of functionality. Comments are somewhat interesting. More info in a second article. Vivaldi has a response here. Brave won't ship with it. Brian #3: How ruff changed my Python programming habits Matthias Kestenholz “…there's always a trade off between development speed (waiting on git commit is very boring) and strictness. “ “ruff is so fast that enabling additional rules is practically free in terms of speed...” ruff has way more rules since last I checked. They are just mostly turned off by default. The article suggests a bunch to try turning on. See also ruff config settings turn on flake8-bugbear while leaving on defaults with select = ["E", "F", "B"] lots of rules to choose from ruff-pre-commit to run these with pre-commit Michael #4: pathlib api extended to use fsspec backends via Justin Flannery Expanding on the capabilities of fsspec, the same GitHub organization also supports another powerful library called universal_pathlib. universal_pathlib is a python library that aims to extend Python's built-in pathlib.Path api to use a variety of backend filesystems using fsspec. This seamless replacement allows developers to leverage the familiar and powerful pathlib API on any type of filesystem. upath.Path is a drop-in replacement for pathlib.Path and is an excellent addition to your toolkit. Joke: Understanding pointers

捕蛇者说
Ep 41. 和 Penguin 聊聊 CPython 优化和大厂编译器组的工作

捕蛇者说

Play Episode Listen Later Jul 18, 2023 72:38


本期前半段内容(CPython 优化)较为硬核,如果你想直接听后半段(大厂编译器组的工作),可以直接跳到 00:38:50 嘉宾 Penguin 主播 laike9m Manjusaka 链接 播客中提到的两个优化: Add return const instruction #101632 - python/cpython bpo-47067: Add vectorcall for gaobject #31996 Faster CPython CPython 特化指令 PEP 659 – Specializing Adaptive Interpreter 码农高天:Faster CPython的重要力量——Specialized Instruction 十分钟魔法练习 Apache TVM 太极图形 播客封面来自Anime Girls Holding Programming Books

Lex Fridman Podcast
#381 – Chris Lattner: Future of Programming and AI

Lex Fridman Podcast

Play Episode Listen Later Jun 2, 2023 218:29


Chris Lattner is a legendary software and hardware engineer, leading projects at Apple, Tesla, Google, SiFive, and Modular AI, including the development of Swift, LLVM, Clang, MLIR, CIRCT, TPUs, and Mojo. Please support this podcast by checking out our sponsors: - iHerb: https://lexfridman.com/iherb and use code LEX to get 22% off your order - Numerai: https://numer.ai/lex - InsideTracker: https://insidetracker.com/lex to get 20% off EPISODE LINKS: Chris's Twitter: https://twitter.com/clattner_llvm Chris's Website: http://nondot.org/sabre/ Mojo programming language: https://www.modular.com/mojo Modular AI: https://modular.com/ PODCAST INFO: Podcast website: https://lexfridman.com/podcast Apple Podcasts: https://apple.co/2lwqZIr Spotify: https://spoti.fi/2nEwCF8 RSS: https://lexfridman.com/feed/podcast/ YouTube Full Episodes: https://youtube.com/lexfridman YouTube Clips: https://youtube.com/lexclips SUPPORT & CONNECT: - Check out the sponsors above, it's the best way to support this podcast - Support on Patreon: https://www.patreon.com/lexfridman - Twitter: https://twitter.com/lexfridman - Instagram: https://www.instagram.com/lexfridman - LinkedIn: https://www.linkedin.com/in/lexfridman - Facebook: https://www.facebook.com/lexfridman - Medium: https://medium.com/@lexfridman OUTLINE: Here's the timestamps for the episode. On some podcast players you should be able to click the timestamp to jump to that time. (00:00) - Introduction (06:38) - Mojo programming language (16:55) - Code indentation (25:22) - The power of autotuning (35:12) - Typed programming languages (51:56) - Immutability (1:04:14) - Distributed deployment (1:38:41) - Mojo vs CPython (1:54:30) - Guido van Rossum (2:01:31) - Mojo vs PyTorch vs TensorFlow (2:04:55) - Swift programming language (2:10:27) - Julia programming language (2:15:32) - Switching programming languages (2:24:58) - Mojo playground (2:29:48) - Jeremy Howard (2:40:34) - Function overloading (2:48:59) - Error vs Exception (2:56:39) - Mojo roadmap (3:09:41) - Building a company (3:21:27) - ChatGPT (3:27:50) - Danger of AI (3:31:44) - Future of programming (3:35:01) - Advice for young people

The Real Python Podcast
Virtual Environment Structure & Surveying the Packaging Ecosystem

The Real Python Podcast

Play Episode Listen Later May 12, 2023 69:27


How do Python virtual environments work under the hood? How does understanding these concepts help you with managing them for your projects? This week on the show, CPython core developer Brett Cannon returns to discuss his recent articles about virtual environments and the Python packaging landscape.

The Real Python Podcast
Targeting WebAssembly Platforms & Distilling a Minimum Viable Python

The Real Python Podcast

Play Episode Listen Later Apr 28, 2023 79:03


Are you familiar with the different versions of WebAssembly? Could WASM be the "write once, run everywhere" solution that developers have searched for? Where does distributing Python applications fit in the narrative? This week on the show, we have CPython core developer Brett Cannon to discuss his recent articles about WebAssembly and MVPy.

Adafruit Industries
EYE on NPI: BeagleBoard.org BeaglePlay® Single Board Computer Chips

Adafruit Industries

Play Episode Listen Later Apr 20, 2023 11:48


This week's EYE ON NPI will stick by your side like a faithful hound- it's the BeagleBoard.org BeaglePlay® Single Board Computer (https://www.digikey.com/en/product-highlight/b/beagleboard/beagleplay). Single Board Computers (SBCs) are like tiny computers that are less powerful than desktops but much better at booting quickly and interfacing with hardware. They also tend to run Linux or BSD because it's easier to get those OS's ported to new chipsets than convincing Apple or Microsoft! This new generation of SBC from BeagleBoard builds on their prior success with the BeagleBoard (https://www.digikey.com/short/1cmb3dtf) and BeagleBone (https://www.digikey.com/short/c52dpz47) by adding a ton more interfaces and connectors so many projects can be built with no soldering. Here's a bullet list to get us started: AM6254 SoC processor 16 GB eMMC storage 2 GB DDR4 memory Supports expansion with OLDI, 4-lane CSI, and QWIIC connectors CSI for compatibility with the BeagleBone AI-654, Raspberry Pi Zero W, and compute modules Full-size HDMI connector Small size: 8 cm x 8 cm USB Type-C® with 5 V @ 3 A input connector mikroBUS connector RJ45 Ethernet connector for Gigabit Ethernet Wi-Fi 2.4 GHz and 5 GHz capabilities BLE and SubG MicroSD slot USB Type-A connector at 480 Mbit Grove connector The main processor is the TI Sitara AM6254 (https://www.digikey.com/short/507rmwr2) with quad-core 64-bit A53 and a Cortex M4 coprocessor. This chip is paired with 2 GB of DDR4 RAM and 16 GB of eMMC storage for a powerful AI-ready chipset that has tons of onboard graphics support such as 1080P HDMI and 4 lanes of OLDI/LVDS. This chip has 9x UARTS, 5x SPIs, 6x I2C's, 3x PWM modules, 3x quad encoders, and 3x CAN-FD, and of course some GPIO. Note there's no ADC or DAC - you'd use SPI to connect those externally. Note this board doesn't have a 2x20 header like a Raspberry Pi, or even the dual header strips from the BeagleBone - but in exchange it stuffs a ton of hardware support directly onto the PCB. For example, if you'd like to add a camera, there's an onboard 22-pin 0.5mm pitch CSI FPC connector that is compatible with the Pi Zero camera cables (https://www.adafruit.com/product/5211) - use that adapter to interface with any low cost Pi Camera modules or compatibles. For video output, a vertical full-sized HDMI port will connect to any monitor or display. In fact we plugged in our desktop monitor and powered the Play with a USB wall adapter, and it immediately came up with an X desktop display. Mouse and keyboard can be added via the USB 2.0 socket, a mini hub will allow multiple devices since there's only one type A port. The BeaglePlay does a great job of including everything you may want to expand your Raspberry Pi with. For example, there's a BQ32002 Real Time Clock (https://www.digikey.com/short/p0h10jbq) with a CR1220 coin cell holder right on board - normally that would have to be included as a separate module. A microSD card slot can be used for storing large amounts of data: unlike most SBCs, there's onboard 16GB eMMC so you don't have to juggle SD cards to install the OS. There's also a ton of expansion ports! For I2C, the onboard QWICC (https://www.sparkfun.com/qwiic) JST SH connector lets you use the hundreds of SparkFun sensors as well as any Adafruit Stemma QT (https://learn.adafruit.com/introducing-adafruit-stemma-qt/what-is-stemma) devices. For UART/PWM/ADC/I2C/GPIO you can use the onboard Grove connector. Finally, for networking either to the Internet or to a sensor network, there's Gigabit Ethernet, WiFi 2.4G and 5G, BLE and Sub-G networking. Yeah that's a lot! It's almost all provided by the onboard TI SimpleLink CC1352P7 (https://www.ti.com/product/CC1352P7) which boasts support for 6LoWPAN, Amazon Sidewalk, Bluetooth 5.2 Low Energy, IEEE 802.15.4, MIOTY, Proprietary 2.4 GHz, Thread, Wi-SUN NWP, Wireless M-Bus (T, S, C, N mode), Zigbee. Note LoRa is not in there, so if you need LoRa that would be added with a separate module. There's also an RJ-11 with Single-Pair Ethernet (https://blog.adafruit.com/2020/08/27/eye-on-npi-harting-single-pair-ethernet-eyeonnpi-digikey-ethernet-digikey-harting-adafruit/) which makes this a good fit to connect to industrial robotics or automation. All this hardware is available at a great price of under $100 at Digi-Key, we already picked one up and we're going to try and get Blinka working on it (https://github.com/adafruit/Adafruit_Blinka) so that all of our CircuitPython libraries will 'just run' in CPython. Especially given the ready-to-run Stemma QT / Qwiic port on the side, this is an excellent board for a powerful but solder-free configurable SBC. Digi-Key has tons of BeaglePlay's stock for immediate shipment, so order today (https://www.digikey.com/short/jpztmq3w) and you will be playing with your new BeaglePlay by tomorrow afternoon.

Talk Python To Me - Python conversations for passionate developers
#412: PEP 711 - Distributing Python Binaries

Talk Python To Me - Python conversations for passionate developers

Play Episode Listen Later Apr 19, 2023 78:20


What if we distributed CPython, the runtime, in the same way we distributed Python packages - as prebuilt binary wheels that only need to be downloaded and unzipped to run? For starters, that would mean we could ship and deploy Python apps without worrying whether Python itself is available or up-to-date on the platform. Nathaniel Smith has just proposed a PEP to do just that, PEP 711. And we'll dive into that with him next. Links from the show Nathaniel: @njs@mastodon.social [announce] Pybi and Posy: discuss.python.org PEP 711: peps.python.org Py2App: readthedocs.io PyInstaller: pyinstaller.org py-spy: github.com Anthropic: anthropic.com Trio: github.com Trio on Talk Python: talkpython.fm Zip Documentary: The Dark History of Zip Files: youtube.com Watch this episode on YouTube: youtube.com Episode transcripts: talkpython.fm --- Stay in touch with us --- Subscribe to us on YouTube: youtube.com Follow Talk Python on Mastodon: talkpython Follow Michael on Mastodon: mkennedy Sponsors Sentry Error Monitoring, Code TALKPYTHON Talk Python Training

Python Podcast
PyPy - Just in Time

Python Podcast

Play Episode Listen Later Jan 27, 2023 152:40


PyPy - Just in Time 27. Januar 2023, Jochen Warum ist der Python Interpreter eigentlich nicht selbst in Python geschrieben? Vor ziemlich genau zwanzig Jahren wurde ein Projekt gestartet, um das zu ändern. Eine gute Gelegenheit für Dominik und Jochen mit Carl Friedrich, einem der Core-Entwickler von PyPy zu sprechen.Wenn ihr Lust bekommen habt, einmal selbst an PyPy herum zu schrauben, könnt ihr die Entwickler hier kontaktieren oder euch einfach direkt bei Carl Friedrich melden

Talk Python To Me - Python conversations for passionate developers
#400: Ruff - The Fast, Rust-based Python Linter

Talk Python To Me - Python conversations for passionate developers

Play Episode Listen Later Jan 25, 2023 63:45


Our code quality tools (linters, test frameworks, and others) play an important role in keeping our code error free and conforming to the rules our teams have chosen. But when these tools become sluggish and slow down development, we often avoid running them or even turn them off. On this episode, we have Charlie Marsh here to introduce Ruff, a fast Python linter, written in Rust. To give you a sense of what he means with fast, common Python linters can take 30-60 seconds to lint the CPython codebase. Ruff takes 300 milliseconds. I ran it on the 20,000 lines of Python code for our courses web app at Talk Python Training, and it was instantaneous. It's the kind of tool that can change how you work. I hope you're excited to learn more about it. Links from the show Charlie on Twitter: @charliermarsh Charlie on Mastodon: @charliermarsh@hachyderm Ruff: github.com PyCharm Developer Advocate Job: jetbrains.com/careers Watch this episode on YouTube: youtube.com --- Stay in touch with us --- Subscribe to us on YouTube: youtube.com Follow Talk Python on Mastodon: talkpython Follow Michael on Mastodon: mkennedy Sponsors Cox Automotive User Interviews Talk Python Training

Python Bytes
#318 GIL, How We Will Miss You

Python Bytes

Play Episode Listen Later Jan 10, 2023 39:38


Watch on YouTube About the show Sponsored by Microsoft for Startups Founders Hub. Connect with us Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/stream/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: PEP 703 - Making the GIL Optional in CPython Author: Sam Gross Sponsor: Łukasz Langa Draft status, but on Standards Track, targeting Python 3.12 Suggested by: Will Shanks “The GIL is a major obstacle to concurrency.” Especially for scientific computing. PEP 703 proposes adding a --without-gil build configuration to CPython to let it run code without the global interpreter lock and with the necessary changes needed to make the interpreter thread-safe. PEP includes several issues with GIL and sckikit-learn, PyTorch, Numpy, Pillow, and other numerically intensive libraries. Python's GIL makes it difficult to use modern multi-core CPUs efficiently for many scientific and numeric computing applications. There's also a section on how the GIL makes many types of parallelism difficult to express. Changes primarily in internals, and not much exposed to public Python and C APIs: Reference counting Memory management Container thread-safety Locking and atomic APIs Includes information on all of these challenges. Distribution C-API extension authors will need access to a --without-gil Python to modify their projects and supply --without-gil versions. Sam is proposing “To mitigate this, the author will work with Anaconda to distribute a --without-gil version of Python together with compatible packages from conda channels. This centralizes the challenges of building extensions, and the author believes this will enable more people to use Python without the GIL sooner than they would otherwise be able to.” Michael #2: FerretDB Via Jon Bultmeyer A truly Open Source MongoDB alternative MongoDB abandoned its Open-Source roots, changing the license to SSPL making it unusable for many Open Source and Commercial Projects. The core of our solution is a stateless proxy, which converts MongoDB protocol queries to SQL, and uses PostgreSQL as a database engine. FerretDB will be compatible with MongoDB drivers and will strive to serve as a drop-in replacement for MongoDB 6.0+. First release back in Nov 2022 I still love you MongoDB ;) Brian #3: Four tips for structuring your research group's Python packages David Aaron Nicholson Not PyPI packages, but, you know, directories with __init__.py in them. Corrections for mistakes I see frequently Give your packages and modules terse, single-word names whenever possible. Import modules internally, instead of importing everything from modules. Make use of sub-packages. Prefer modules with very specific names containing single functions over modules with very general names like utils, helpers, or support that contain many functions. Michael #4: Quibbler Quibbler is a toolset for building highly interactive, yet reproducible, transparent and efficient data analysis pipelines. One import statement and matplotlib becomes interactive. Check out the video on the repo page. Extras Brian: And now for something completely different: turtles talk Michael: More RSS recommendations FreshRSS a self-hosted RSS and Atom feed aggregator. Feedly (for AI) Flym for Android Readwise is very interesting RSS for courses at Talk Python New article: Dev on the Road Joke: Testing the program Joke: Every Cloud Architecture

The Real Python Podcast
Using an Ellipsis in Python & Goals for CPython 3.12

The Real Python Podcast

Play Episode Listen Later Oct 14, 2022 56:44


Where should you use an ellipsis in Python? How does it behave as a placeholder in a script, project, or stub file? What are the next goals for the Faster CPython project? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder's Weekly articles and projects.

Python Bytes
#294 Specializing Adaptive Interpreters in Full Color

Python Bytes

Play Episode Listen Later Jul 26, 2022 35:26


Watch the live stream: Watch on YouTube About the show Sponsored by Microsoft for Startups Founders Hub. Michael #1: Specialist: Python 3.11 perf highlighter via Alex Waygood Visualize CPython 3.11's specializing, adaptive interpreter.

Test & Code - Python Testing & Development
190: Testing PyPy - Carl Friedrich Bolz-Tereick

Test & Code - Python Testing & Development

Play Episode Listen Later Jun 21, 2022 51:17


PyPy is a fast, compliant alternative implementation of Python. cPython is implemented in C. PyPy is implemented in Python. What does that mean? And how do you test something as huge as an alternative implementation of Python? Special Guest: Carl Friedrich Bolz-Tereick.

Python Bytes
#282 Don't Embarrass Me in Front of The Wizards

Python Bytes

Play Episode Listen Later May 3, 2022 28:32


Watch the live stream: Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Patreon Supporters Brian #1: pyscript Python in the browser, from Anaconda. repo here Announced at PyConUS “During a keynote speech at PyCon US 2022, Anaconda's CEO Peter Wang unveiled quite a surprising project — PyScript. It is a JavaScript framework that allows users to create Python applications in the browser using a mix of Python and standard HTML. The project's ultimate goal is to allow a much wider audience (for example, front-end developers) to benefit from the power of Python and its various libraries (statistical, ML/DL, etc.).” from a nice article on it, PyScript — unleash the power of Python in your browser PyScript is built on Pyodide, which is a port of CPython based on WebAssembly. Demos are cool. Note included in README: “This is an extremely experimental project, so expect things to break!” Michael #2: Memray from Bloomberg Memray is a memory profiler for Python. It can track memory allocations in Python code native extension modules the Python interpreter itself Works both via CLI and focused app calls Memray can help with the following problems: Analyze allocations in applications to help discover the cause of high memory usage. Find memory leaks. Find hotspots in code which cause a lot of allocations. Notable features:

PyTorch Developer Podcast
Python exceptions

PyTorch Developer Podcast

Play Episode Listen Later Apr 17, 2022 14:47


C++ has exceptions, Python has exceptions. But they're not the same thing! How do exceptions work in CPython, how do we translate exceptions from C++ to Python (hint: it's different for direct bindings versus pybind11), and what do warnings (which we also translate from C++ to Python) have in common with this infrastructure?

Python Bytes
#274 12 Questions You Should Be Asking of Your Dependencies

Python Bytes

Play Episode Listen Later Mar 9, 2022 39:54


Watch the live stream: Watch on YouTube About the show Sponsored by Microsoft for Startups Founders Hub. Special guest: Anne Barela Brian #1: The Adam Test : 12 Questions for New Dependencies Found through a discussion with Ryan Cheley, who will be on an upcoming episode of Test & Code, talking about Managing Software Teams. The Joel Test dates back to 2000, and some of it is a bit dated. I should probably do a Test & Code episode or pythontest article on my opinions of this at some point. Nice shameless plugs, don't you think? The Joel Test is 12 questions and is a “highly irresponsible, sloppy test to rate the quality of a software team.” “The Adam Test” is 12 questions “to decide whether a new package we're considering depending on is well-maintained.” He's calling it “The Well-Maintained Test”, but I like “The Adam Test” Here's the test: Is it described as “production ready”? Is there sufficient documentation? Is there a changelog? Is someone responding to bug reports? Are there sufficient tests? Are the tests running with the latest language version? like Python 3.10, of course Are the tests running with the latest integration version? Examples include Django, PostgreSQL, etc. Is there a Continuous Integration (CI) configuration? Is the CI passing? Does it seem relatively well used? Has there been a commit in the last year? Has there been a release in the last year? Article has a short discussion of each. What score is good? That's up to you to decide. But these questions are good to think about for your dependencies. I also think I'll use these questions for my own projects. I've got a README.md, but do I need more examples in it? Should I have RTD docs for it? Have I updated the test matrix to include the newest versions of Python, etc? Have I hooked up CI? Michael #2: Validate emails with email-validator When you think about validating emails, you probably think regex (or just nothing) Regex is fine but so is this email: jane_doe@domain_that_doesnt_exist.com Problem is (at the time of the recording), domain_that_doesnt_exist.com is not a website. What about unicode variations that are technically the same but visually different? If the passed email address is valid, the validate_email() method will return an object containing a normalized form of the passed email address. Anne #3: The Python on Microcontrollers Newsletter One of my main focuses at Adafruit since the pandemic started is as editor of the Python on Microcontrollers Newsletter. With a weekly distribution of almost 9,400 subscribers, it's the largest newsletter of it's kind. It mainly focuses on CircuitPython and MicroPython and also discusses Python on single board computers (SBC) like Raspberry Pi. News about Python with a small computer emphasis Folks may subscribe by going to https://www.adafruitdaily.com/ which is separate from adafruit.com. The information is not sold or used for marketing and it's easy to unsubscribe (no “do you really want to do this, please reconsider…) The challenge, like for Python Bytes and other publications, is to find content. I scour the internet, with a bit of a focus on Twitter as I have an active account there. We encourage others to put in issues and Pull Requests on the newsletter GitHub, email information to cpnews@adafruit.com and using hashtag CircuitPython or MicroPython on Twitter. Brian #4: Git Organized: A Better Git Flow Annie Sexton Found through Changelog episode 480: Get your reset on A possible and common git workflow Branch off of a main branch to a personal dev branch Commit and Push during development to save your work When ready to merge, make a PR Problems Commits are hard to follow and messy, not ever really intended to separate parts of the workflow or anything. Commits are therefore useless in helping someone code review large changes. Annie's workflow Branch off of a main branch to a personal dev branch Commit and Push during development to save your work. But don't worry to much about commit messages, “WIP” is sufficient. Or a note to yourself. When ready to merge git reset origin/main Re-commit all changes in a logical order that makes more sense than the way the work actually happened. These will be several commits, with descriptive messages. Even partial commits, if there are unrelated changes in a file, work with this process Push all the new commits. (Is --force going to be necessary?) Create a PR. Now there are a set of commits that are actually helpful to break up large PRs into small chunks that tell a story. I'm looking to try this soon to see how it goes Michael #5: CPython issues moving to GitHub soon Update by The Python Developer in Residence, Łukasz Langa The Steering Council is working on migrating the data that is currently residing in Roundup at https://bugs.python.org/ (BPO) into the GitHub issues of the CPython repository hosted there. Laid out in PEP 581 -- Using GitHub Issues for CPython The ultimate goal is to move user- and core developer-provided issue-reporting entirely to Github. Each issue that currently exists on BPO will include metadata indicating where it was moved on Github. New issues will only exist on Github. Feedback, please: At the current stage, we're asking you to take a look at the links and important dates below, and share any feedback you might have. Timeline: Friday, March 11th 2022: Github starts transfer of the issues in the temporary repository to github.com/python/cpython/ . The migration is estimated to take anywhere from 3 to 7 days, depending on the load on Github.com. Anne #6: MicroPython, CircuitPython and GitHub What are Microcontrollers and Single Board Computers (SBCs)? Why not use CPython on Microcontrollers? MicroPython was originally created by the Australian programmer and theoretical physicist Damien George, after a successful Kickstarter backed campaign in 2013. Originally it only ran on a number of boards and was based on Python 3.4. CircuitPython was forked from MicroPython in 2017 by Adafruit Industries. Both MicroPython and CircuitPython are Open Source under MIT Licenses so adoption and modification by anyone is easy. Why fork CircuitPython? 1) Make a requirement that CircuitPython boards can enumerate to computers as a USB thumb drive to add or change code files with any text editor. 2) Aim to make CircuitPython use CPython library syntax whenever possible. 3) Make it easy to use and understand for beginners yet powerful for more advanced users. All CircuitPython code is on GitHub. GitHub Actions is used on repos like the Adafruit Learning System code to automate CI with Pylint, Black, and ensuring code has proper SPDX author and license tags, which is a new addition this year. Currently there are 283 microcontroller boards compatible with CircuitPython and 87 single board computers can use CircuitPython libraries in CPython via the Adafruit Blinka abstraction layer. Code portability between boards requires little if any changes. There are 346 CircuitPython libraries (all on PyPI / pip as well as GitHub) covering a wide range of hardware and real world needs. From blinking LEDs to using ulab (microlab), a subset of numpy, for data crunching. I just counted and there are exactly 1,000 Adafruit Learning System guides referencing CircuitPython, all free and open source/MIT licensed. https://learn.adafruit.com/ Extras Brian: Quick read: The Thirty Minute Rule, by Daniel Roy Greenfield summary: Stuck on a software problem for 30 min? Ask for help. Michael: The CircuitPython Show by Paul Cutler Follow up from my Python 3 == Active Python 3? James wrote: In episode #273, you guys were discussing supporting "Python 3" to mean any currently supported version of Python rather than "Python 3.7+" or similar. That's a really bad idea. There are still tons of people using unsupported versions of Python, and they're not all invalid use cases. For example, I am one of the upstream maintainers for cloud-init, and I was only recently able to remove Python 3.5 in order to make 3.6 our minimum supported version (which will continue for the next year). The reason is that our main consumers are downstream distro packagers (ubuntu, red hat, fedora, etc), and it's not uncommon for software released into long-term supported OS releases to be supported for 5-10 years or more. If I fire up an Ubuntu Trusty container, which still receives extended support until 2024, I get Python 3.4. So even though 3.4 is unsupported by Python upstream, it is still absolutely in use and supported by OS manufacturers. Joke: A case of the Mondays

PyTorch Developer Podcast

torchdeploy is a way of running multiple Python interpreters inside the same process. It can be used to deploy Python PyTorch programs in situations where the GIL is a problem, not the CPython interpreter. How does it work, and what kind of challenges does it pose for people who want to write code that calls from C++ to Python?Further reading.How the torchdeploy build system works https://dev-discuss.pytorch.org/t/torch-deploy-the-build/238Description of the single interpreter per Tensor invariant https://github.com/pytorch/pytorch/issues/57756Recent work on making it possible to load C extensions into torchdeploy https://dev-discuss.pytorch.org/t/running-multiple-python-interpreters-via-custom-dynamic-loading/241

PyTorch Developer Podcast
PyObject preservation

PyTorch Developer Podcast

Play Episode Listen Later Jun 9, 2021 16:19


Given two separately refcounted objects, how can you arrange for each of them to stay live so long as the other is live? Why doesn't just having a strong-strong or strong-weak reference between the two objects work? What is object resurrection in CPython? What's a finalizer and why does it make things more complicated? How does Python GC work?Further reading.PyObject preservation PR https://github.com/pytorch/pytorch/pull/56017Sam Gross's original PoC, which works fine if the two objects in question are both PyObjects https://github.com/colesbury/refcount/PEP 442 Safe object finalization https://www.python.org/dev/peps/pep-0442/Essential reading about Python GC https://devguide.python.org/garbage_collector/

Network Automation Hangout
006 — gNMI, file formats (XML, JSON, YAML, TOML, protobuf), x2 faster CPython 3.11

Network Automation Hangout

Play Episode Listen Later May 31, 2021 50:36


Topics: - scrapligo has been published (https://github.com/scrapli/scrapligo) - gNMI - Differences between file formats: XML, JSON, YAML, TOML, protobuf - x2 faster CPython 3.11 (https://www.theregister.com/2021/05/13/guido_van_rossum_cpython_3_11/) Recorded live on 2021-05-27 Bi-weekly recordings with the community on Thursdays at 6 PM CET / 12 PM ET / 9 AM PT

捕蛇者说
Ep 09. 和 Python 核心开发者聊聊 CPython 的未来

捕蛇者说

Play Episode Listen Later Dec 16, 2019 78:55


本期主持: laike9m laixintao Manjusaka 嘉宾: Xiang Zhang,目前中国唯一一位 CPython 核心开发者 时间节点 00:01:26 Python 的性能 00:21:45 Python 的静态类型 00:33:17 Python 调试 01:07:14 推荐环节 链接 什么是 Python 核心开发者? Victor Stinner 鸟哥:写在 PHP 7 发布之际一些话 鸟哥 PEP 554 -- Multiple Interpreters in the Stdlib Python C API mypy PEP 484 -- Type Hints PEP 492 -- Coroutines with async and await syntax 海象操作符 f-strings support = for self-documenting expressions and debugging python speed Compact dict in Python 3.6+ Literal Type in Python 3.8+ Guppy tracemalloc pyrasite pmap Under the hood JVM: Safepoints sys._getframe gc.get_objects 3.10 or 4.0? Gradle Direction for ISO C++ Instagram 贡献的 gc.freeze() python-ptrace Linux From Scratch executing Commons Virtual File System eleme-huskar

捕蛇者说
Ep 03. 聊聊 Emacs,Python@爱奇艺,源码阅读

捕蛇者说

Play Episode Listen Later Jun 4, 2019 53:27


本期嘉宾 & 主持 张佳圆:Blog,Twitter@Tisoga,Bilibili@加元君 Manjusaka laike9m 本期提要 00:03:20 佳圆聊学习编程的经历 00:11:53 Emacs 好处都有啥 00:20:40 Python 在爱奇艺的应用 00:29:05 爱奇艺 code review 流程 00:32:36 踩过的有意思的坑 00:35:17 《Inside The Python Virtual Machine》这本书 00:40:57 如何阅读源代码 00:47:07 推荐环节 播客中提到的内容 SICP Emacs doom-emacs Spacemacs Org mode 文学编程 RFC 2324 - Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0) ipdb YAML Bazel - A fast, scalable, multi-language and extensible build system https://github.com/pallets/werkzeug/pull/1496 《Inside The Python Virtual Machine》 Yet another guided tour of CPython By Guido 基于 2.7.8 的 CPython internals 视频教程 “圣诞节”的梗 https://bugs.python.org/issue36792 One secret to becoming a great software engineer: read code Has the Python GIL been slain? Real Python: Python Tutorials Awesome Python - A curated list of awesome Python frameworks, libraries, software and resources teachyourselfcs tldr -

The Python Podcast.__init__
Exploring Python's Internals By Rewriting Them In Rust

The Python Podcast.__init__

Play Episode Listen Later Apr 15, 2019 40:28


The CPython interpreter has been the primary implementation of the Python runtime for over 20 years. In that time other options have been made available for different use cases. The most recent entry to that list is RustPython, written in the memory safe language Rust. One of the added benefits is the option to compile to WebAssembly, offering a browser-native Python runtime. In this episode core maintainers Windel Bouwman and Adam Kelly explain how the project got started, their experience working on it, and the plans for the future. Definitely worth a listen if you are curious about the inner workings of Python and how you can get involved in a relatively new project that is contributing to new options for running your code.