Skip to content

Commit 8f3f79b

Browse files
authored
Updates for mojo v24.6 (#20)
- update conda env to use mojo 24.6 Side-car change - use implicitly declared variables, just for simplicity
1 parent 3de2df3 commit 8f3f79b

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ channels:
66
dependencies:
77
- python>=3.10
88
# modular MAX installs mojo as well
9-
- max=24.5
9+
- max=24.6
1010
- pytest>=7.4
1111
# python-xdist is optional: https://github.com/guidorice/mojo-pytest/wiki#2024-07-17-here-is-a-performance-tip
1212
- pytest-xdist

example_src/my_package/fibonacci.mojo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ fn fibonacci(n: Int) -> Int:
55
if n <= 1:
66
return n
77

8-
var a = 0
9-
var b = 1
8+
a = 0
9+
b = 1
1010
for _ in range(2, n + 1):
1111
a, b = b, a + b
1212
return b

example_src/my_package/random_tensor.mojo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ fn random_tensor[T: DType]() raises -> Tensor[T]:
66
"""
77
Wraps Tensor.rand() and multiplies a few tensors.
88
"""
9-
var Shape = TensorShape(100, 1)
9+
Shape = TensorShape(100, 1)
1010
return Tensor[T].rand(Shape) * Tensor[T].rand(Shape) * Tensor[T].rand(Shape)

example_tests/my_package/test_fibonacci.mojo

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ def test_fibonacci():
77
"""
88
Test fibonacci 10th number.
99
"""
10-
var expect = 55
11-
var got = fibonacci(10)
10+
expect = 55
11+
got = fibonacci(10)
1212
assert_equal(got, expect)
1313

1414

1515
def test_fibonacci_reference():
1616
"""
1717
Test mojo fibonacci versus python "reference" implementation.
1818
"""
19-
var py = Python.import_module("my_package.fibonacci")
19+
py = Python.import_module("my_package.fibonacci")
2020
for n in range(0, 10):
21-
var expect = py.fibonacci(n)
22-
var got = fibonacci(n)
21+
expect = py.fibonacci(n)
22+
got = fibonacci(n)
2323
assert_equal(got, expect)

example_tests/my_package/test_random_tensor.mojo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def test_random_tensor():
77
Validate the random_tensor module in my_package.
88
"""
99
alias T = DType.float64
10-
var t = random_tensor[T]()
11-
var sample_value = t[0]
10+
t = random_tensor[T]()
11+
sample_value = t[0]
1212
assert_false(isnan(sample_value))
1313
assert_true(isfinite(sample_value))

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[project]
22
name = "pytest-mojo"
3-
version = "v24.5"
3+
version = "v24.6"
44
description = "Mojo🔥 language test runner plugin for pytest. (aka pytest-mojo)"
55
authors = [{name = "Alex G Rice", email = "alex@ricegeo.dev"}]
66
license = {file = "LICENSE"}
77
requires-python = ">=3.10"
8+
89
[build-system]
910
requires = ["setuptools>=45", "wheel"]
1011
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)