# \#python-interop

**URL:** https://forum.modular.com/tag/python-interop/10.md

[Latest](https://forum.modular.com/latest.md) · [Categories](https://forum.modular.com/categories.md) · [Tags](https://forum.modular.com/tags.md)

---

## [Writing Float64 into numpy via UnsafePointer corrupts when also reading another float64 buffer (Mojo 1.0b3)](https://forum.modular.com/t/writing-float64-into-numpy-via-unsafepointer-corrupts-when-also-reading-another-float64-buffer-mojo-1-0b3/3371)

<div class="topic-metadata">

**Author:** [@Curious](https://forum.modular.com/u/Curious)\
**Replies:** 3\
**Last updated:** [August 7, 2026, 1:00am UTC](https://forum.modular.com/t/writing-float64-into-numpy-via-unsafepointer-corrupts-when-also-reading-another-float64-buffer-mojo-1-0b3/3371 "2026-08-07T01:00:35Z")

</div>

We build a Python extension with PythonModuleBuilder and need a fast path that fills preallocated numpy float64/int64 buffers from Mojo (COO weight build). Pattern that fails on \`Mojo 1.0.0b3.dev2026080406\` + numpy 2.5…

---

## [How do I convert a python float to a Float32?](https://forum.modular.com/t/how-do-i-convert-a-python-float-to-a-float32/2645)

<div class="topic-metadata">

**Author:** [@Jweston](https://forum.modular.com/u/Jweston)\
**Replies:** 5\
**Last updated:** [February 5, 2026, 5:33pm UTC](https://forum.modular.com/t/how-do-i-convert-a-python-float-to-a-float32/2645 "2026-02-05T17:33:02Z")

</div>

I am trying to iterate over a Python list and compare the values to those in a Mojo Float32 list, but I have not found a way of converting a Python float to any Mojo type for comparison. I’ve tried Float32(f.to\_float64(…

---

## [Python.array() or Python.memoryview() converters for Mojo types](https://forum.modular.com/t/python-array-or-python-memoryview-converters-for-mojo-types/2113)

<div class="topic-metadata">

**Author:** [@laranzu](https://forum.modular.com/u/laranzu)\
**Replies:** 0\
**Last updated:** [August 11, 2025, 11:52pm UTC](https://forum.modular.com/t/python-array-or-python-memoryview-converters-for-mojo-types/2113 "2025-08-11T23:52:55Z")

</div>

Proposal: the Mojo python.Python module should have a function that creates a Python array.array or memoryview object from a Mojo array of numbers like object, such as a GPu HostBuffer. Use case: I wrote my first Mojo G…

---

## [Kivy framework for Mojo](https://forum.modular.com/t/kivy-framework-for-mojo/1852)

<div class="topic-metadata">

**Author:** [@siyo](https://forum.modular.com/u/siyo)\
**Replies:** 1\
**Last updated:** [June 30, 2025, 2:55pm UTC](https://forum.modular.com/t/kivy-framework-for-mojo/1852 "2025-06-30T14:55:41Z")

</div>

Hello ! I’m developing a python program based on KivyMD framework. how’s the state of art about a possible integration of this Python framework on mojo ?

---

## [Mojo-pytest updated for v25.3](https://forum.modular.com/t/mojo-pytest-updated-for-v25-3/1424)

<div class="topic-metadata">

**Author:** [@guidorice](https://forum.modular.com/u/guidorice)\
**Replies:** 1\
**Last updated:** [May 11, 2025, 7:05pm UTC](https://forum.modular.com/t/mojo-pytest-updated-for-v25-3/1424 "2025-05-11T19:05:44Z")

</div>

Hi all, mojo-pytest is updated for v25.3. A mojo language test runner plugin for pytest. Try it for your mixed Python and Mojo codebases! Hat tip to @sora for the pull request.

---

## [Fun with PythonObjects - Mojo compiler error](https://forum.modular.com/t/fun-with-pythonobjects-mojo-compiler-error/1082)

<div class="topic-metadata">

**Author:** [@EzRyder](https://forum.modular.com/u/EzRyder)\
**Replies:** 0\
**Last updated:** [March 19, 2025, 12:18am UTC](https://forum.modular.com/t/fun-with-pythonobjects-mojo-compiler-error/1082 "2025-03-19T00:18:09Z")

</div>

This issue was quite a challenge to figure out from within my project’s code, but with persistence I reduced the compiler error down to a minimal repro. Follow the link below for the details in the issue opened today on …

---

## [How to set the default value for an argument of type PythonObject?](https://forum.modular.com/t/how-to-set-the-default-value-for-an-argument-of-type-pythonobject/758)

<div class="topic-metadata">

**Author:** [@EzRyder](https://forum.modular.com/u/EzRyder)\
**Replies:** 2\
**Last updated:** [March 14, 2025, 3:39am UTC](https://forum.modular.com/t/how-to-set-the-default-value-for-an-argument-of-type-pythonobject/758 "2025-03-14T03:39:46Z")

</div>

I need to set a default value within a Mojo function call which has an argument of type PythonObject. I managed to cause the compiler to die horribly, and found a different compiler error using an inline if-else. In the …

---

## [Mojo/Python project folder structure](https://forum.modular.com/t/mojo-python-project-folder-structure/677)

<div class="topic-metadata">

**Author:** [@EzRyder](https://forum.modular.com/u/EzRyder)\
**Replies:** 10\
**Last updated:** [March 11, 2025, 8:30pm UTC](https://forum.modular.com/t/mojo-python-project-folder-structure/677 "2025-03-11T20:30:18Z")

</div>

I originally posted this on Discord (link), but @DarinSimmons felt it would make a good topic for this forum. I’m looking for guidance on folder organization for a significant Mojo/Python project. I’m importing standard…

---

## [How to liberate python object allocated memory in mojo?](https://forum.modular.com/t/how-to-liberate-python-object-allocated-memory-in-mojo/515)

<div class="topic-metadata">

**Author:** [@kraudy](https://forum.modular.com/u/kraudy)\
**Replies:** 1\
**Last updated:** [February 4, 2025, 7:09pm UTC](https://forum.modular.com/t/how-to-liberate-python-object-allocated-memory-in-mojo/515 "2025-02-04T19:09:20Z")

</div>

When i run a mojo program that uses Python objects like var sklearn = Python.import\_module("sklearn.datasets") using build -sanitize address i get a lot of indirect leak memory warnings by the mojo compiler. Is there a…
