-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·1355 lines (1029 loc) · 86.5 KB
/
index.html
File metadata and controls
executable file
·1355 lines (1029 loc) · 86.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title></title>
<link rel="stylesheet" href="dist/reveal.css" />
<link rel="stylesheet" href="dist/theme/serif.css" id="theme" />
<link rel="stylesheet" href="plugin/highlight/zenburn.css" />
<link rel="stylesheet" href="css/layout.css" />
<link rel="stylesheet" href="plugin/customcontrols/style.css">
<script defer src="dist/fontawesome/all.min.js"></script>
<script type="text/javascript">
var forgetPop = true;
function onPopState(event) {
if(forgetPop){
forgetPop = false;
} else {
parent.postMessage(event.target.location.href, "app://obsidian.md");
}
}
window.onpopstate = onPopState;
window.onmessage = event => {
if(event.data == "reload"){
window.document.location.reload();
}
forgetPop = true;
}
function fitElements(){
const itemsToFit = document.getElementsByClassName('fitText');
for (const item in itemsToFit) {
if (Object.hasOwnProperty.call(itemsToFit, item)) {
var element = itemsToFit[item];
fitElement(element,1, 1000);
element.classList.remove('fitText');
}
}
}
function fitElement(element, start, end){
let size = (end + start) / 2;
element.style.fontSize = `${size}px`;
if(Math.abs(start - end) < 1){
while(element.scrollHeight > element.offsetHeight){
size--;
element.style.fontSize = `${size}px`;
}
return;
}
if(element.scrollHeight > element.offsetHeight){
fitElement(element, start, size);
} else {
fitElement(element, size, end);
}
}
document.onreadystatechange = () => {
fitElements();
if (document.readyState === 'complete') {
if (window.location.href.indexOf("?export") != -1){
parent.postMessage(event.target.location.href, "app://obsidian.md");
}
if (window.location.href.indexOf("print-pdf") != -1){
let stateCheck = setInterval(() => {
clearInterval(stateCheck);
window.print();
}, 250);
}
}
};
</script>
</head>
<body>
<div class="reveal">
<div class="slides"><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
## Surprises, Bugs, and Deep Dives: Lessons from a Python Upgrade
**PyWeb**, July 2025
[bit.ly/py312-upgrade](https://bit.ly/py312-upgrade)
<div class="" style="position: absolute; left: 0%; top: 70%; height: 30%; width: 40%; display: flex; flex-direction: column; align-items: center; justify-content: center" >
Yonatan Bitton
</br>
[@bityob](https://linktr.ee/bityob)
</div>
<div class="" style="position: absolute; left: 60%; top: 70%; height: 30%; width: 40%; display: flex; flex-direction: column; align-items: center; justify-content: center" >
<img src="attachments/Lectures/python_3.12_upgrade_slides/Pasted image 20250727085857.png" alt="" style="width: 150px; object-fit: fill">
</div>
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### `whoami`
- Developer on the Core team at **Fortinet**
- We provide cybersecurity protection for emails and more
- Passionate about **Python**, enjoy solving tough **challenges** and understanding things **inside out**
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### 🐍 Python 3.9 → 3.12: The Upgrade Journey
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Agenda / Upgrade Trail Map
- ­<!-- .element: class="fragment" data-fragment-index="1" -->Stage 0: Why upgrade? Why 3.12? Strategy?
- ­<!-- .element: class="fragment" data-fragment-index="2" -->Stage 1: Build Python 3.12
- ­<!-- .element: class="fragment" data-fragment-index="3" -->Stage 2: Installing & Resolving Package Issues
- ­<!-- .element: class="fragment" data-fragment-index="4" -->Stage 3: Running & Fixing
- ­<!-- .element: class="fragment" data-fragment-index="5" -->Stage 4: Running 4k Tests — Reality Check
- ­<!-- .element: class="fragment" data-fragment-index="6" -->Stage 5: QA + ~500 automation end-to-end flows
- ­<!-- .element: class="fragment" data-fragment-index="7" -->Stage 6: Production rollout & real-world bugs
Notes:
This is the flow. We’ll spend more time where the most learning happened: dependency migration, runtime breakage, and tests.
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Day 0
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Stage 0: Why Upgrade? Why 3.12?
- ­<!-- .element: class="fragment" data-fragment-index="1" -->3.9 is EOL — security & ecosystem pressure
- ­<!-- .element: class="fragment" data-fragment-index="2" -->3.12 is fast, stable, mature
- ­<!-- .element: class="fragment" data-fragment-index="3" -->3.13 is too new — risky deps
- ­<!-- .element: class="fragment" data-fragment-index="4" -->Large-scale pipeline — emails, files, links → scan → forward
- ­<!-- .element: class="fragment" data-fragment-index="5" -->Thousands of pods, millions of scans hourly
- ­<!-- .element: class="fragment" data-fragment-index="6" -->Strategy: 2 full local envs (3.9 & 3.12), side by side
- ­<!-- .element: class="fragment" data-fragment-index="7" -->Compare outputs, debug diffs, document all
Notes:
- Emphasize real-world scale: high-volume, distributed scanning system.
- Upgrade = delicate surgery on a living organism.
- The double-local-environment strategy was critical: fast switching, reliable debugging, no guesswork.
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Lectures/python_3.12_upgrade_slides/Pasted image 20250721224943.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Day 1
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Stage 1: Build Python 3.12
- ­<!-- .element: class="fragment" data-fragment-index="1" -->Need OpenSSL 1.1.1 — not v3
- ­<!-- .element: class="fragment" data-fragment-index="2" -->OpenSSL 3 blocks legacy SMTP servers
- ­<!-- .element: class="fragment" data-fragment-index="3" -->Recompiled Python 3.12 with OpenSSL 1.1.1
- ­<!-- .element: class="fragment" data-fragment-index="4" -->Packed to ZIP → used in Docker build.
Notes:
We could have used distro Python — but we needed a specific OpenSSL version for compatibility reasons (internal infra + external integrations). So we rolled our own build.
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Stage 1: Build Details
```bash [1-4|6-11|13-15]
# Downloading required python source
wget https://www.python.org/ftp/python/3.12.9/Python-3.12.9.tgz
tar -xvf Python-3.12.9.tgz
cd Python-3.12.9
# Building python with openssl and pip to dedicated path
./configure -C --with-ensurepip=install --with-openssl=/usr/local/ssl --prefix=/Python-3.12.9/compiled
make clean
make -s -j4
./python -m ensurepip --default-pip
make install
# Saving the compiled python to zip file for later use
cd ..
tar -cvzf Python-3.12.9-openssl-1.1.1.built.tgz ./Python-3.12.9/compiled
```
Notes:
Tell quick story: first build succeeded but Python couldn’t import SSL — because the shared libs weren’t on runtime path in container. Show how you fixed it.
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Stage 1: Build Usage
```bash
RUN wget https://fake.io/Python-3.12.9-openssl-1.1.1.built.tgz -O Python.tgz &&\
tar -xvf Python.tgz && \
cp ./Python-3.12.9/compiled/* /usr/local/ -r
RUN python3 -c "import ssl; assert '1.1.1' in ssl.OPENSSL_VERSION"
```
Notes:
Don’t trust the build: test it. Make this reproducible for others.
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Stage 2: Installing & Resolving Package Issues
- ­<!-- .element: class="fragment" data-fragment-index="1" -->Now Python 3.12 is ready to use
- ­<!-- .element: class="fragment" data-fragment-index="2" -->Install packages using `uv sync` (similar to `pip install`)
- ­<!-- .element: class="fragment" data-fragment-index="3" -->Expect install errors due to 3.12 incompatibilities
- ­<!-- .element: class="fragment" data-fragment-index="4" -->Upgrade to latest version if possible
- ­<!-- .element: class="fragment" data-fragment-index="5" -->Otherwise, find first version supporting Python 3.12
Notes:
- Must of the packages
- Some package build failed because of some error
- Checking if there is a newer version
- Choose latest one if possible and not too risky
- Choose first package with python 3.12 support
- CHANGELOG
- NEWS
- HISTORY
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### cchardet example
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
`longintrepr.h: No such file or directory`
<img src="attachments/Pasted image 20250721123201.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250721123357.png" alt="" style="object-fit: scale-down">
<div style="position: fixed; bottom: 0; width: 100%; text-align: center; font-size: 40%; color: gray;">
<a href="https://github.com/PyYoshi/cchardet/issues/81">Source: https://github.com/PyYoshi/cchardet/issues/81</a>
</div>
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250721124036.png" alt="" style="object-fit: scale-down">
<div style="position: fixed; bottom: 0; width: 100%; text-align: center; font-size: 40%; color: gray;">
<a href="https://docs.python.org/3/whatsnew/3.11.html">Source: https://docs.python.org/3/whatsnew/3.11.html</a>
</div>
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Package didn't update in last years
<img src="attachments/Pasted image 20250722121055.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
But there is a pre-release version
<img src="attachments/Pasted image 20250721124249.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
There is also a fork option
<img src="attachments/Pasted image 20250722121348.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722094741.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722121534.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Although a popular fork exists, I chose to stick with the original `cchardet` after verifying that the pre-release only included safe recompilation changes — switching packages entirely felt riskier.
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### numpy example
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250721124622.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Python 3.12 removed `distutils`
<img src="attachments/Pasted image 20250721124716.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
We can't upgrade `numpy` because an internal dependency is pinned to this specific version
```bash
> $ uv lock
× No solution found when resolving dependencies for split:
╰─▶ Because some-internal-package==1.0.67 depends on numpy==1.22.4 and your project depends
on numpy>1.22.4,
we can conclude that your project and some-internal-package==1.0.67 are incompatible.
And because your project depends on some-internal-package==1.0.67,
we can conclude that your project's requirements are unsatisfiable.
```
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250721125256.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
`uv` to the rescue!
<img src="attachments/Pasted image 20250721125321.png" alt="" style="object-fit: scale-down">
<div style="position: fixed; bottom: 0; width: 100%; text-align: center; font-size: 40%; color: gray;">
<a href="https://docs.astral.sh/uv/concepts/resolution/#dependency-constraints">Source: https://docs.astral.sh/uv/concepts/resolution/#dependency-constraints</a>
</div>
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Unblocked upgrade with `override-metadata`; sent PR to fix deps.
<img src="attachments/Pasted image 20250721125524.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Day 3
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Stage 3: Running & Fixing
- ­<!-- .element: class="fragment" data-fragment-index="1" -->First full run under Python 3.12 exposed multiple issues
- ­<!-- .element: class="fragment" data-fragment-index="2" -->This stage is mostly trial-and-error: issues only revealed themselves at runtime, requiring quick investigation and targeted fixes
- ­<!-- .element: class="fragment" data-fragment-index="3" -->Common problems: missing imports, deprecated APIs, incompatible packages
- ­<!-- .element: class="fragment" data-fragment-index="4" -->After several iterations: ✅ system booted and app ran locally
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### pinecone example
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250724130225.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250721140236.png" alt="" style="width: 750px; object-fit: fill">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722122444.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250721140502.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722122642.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
But, why we failed on `pinecone[grpc]` which we didn't install?
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Looks good, no?
<img src="attachments/Pasted image 20250721141013.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250721141106.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Pinecone expected a missing `grpc` to raise `ImportError`, but it was installed via an unrelated package with the wrong version — leading to `AttributeError` instead
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Day 5
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Stage 4: Running 4k Tests — Reality Check
- ­<!-- .element: class="fragment" data-fragment-index="1" -->Ran full test suite on GitHub & locally
- ­<!-- .element: class="fragment" data-fragment-index="2" -->Most tests passed, but some (~100) failed
- ­<!-- .element: class="fragment" data-fragment-index="3" -->Next: digging into a few tricky and interesting issues found
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### patool example
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Tests are failing with an `IndexError` for some reason...
<img src="attachments/Pasted image 20250724130510.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Let's debug it with `pytest --trace`
```
$BIN_PATH/pytest ./tests --lf -k test_mark_as_failed_passes_mal_verdict_to_root --trace
```
<img src="attachments/Pasted image 20250721150826.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
```
PatoolError: unknown archive format for file `/tmp/tmpxhyejsxy'
```
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Verified in both environments that the `patool` version **did not** change
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250721151801.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250724130852.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Confirmed that the input file used was **exactly the same**
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Let's go deeper...
```python
patoolib.get_archive_format(self.file_path)
```
<img src="attachments/Pasted image 20250721152230.png" alt="" style="object-fit: scale-down">
<img src="attachments/Pasted image 20250721152241.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250721152346.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
```python
patoolib.util.guess_mime(self.file_path)
```
<img src="attachments/Pasted image 20250721152416.png" alt="" style="object-fit: scale-down">
<img src="attachments/Pasted image 20250721152427.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250721152448.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250721152533.png" alt="" style="object-fit: scale-down">
<img src="attachments/Pasted image 20250721152604.png" alt="" style="object-fit: scale-down">
<img src="attachments/Pasted image 20250721152614.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
We don't install `file` explicitly, so where it come from?
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Checking for **reverse** dependency on `file`
```bash
$ apt-cache rdepends --installed file
file
Reverse Depends:
libmagic1
mailcap
```
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250721152909.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Since no `python3.9`, must install `mime-support` explicitly
<img src="attachments/Pasted image 20250721153143.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
And indeed, after the fix, the tests are passing successfully
<img src="attachments/Pasted image 20250724145007.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### URL parsing example
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250724145043.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
```python
# python3.9
>>> find_urls_in_data("http:google.com")
[
'http:///google.com'
]
```
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
```python
# python3.12
>>> find_urls_in_data("http:google.com")
[
'http:google.com'
]
```
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
```python
def find_urls_in_data(data)
results = []
.....
for url in found_urls:
# Until now, the same result on both versions
results.append(
# Meaning the problem is here...
safe_url_decode(url)
)
return results
```
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
```python
def safe_url_decode(data)
...
furl_url = furl.furl(url).url
...
```
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Lectures/python_3.12_upgrade_slides/Pasted image 20250722003817.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Lectures/python_3.12_upgrade_slides/Pasted image 20250722003757.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Lectures/python_3.12_upgrade_slides/Pasted image 20250722004347.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Lectures/python_3.12_upgrade_slides/Pasted image 20250722004515.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Lectures/python_3.12_upgrade_slides/Pasted image 20250722004550.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
```
for i in {9..12}; \
do uvx --python 3.$i ipython -c \
'import sys; print(sys.version); import urllib; urllib.parse.urlunsplit(("http", "", "google.com", "", ""))'; \
done
```
<img src="attachments/Lectures/python_3.12_upgrade_slides/Pasted image 20250722005857.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
```
for i in {1..9}; \
do uvx --python 3.12.$i ipython -c \
'import sys; print(sys.version); import urllib; urllib.parse.urlunsplit(("http", "", "google.com", "", ""))'; \
done
```
<img src="attachments/Pasted image 20250722010338.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722011352.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722010952.png" alt="" style="object-fit: scale-down">
<div style="position: fixed; bottom: 0; width: 100%; text-align: center; font-size: 40%; color: gray;">
<a href="https://github.com/python/cpython/issues/85110">Source: https://github.com/python/cpython/issues/85110</a>
</div>
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Beautiful Soup Example
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Test failed because email output is different
<img src="attachments/Pasted image 20250724132054.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
```python
# python3.9
<html><body><div dir="ltr">HELLO </div>
</body></html>
```
```python
# python 3.12
<html>
<body>
<div dir="ltr">
HELLO
</div>
</body>
</html>
```
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722082609.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Before `set_payload`, the payload looks the same
<img src="attachments/Pasted image 20250722083030.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722083232.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
But after `set_payload`, the payload looks different
<img src="attachments/Pasted image 20250722083258.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Let's try minimal repro in notebook...
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Didn’t work
<img src="attachments/Pasted image 20250722083505.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
There is an hidden byte in `HELLO` last char... trying with `bytes`
<img src="attachments/Pasted image 20250724145235.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Let's use pickle to be sure it's the **real same object**
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
This is weird... this is **NOT** simple string
<img src="attachments/Pasted image 20250722084724.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
What??
<img src="attachments/Pasted image 20250722085241.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
🤦
<img src="attachments/Pasted image 20250722085410.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
What's happening inside `set_payload`?
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
We call `encode` on the `payload` variable
<img src="attachments/Pasted image 20250722085917.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Encoding `bs4.BeautifulSoup` vs encoding simple `str`
<img src="attachments/Pasted image 20250722091526.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722091729.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722091843.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
The commit set `errors` value to `surrogateescape`
<img src="attachments/Pasted image 20250722092020.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
How this errors is related at all? why only on bs4 object?
<img src="attachments/Pasted image 20250722093028.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
The `surrogateescape` string is going to `indent_level` variable...
<img src="attachments/Pasted image 20250722093650.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
No matter what string we use
<img src="attachments/Pasted image 20250722093428.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
It evaluates to True in a boolean context
<img src="attachments/Pasted image 20250722124442.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Day 20
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Stage 5: QA & End-to-End Testing
- ­<!-- .element: class="fragment" data-fragment-index="1" -->Deployed to full-scale **testing environment**, mirroring production
- ­<!-- .element: class="fragment" data-fragment-index="2" -->**5 days** of QA: human exploratory testing + ~500 automated E2E tests
- ­<!-- .element: class="fragment" data-fragment-index="3" -->Monitored failures via Sentry, logs, and runtime alerts
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### SMTP starttls example
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250724145526.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250724145634.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722095058.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
```python [1-8|5-6]
if not self.use_ssl and self.use_tls:
self.connection.ehlo()
context = None
if self.ssl_certfile and self.ssl_keyfile:
context = ssl.create_default_context()
context.load_cert_chain(certfile=self.ssl_certfile, keyfile=self.ssl_keyfile)
self.connection.starttls(context=context)
self.connection.ehlo()
```
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### SAML example
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250724132846.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
No exception in Sentry, only the worker died suddenly🤷
<img src="attachments/Pasted image 20250724145727.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
No logs either
<img src="attachments/Pasted image 20250724133201.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Let's try to reproduce the issue in shell
```python
factory = APIRequestFactory()
user = User.objects.get(pk=12674)
payload = urlencode({'SAMLResponse': ''})
request = factory.post(
'/api/saml_login/foobar/?acs',
data=payload,
content_type='application/x-www-form-urlencoded',
HTTP_HOST="api.foo.bar.io",
wsgi_url_scheme='https',
SERVER_PORT='443',
)
force_authenticate(request, user=User.objects.get(pk=12674))
view = SamlAuthTokenViewSet.as_view({'post': 'post'})
view(request, uuid_id="f042fb42-4ac1-4e5a-bdb3-db286af56873")
```
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Floating point exception?!
<img src="attachments/Pasted image 20250724133447.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
```
gdb $BIN_PATH/python core.2874
```
<img src="attachments/Pasted image 20250722101521.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Related to `xmlsec` package
<img src="attachments/Pasted image 20250722101735.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722102403.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
We use this package as part of with SAML signature validation process
<img src="attachments/Pasted image 20250722102544.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722104604.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722102730.png" alt="" style="object-fit: scale-down">
<div style="position: fixed; bottom: 0; width: 100%; text-align: center; font-size: 40%; color: gray;">
<a href="https://github.com/xmlsec/python-xmlsec/issues/277">Source: https://github.com/xmlsec/python-xmlsec/issues/277</a>
</div>
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Minimal reproduce
```python
import io
import xmlsec
from lxml import etree
stream = io.BytesIO(b"""<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns="urn:envelope" ID="ef115a20-cf73-11e5-aed1-3c15c2c2cc88">
<Data>
Hello, World!
</Data>
</Envelope>
""")
root = etree.parse(stream).getroot()
xmlsec.tree.add_ids(root, ["ID"])
print(etree.tostring(root, pretty_print=True).decode())
```
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
We use `lxml` to create xml object and then sending this object to `xmlsec`
<img src="attachments/Pasted image 20250722103037.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
But why does this cause a crash?
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Using different `libxml2` versions together...
<img src="attachments/Pasted image 20250722103213.png" alt="" style="object-fit: scale-down">
<div style="position: fixed; bottom: 0; width: 100%; text-align: center; font-size: 40%; color: gray;">
<a href="https://github.com/xmlsec/python-xmlsec/pull/246">Source: https://github.com/xmlsec/python-xmlsec/pull/246</a>
</div>
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722103412.png" alt="" style="object-fit: scale-down">
<div style="position: fixed; bottom: 0; width: 100%; text-align: center; font-size: 40%; color: gray;">
<a href="https://python-social-auth.readthedocs.io/en/latest/backends/saml.html">Source: https://python-social-auth.readthedocs.io/en/latest/backends/saml.html</a>
</div>
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
Fix was to build `lxml` from source, so it will use the same system `libxml2` library
<img src="attachments/Pasted image 20250722103902.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
<img src="attachments/Pasted image 20250722104015.png" alt="" style="object-fit: scale-down">
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Stage 6: Production Rollout
- ­<!-- .element: class="fragment" data-fragment-index="1" -->QA approved, all checks passed ✅
- ­<!-- .element: class="fragment" data-fragment-index="2" -->Begin with partial rollout (e.g., APM pods)
- ­<!-- .element: class="fragment" data-fragment-index="3" -->Gradual deployment by region — smallest to largest
- ­<!-- .element: class="fragment" data-fragment-index="4" -->Continuous monitoring:
- ­<!-- .element: class="fragment" data-fragment-index="5" -->No Sentry errors
- ­<!-- .element: class="fragment" data-fragment-index="6" -->No customer complaints
- ­<!-- .element: class="fragment" data-fragment-index="7" -->System behaving as expected
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Day 27
APM went well
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Day 27
Australia too
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Day 28
Even Europe...
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
### Day 28
**If** all goes well until tomorrow, we will continue with US👏...
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->
<div class="" style="position: absolute; left: 0px; top: 0px; height: 700px; width: 1300px; min-height: 700px; display: flex; flex-direction: column; align-items: center; justify-content: center" absolute="true">
...But Things Didn't Go As Planned 😬
</div></script></section><section data-markdown><script type="text/template"><!-- .slide: class="drop" -->