Skip to content

Commit 95e40a7

Browse files
authored
Update for 25.1 (#22)
* wip * wip * Do a bit of profiling for some minor perf wins. * update version
1 parent 3c07884 commit 95e40a7

24 files changed

+3135
-8360
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,5 @@ output
173173
.vscode/
174174

175175
# Mojo
176-
*.mojopkg
176+
*.mojopkg
177+
*.dYSM

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ repos:
1212
entry: magic run mojo format -l 120
1313
language: system
1414
files: '\.(mojo|🔥)$'
15-
stages: [commit]
15+
stages: [pre-commit]
1616
- id: mojo-docs
1717
name: mojo-docs
1818
entry: python3 ./scripts/check-docstrings.py
1919
language: system
2020
pass_filenames: false
21-
stages: [commit]
21+
stages: [pre-commit]

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -313,3 +313,4 @@ Color chart lifted from <https://github.com/muesli/termenv>, give their projects
313313
## TODO
314314

315315
- Enable terminal querying for platforms other than UNIX based.
316+
- Support querying terminal background color and if it's light or dark.

benchmarks/run.mojo

+16-16
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,34 @@ fn bench_render_with_background_color():
4444
_ = output
4545

4646

47-
fn bench_render_big_file():
48-
var content: String = ""
49-
try:
50-
with open("./benchmarks/data/big.txt", "r") as file:
51-
content = file.read()
52-
var output = mist.render_as_color(content, 0xC9A0DC)
53-
_ = output
54-
except e:
55-
print(e)
47+
# fn bench_render_big_file():
48+
# var content: String = ""
49+
# try:
50+
# with open("./benchmarks/data/big.txt", "r") as file:
51+
# content = file.read()
52+
# var output = mist.render_as_color(content, 0xC9A0DC)
53+
# _ = output
54+
# except e:
55+
# print(e)
5656

5757

5858
def main():
5959
print("Running bench_rendering_with_profiles")
60-
var report = benchmark.run[bench_rendering_with_profiles](max_iters=20)
60+
var report = benchmark.run[bench_rendering_with_profiles](max_iters=1000)
6161
report.print(benchmark.Unit.ms)
6262

6363
print("Running bench_comptime_rendering_with_profiles")
64-
report = benchmark.run[bench_comptime_rendering_with_profiles](max_iters=20)
64+
report = benchmark.run[bench_comptime_rendering_with_profiles](max_iters=1000)
6565
report.print(benchmark.Unit.ms)
6666

6767
print("Running bench_render_as_color")
68-
report = benchmark.run[bench_render_as_color](max_iters=10)
68+
report = benchmark.run[bench_render_as_color](max_iters=1000)
6969
report.print(benchmark.Unit.ms)
7070

7171
print("Running bench_render_with_background_color")
72-
report = benchmark.run[bench_render_with_background_color](max_iters=10)
72+
report = benchmark.run[bench_render_with_background_color](max_iters=1000)
7373
report.print(benchmark.Unit.ms)
7474

75-
print("Running bench_render_big_file")
76-
report = benchmark.run[bench_render_big_file](max_iters=10)
77-
report.print(benchmark.Unit.ms)
75+
# print("Running bench_render_big_file")
76+
# report = benchmark.run[bench_render_big_file](max_iters=10)
77+
# report.print(benchmark.Unit.ms)

examples/hello_world.mojo

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn main():
99
var faint = true_color_style.faint()
1010
var italic = true_color_style.italic()
1111
var underline = true_color_style.underline()
12-
var crossout = true_color_style.crossout()
12+
var strikethrough = true_color_style.strikethrough()
1313

1414
var red = true_color_style.foreground(0xE88388)
1515
var green = true_color_style.foreground(0xA8CC8C)
@@ -32,7 +32,7 @@ fn main():
3232
faint.render("faint"),
3333
italic.render("italic"),
3434
underline.render("underline"),
35-
crossout.render("crossout"),
35+
strikethrough.render("strikethrough"),
3636
end="",
3737
)
3838

examples/hello_world_comptime.mojo

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ alias bold = true_color_style.bold()
88
alias faint = true_color_style.faint()
99
alias italic = true_color_style.italic()
1010
alias underline = true_color_style.underline()
11-
alias crossout = true_color_style.crossout()
11+
alias strikethrough = true_color_style.strikethrough()
1212

1313
alias red = true_color_style.foreground(0xE88388)
1414
alias green = true_color_style.foreground(0xA8CC8C)
@@ -34,7 +34,7 @@ fn main():
3434
faint.render("faint"),
3535
italic.render("italic"),
3636
underline.render("underline"),
37-
crossout.render("crossout"),
37+
strikethrough.render("strikethrough"),
3838
end="",
3939
)
4040

examples/profiles.mojo

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn renderers():
4141
print(mist.blue_background("Hello, world!"))
4242
print(mist.bold("Hello, world!"))
4343
print(mist.italic("Hello, world!"))
44-
print(mist.crossout("Hello, world!"))
44+
print(mist.strikethrough("Hello, world!"))
4545

4646

4747
fn main():

magic.lock

+1,451-8,085
Large diffs are not rendered by default.

mojoproject.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels = ["conda-forge", "https://conda.modular.com/max"]
44
description = "Mist lets you safely use advanced styling options on the terminal."
55
name = "mist"
66
platforms = ["osx-arm64", "linux-64"]
7-
version = "0.1.11"
7+
version = "0.1.12"
88
license = "MIT"
99
license-file = "LICENSE"
1010
homepage = "https://github.com/thatstoasty/mist"
@@ -19,13 +19,13 @@ build = { cmd = "python scripts/util.py build", env = { MODULAR_MOJO_IMPORT_PATH
1919
publish = { cmd = "python scripts/util.py publish", env = { PREFIX_API_KEY = "$PREFIX_API_KEY" } }
2020

2121
[dependencies]
22-
max = ">=24.6.0"
22+
max = "25.1.0"
2323

2424
[feature.nightly]
2525
channels = ["conda-forge", "https://conda.modular.com/max-nightly"]
2626

2727
[feature.nightly.dependencies]
28-
max = ">=24.6.0.dev2024121016"
28+
max = "*"
2929

3030
[environments]
3131
nightly = ["nightly"]

src/mist/__init__.mojo

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .color import Color
2-
from .style import Style, Style
2+
from .style import Style
33
from .profile import (
44
Profile,
55
ASCII,
@@ -34,6 +34,6 @@ from .renderers import (
3434
italic,
3535
underline,
3636
faint,
37-
crossout,
37+
strikethrough,
3838
overline,
3939
)

src/mist/ansi_colors.mojo

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ alias ANSI_HEX_CODES = InlineArray[UInt32, 255](
260260
)
261261
"""RGB values of ANSI colors (0-255)."""
262262

263-
alias COLOR_STRINGS = InlineArray[StringLiteral, 256](
263+
alias COLOR_STRINGS = InlineArray[String, 256](
264264
"0",
265265
"1",
266266
"2",

0 commit comments

Comments
 (0)