https://github.com/clima/structuredprinting.jl
A simple Julia package for printing structs in a structured way.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (5.0%) to scientific vocabulary
Repository
A simple Julia package for printing structs in a structured way.
Basic Info
- Host: GitHub
- Owner: CliMA
- License: apache-2.0
- Language: Julia
- Default Branch: main
- Size: 18.6 KB
Statistics
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 4
Metadata Files
README.md
StructuredPrinting.jl
A simple Julia package for printing structs in a structured way, while offering a way to filter and highlight specified information. This package was developed for debugging.
Demo
Here's a demo of this package in action (directly from the test suite):
```julia struct Leaf{T} end
struct Branch{A,B,C} leafA::A leafB::B leafC::C end
struct Tree{A,B,C} branchA::A branchB::B branchC::C end
t = Tree( Branch(Leaf{(:A1, :L1)}(), Leaf{(:B1, :L2)}(), Leaf{(:C1, :L3)}()), Branch(Leaf{(:A2, :L1)}(), Leaf{(:B2, :L2)}(), Leaf{(:C2, :L3)}()), Branch(Leaf{(:A3, :L1)}(), Leaf{(:B3, :L2)}(), Leaf{(:C3, :L3)}()), )
using StructuredPrinting
Print struct alone
@structured_print t
Print struct with type highlighted
@structuredprint t Options(; printobj = x-> x isa typeof(t.branchB))
Print struct with Tuple of types highlighted
@structuredprint t Options(; printobj = x->any(y->x isa y, (typeof(t.branchB), typeof(t.branchA)))) ```
StructuredPrinting can be useful to find which object match certain types, which can be helpful to identify potential inference issues:
```julia struct Foo{A} a::A end bar(obj, i::Int) = obj.type(i) obj = (; type = Foo, x = 1, y = 2) # using a (<:Type)::DataType is a performance issue bar(obj, 3) # make sure this is callable @code_warntype bar(obj, 3) # demo performance issue
using StructuredPrinting
@structured_print obj Options(; highlight = x->any(y->x isa y, (UnionAll, DataType))) # highlight UnionAll and DataTypes
```
Owner
- Name: Climate Modeling Alliance
- Login: CliMA
- Kind: organization
- Email: clima@caltech.edu
- Website: https://clima.caltech.edu
- Repositories: 67
- Profile: https://github.com/CliMA
An alliance of scientists, engineers and applied mathematicians, dedicated to pioneering a new, data-informed approach to climate modeling
GitHub Events
Total
- Watch event: 1
- Pull request event: 2
- Create event: 1
Last Year
- Watch event: 1
- Pull request event: 2
- Create event: 1
Dependencies
- JuliaRegistries/TagBot v1 composite
- actions/cache v1 composite
- actions/checkout v4 composite
- codecov/codecov-action v1 composite
- julia-actions/julia-buildpkg v1 composite
- julia-actions/julia-processcoverage v1 composite
- julia-actions/julia-runtest v1 composite
- julia-actions/setup-julia v1 composite