2024/02 PyCon PH 2024 のトークネタメモ
トーク申込み
入力項目
Title*
Category*
Advanced & Core Python
Backend/DevOps
Beginner & General Programming
Community
Data Science/Analysis/Engineering
Fun
Hardware/IoT
Health & Wellbeing
Industry
Machine Learning & Artificial Intelligence
Open Source
Personal & Professional Development
Platform/Framework/Architecture
Productivity & Practices
Testing
Web/Mobile
Other
Duration*
Audience Level*
Abstract*
Objectives*
Detailed description
Outline
Supplementary details
Slide link
Links to previous talks/workshops
トーク概要
Title
Pythonはどうやってlen関数で長さを手にいれているの?
How does Python get the length with the len() function?
Category
Other: Core Python for Beginner (not advanced)
Duration*
30min
Audience Level
Beginner
Abstract* / 説明
Pythonには文字列やリストなど、長さをもつオブジェクトがあります。長さを手に入れるには、文字列なら、name.length ではなく len(name) のようにlen関数を使います。len関数はどうやってnameに入っているオブジェクトの長さを手に入れているのでしょうか。if文にはTrue/Falseとなる条件式を指定しますが、それだけでなく文字や数字、自分で作ったデータ型も渡せます。if文はどうやって与えられたオブジェクトがTrueなのかFalseなのかを手に入れているのでしょうか。この発表では、Pythonのプログラムがどうやって必要な情報を手に入れているのか、また、自分で実装するときにどう実装すればlen()やif文やfor文に指定できるのかを説明します。
Python has objects with lengths, such as str and list. To get the length of string variable name, use the len() function instead of name.length. How does the len() function get the length of the name?
Also, how does the if statement determine whether an object is True or False? if statements can be specified with conditions that are True/False, but they can also be passed strings, numbers, and custom data types.
This presentation will explain how the Python core gets the information they need, and how to implement it yourself so that it can be specified for len() and if statements and for loops.
Objectives* / 目的
Introduction to Data Types for Python Beginners.
Python beginners often reach a point where they can write simple programs, but they want to take their skills to the next level. To do this, they need to understand how programming languages work at a deeper level.
This talk will introduce beginners to the concept of data types in Python. By understanding how data types work, they will be able to write more complex programs and understand how other programming languages work.
Detailed description / 概要
日本語
脱初心者、のためのデータ型入門
len() はどうやってオブジェクトの長さを手に入れているのか
if はどうやって指定したオブジェクトを使っているのか
for はどうやって指定したオブジェクトを使っているのか
データ型が長さを返す、条件式に使える、繰り返し可能、のような動作を満たすための条件、プロトコル
まとめ
英語
Introduction to Data Types for Beginners
How does Python get the length with the len() function?
How does the if statement use the specified object?
How does the for loop use the specified object?
Conditions for data types to satisfy behaviors such as returning a length, being usable in conditional expressions, and being iterable
Summary
メモ
len() の仕組み
for の仕組み
トーク概要
Title* / タイトル
Tracking Web System Processes with OpenTelemetry
Category*
Backend/DevOps
Duration*
30min
Audience Level*
Intermediate
Abstract* / 概要
OpenTelemetryは、複数のプロセス、システムをまたがってアプリケーションの処理を追跡する分散トレースの仕組みを提供する、標準規格であり、オープンソースのフレームワークです。分散トレースの仕組みは本番運用時の監視やトラブルシューティングのみならず、開発時のデバッグやシステム結合テストなどで役立ちます。このフレームワークを活用し、Webアプリおよび周辺システムの処理を追跡する方法について紹介します。 OpenTelemetry is an open-source framework that provides a standard way to trace the processing of applications across multiple processes and systems. Distributed tracing can be used for monitoring and troubleshooting in production, as well as debugging and system integration testing during development. This talk will introduce how to use OpenTelemetry to trace the processing of web applications and their surrounding systems.
Objectives* / この題材を選んだ理由やきっかけ
分散トレースの技術はプログラミング言語とは独立しています。このためPythonを使う開発者が触れる機会はそれほど多くないかもしれません。そこで、Pythonの文脈で紹介することによって、多くのPython開発者人に興味を持ってもらい、導入・活用する事例が増えるきっかけとなればと思いす。
Distributed tracing is a language-agnostic technology. As a result, Python developers may not have many opportunities to learn about it. This talk will introduce distributed tracing in the context of Python, in hopes of generating interest among Python developers and increasing the number of cases where it is adopted and used.
Detailed description / 詳細(300文字以上)
現代のWebアプリは構成要素が多すぎます。JS、Serverless API、Nginx、Python、RDB、KVS、などなど...。あるリクエストで呼び出された処理全体を把握したいとき、どうやって追跡したらよいでしょうか。全ての処理にデバッグログを仕込み、そのログを集約して絞り込み、そこから処理全体を再構成して把握するのがよいでしょうか。そのような追跡(分散トレース)を、本番、開発、テスト、あらゆるシーンで簡単に行いたいところです。
このトークでは、分散トレースの仕組みを導入するメリットを、具体的な動作例を見て理解できます。
Modern web application systems are made up of many components. These components can include JavaScript, serverless APIs, Nginx, Python, databases, and key-value stores. When you want to understand the entire execution of a request that calls multiple components, how do you track it? Do you put debug logs in all of the components, aggregate and filter the logs, and then reconstruct the entire execution from the logs? It would be ideal to be able to do this kind of tracking (distributed tracing) easily in production, development, and testing environments.
This talk will help you understand the benefits of adopting distributed tracing by showing you concrete examples of how it works.
Outline
Webアプリ開発の困りごと (02m Σ 02m)
デモ (08m Σ 10m)
計装とテレメトリ (03m Σ 13m)
Python/Webへの計装 (10m Σ 23m)
分散トレースとOpenTelemetry (05m Σ 28m)
まとめ、参考文献 (02m Σ 30m)
Challenges of Web application development (2 minutes)
Demo: OpenTelemetry (8 minutes)
Instrumentation and telemetry (3 minutes)
Instrumentation for Python/Web (10 minutes)
Distributed tracing and OpenTelemetry (5 minutes)
Summary and references (2 minutes)
Supplementary details
OpenTelemetryは、OpenTracingとOpenCensusが合流して生まれ、Cloud Native Computing Foundation(CNCF)配下のIncubatingプロジェクトとして活発に開発が進められています。分散トレースは複数サーバ・複数コンテナ時代になって難しくなった、通信の流れの把握や、ボトルネック把握、プロファイリングをサポートする、クラウド上で多数のシステムが協調動作する現代のソフトウェア開発の現場では重要な技術です。 OpenTelemetry was created by the merger of OpenTracing and OpenCensus. It is an actively developed incubating project under the Cloud Native Computing Foundation (CNCF). Distributed tracing is an important technology in modern software development environments, where it can be used to support understanding the flow of communication, identifying bottlenecks, and profiling.
Slide link
Links to previous talks/workshops
トーク概要
Title* / タイトル
Django ORM Dojo: Learn the basics of queries and improve your skills
Category*
Backend/DevOps
Duration*
30min
Audience Level*
Beginner
Abstract* / 概要
Django ORMはSQLの知識がなくてもある程度のデータベース操作ができる便利な技術ですが、その知識だけでDB操作をしていると、気がつかないうちにとても効率の悪い実装をしてしまいます。Web開発からプログラミングを始めた人はWebフレームワークを使ってしばらくしてからDBに関心を持つようになる、何ならDBのことはあまり考えたくない、という方も多いのではないでしょうか。このDjango ORM道場では、そんな「Django ORMあるある」を正し、本来やりたかったはずの処理を効率良く行うことができるよう、基本の型を紹介します。
Django ORM is a powerful tool that allows you to perform database operations without knowing SQL. However, if you only use Django ORM without knowing SQL, you may end up implementing inefficient code. This Django ORM Dojo will teach you the basic patterns of Django ORM queries. By learning these patterns, you will be able to write more efficient and effective code.
Objectives*
本トークの内容は、開発現場で実際にあったコードレビューで出会い、レビュー指摘によって問題を解決した際の内容です。熟練者であれば「あーあるある」と言えるようなことでも、経験が無ければ勘所を掴むまでかなりの試行錯誤が必要になります。本トークでは熟練者の視点をDjango ORM道場の道場主(あるいはコンサルタント)に置き換えて、Djangoの中で完結させます。このトークが、多くのDjango利用者のあるある問題を解決するきっかけになればと思います。
The content of this talk is based on the problems I encountered and solved during code reviews in the development field. Even experienced developers might say "Oh, that's a common problem," but if you don't have experience, it can take a lot of trial and error to figure out the tricks. I will take the perspective of an experienced developer, like a master or consultant at a Django ORM dojo, and focus on Django. I hope this talk will help many Django users solve common problems.
Detailed description /詳細
本トークでは、Djangoに内蔵されているDjango ORMによるデータ取得操作を扱っていきます。ほかのプログラミング言語や、ほかのWebフレームワークでは詳細は異なりますが、基本的な考え方は広く使えるはずです。
スポーツであれば鏡を見ながらトレーニングしたり、動画を撮って自分の動きやフォームを見ながら練習します。ソフトウェア開発も同じで、プログラムの実行結果を最後まで確認せずにコードを書くことはほとんどありません。ORMクエリの場合、「期待する値が取れたか」に注目してしまいがちですが、「ORMクエリが発行するSQL文」をよく観察する必要があります。試合の結果(実行結果や処理速度)だけ見るのではなく、そこに至る過程としてのフォーム(SQL文)を観察して磨いていくことが大事です。
本トークでは、道場主(コンサルタント)の立場から、「ORM利用の3つの基本」を押さえ、混乱してしまったDjango ORMコードをスッキリさせる方法を紹介します。
This talk will focus on data retrieval operations using Django ORM. The basic concepts discussed in this talk can be applied to other programming languages and web frameworks.
Just like in sports, it is important to observe your form to improve your performance. In software development, it is also important to observe the output of your code. However, when using Django ORM, it is easy to focus only on the results of the query. Instead, you should pay attention to the SQL statements that Django ORM generates.
In this talk, you will learn three basic patterns for using Django ORM. By following these patterns, you can write Django ORM code that is easier to understand and maintain.
Outline / アジェンダ
Introduction and background (5 minutes)
What SQL statements does this ORM generate? (7 minutes)
Basic 1: Always check the SQL you are executing (7 minutes)
Basic 2: Avoid issuing SQL statements at unintended times (7 minutes)
Basic 3: (short introduction only) Build Django ORM queries from ideal SQL statements (1 minutes)
Summary and Q&A (3 minutes)
Supplementary details
オーディエンスが持って帰れる具体的な知識やノウハウ
1. Django ORMクエリが発行するSQL文を観察する技術
2. 意図しないタイミングでのSQL発行を避ける方法
3. 理想のSQLからORMを組む方法
4. Django ORMコードを整理し、効率的にするための具体的な手法
5. 経験豊富な開発者の視点で問題を理解し、解決するための思考方法
オーディエンスに求める前提知識
Pythonの基本的な知識
Django(またはWebフレームワーク)におけるORMの基本的な理解
最近のWebアプリ開発や、そのデバッグで苦労した経験
SQLのごくごく基礎的な知識(SELECTとJOIN)
データベースの基本的な概念と操作についての理解
Knowledge and skills that the audience will take:
How to observe the SQL statements generated by Django ORM queries
How to avoid issuing SQL statements at unintended times
How to build Django ORM queries from ideal SQL statements
Specific techniques for refactoring Django ORM code to improve efficiency
How to think like an experienced developer to understand and solve problems
Pre-requisite knowledge for the audience:
Basic knowledge of Python
Basic understanding of ORM in Django (or other web frameworks)
Experience with developing web applications, including debugging
Basic knowledge of SQL (SELECT and JOIN statements)
Understanding of basic database concepts and operations
Slide link
Links to previous talks/workshops
ネタ
トーク概要
Title* / タイトル
Djangoアプリを並行開発する際のマイグレーション戦略
Database Migration Strategies: parallel development and release with django
Category*
Backend/DevOps
Duration*
30min
Audience Level*
Intermediate
Abstract* / 概要
Djangoアプリの開発中に起こる、マイグレーションの競合を避けるにはどうすればよいでしょうか?複数のブランチで同じテーブルのカラムを追加して使いたい場合や、DBスキーマの変更が競合する場合は、ブランチのマージ時に競合してしまい、解決に苦労することがあります。このトークでは、実際の開発現場で発生したいくつかの事例を元に、トラブルを避けるためのブランチ運用とリリース戦略について紹介します。
How to avoid migration conflicts in Django app development? If you want to change the same table in multiple branches or if the database schema changes conflict, it may conflict during branch merging, making it difficult to solve. In this talk, I will introduce branch management and release strategies to avoid problems based on some cases that occurred in actual development sites.
Objectives*
Webアプリケーションはデプロイして問題があればロールバックを行います。そして、DjangoなどのいくつかのWebアプリケーションフレームワークではDBマイグレーションやロールバックの仕組みを提供しています。しかし、ロールバックを実装していない開発現場では機能せず、ロールバックを実装しても現実的にはうまくいかないことがほとんどです。このように、DBのマイグレーションやロールバックまで含めた実践的なデプロイ手法はあまり共有されていないのが実情です。自分自身やプログラマー仲間の話を元に、実践的手法を共有したいと考えました。
Web applications are rolled back if there is a problem in deployment. Some web application frameworks such as Django provide mechanisms for database migrations and rollbacks. However, it does not work in development sites that do not implement rollbacks, and even if rollbacks are implemented, it is often not possible to do so in practice. In this way, practical deployment methods that include database migrations and rollbacks are not shared very much in reality. I thought I would share practical methods based on my own stories and those of my programmer friends.
Detailed description / 詳細
一般的に、プログラムを実装するときはリポジトリでブランチを作りそれぞれのブランチで実装作業を進めます。Djangoアプリの開発でも同様ですが、各ブランチでDBスキーマを変更する場合には注意が必要です。例えば、複数のブランチで同じテーブルのカラムを追加して使いたい場合や、DBスキーマの変更が競合する場合は、ブランチのマージ時に競合してしまいます。多くの機能を並行開発したり、マージするまでの期間が長い場合には、このような競合が増えてしまいます。
このトークでは、Djangoのデータベースマイグレーションの仕組みから、実際の開発現場で発生したトラブルとその解決方法について紹介します。
Generally, when implementing a program, you create a branch in the repository and proceed with the implementation work in each branch. The same is true for Django app development, but you need to be careful when changing the database schema in each branch. For example, if you want to use the same table column in multiple branches or if the database schema changes conflict, it will conflict during branch merging. If you develop many features in parallel or the merge period is long, such conflicts will increase.
In this talk, I will introduce the mechanism of Django database migrations, as well as the troubleshooting methods and solutions that have occurred in actual development sites.
Outline / アジェンダ
Djangoのデータベースマイグレーション機能の紹介
DBスキーマ変更が競合するシンプルな例
実際の開発現場で発生したトラブル事例
DBスキーマ変更の先行リリース
新旧DBスキーマの並行運用
Introduction to Django database migration feature (5 minutes)
A simple example of a database schema change conflict (5 minutes)
Case studies of troubleshooting that occurred in actual development sites (5 minutes)
Pre-release of database schema changes (5 minutes)
Parallel operation of old and new database schemas (8 minutes)
summary (2 minutes)
Supplementary details
Slide link
Links to previous talks/workshops
ネタ