Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-trivial dependencies #291

Closed
juliohm opened this issue Sep 12, 2022 · 4 comments · Fixed by #294
Closed

Non-trivial dependencies #291

juliohm opened this issue Sep 12, 2022 · 4 comments · Fixed by #294

Comments

@juliohm
Copy link
Contributor

juliohm commented Sep 12, 2022

Using the awesome PkgDepencency.jl package, I realized that one of my heaviest dependencies is UnicodePlots.jl:

image

I wonder if there is a way to split these dependencies on external libraries (e.g. EarCut_jll), GeometryBasics.jl etc? If that is not possible, do you know any alternative package for simple bar plots on the terminal that I could use to print compositional data as shown in this readme? https://github.com/JuliaEarth/CoDa.jl

Alternatively, could the recipes in UnicodePlots.jl be split into separate modules and glued together into UnicodePlots.jl for end-users? As a package developer I would really prefer to just add a UnicodeBarPlots.jl package to avoid all the fuzz with 3D dependencies.

@t-bltg
Copy link
Member

t-bltg commented Sep 13, 2022

julia> using PkgDependency
julia> PkgDependency.tree("UnicodePlots")
dependency tree
 UnicodePlots v3.1.0                                                        
━━━━━━━━━━━━━━━━━━━━━                                                       
          │                                                                 
          ├── MarchingCubes v0.1.4                                          
          │   ├── StaticArrays v1.5.6                                       
          │   │   └── StaticArraysCore v1.3.0                               
          │   └── SnoopPrecompile v1.0.1                                    
          ├── ColorSchemes v3.19.0                                          
          │   ├── ColorTypes v0.11.4                                        
          │   │   └── FixedPointNumbers v0.8.4                              
          │   ├── ColorVectorSpace v0.9.9                                   
          │   │   ├── ColorTypes v0.11.4 (*)                                
          │   │   ├── TensorCore v0.1.1                                     
          │   │   ├── SpecialFunctions v2.1.7                               
          │   │   │   ├── IrrationalConstants v0.1.1                        
          │   │   │   ├── ChainRulesCore v1.15.5                            
          │   │   │   │   └── Compat v3.46.0                                
          │   │   │   │       ├── Pkg v1.8.0                                
          │   │   │   │       │   ├── Downloads v1.6.0                      
          │   │   │   │       │   │   ├── LibCURL v0.6.3                    
          │   │   │   │       │   │   │   ├── MozillaCACerts_jll v2022.2.1  
          │   │   │   │       │   │   │   └── LibCURL_jll v7.84.0+0         
          │   │   │   │       │   │   │       ├── LibSSH2_jll v1.10.2+0     
          │   │   │   │       │   │   │       │   └── MbedTLS_jll v2.28.0+0 
          │   │   │   │       │   │   │       ├── MbedTLS_jll v2.28.0+0 (*) 
          │   │   │   │       │   │   │       ├── nghttp2_jll v1.48.0+0     
          │   │   │   │       │   │   │       └── Zlib_jll v1.2.12+3        
          │   │   │   │       │   │   ├── NetworkOptions v1.2.0             
          │   │   │   │       │   │   └── ArgTools v1.1.1                   
          │   │   │   │       │   ├── Tar v1.10.0                           
          │   │   │   │       │   │   ├── SHA v0.7.0                        
          │   │   │   │       │   │   └── ArgTools v1.1.1 (*)               
          │   │   │   │       │   ├── SHA v0.7.0 (*)                        
          │   │   │   │       │   ├── p7zip_jll v17.4.0+0                   
          │   │   │   │       │   └── TOML v1.0.0                           
          │   │   │   │       └── SHA v0.7.0 (*)                            
          │   │   │   ├── LogExpFunctions v0.3.18                           
          │   │   │   │   ├── IrrationalConstants v0.1.1 (*)                
          │   │   │   │   ├── ChainRulesCore v1.15.5 (*)                    
          │   │   │   │   ├── ChangesOfVariables v0.1.4                     
          │   │   │   │   │   └── ChainRulesCore v1.15.5 (*)                
          │   │   │   │   ├── DocStringExtensions v0.8.6                    
          │   │   │   │   └── InverseFunctions v0.1.7                       
          │   │   │   ├── OpenLibm_jll v0.8.1+0                             
          │   │   │   └── OpenSpecFun_jll v0.5.5+0                          
          │   │   │       ├── JLLWrappers v1.4.1                            
          │   │   │       │   └── Preferences v1.3.0                        
          │   │   │       │       └── TOML v1.0.0 (*)                       
          │   │   │       ├── Pkg v1.8.0 (*)                                
          │   │   │       └── CompilerSupportLibraries_jll v0.5.2+0         
          │   │   └── FixedPointNumbers v0.8.4 (*)                          
          │   ├── Colors v0.12.8                                            
          │   │   ├── ColorTypes v0.11.4 (*)                                
          │   │   ├── Reexport v1.2.2                                       
          │   │   └── FixedPointNumbers v0.8.4 (*)                          
          │   └── FixedPointNumbers v0.8.4 (*)                              
          ├── SnoopPrecompile v1.0.1 (*)                                    
          ├── StatsBase v0.33.21                                            
          │   ├── LogExpFunctions v0.3.18 (*)                               
          │   ├── SortingAlgorithms v1.0.1                                  
          │   │   └── DataStructures v0.18.13                               
          │   │       ├── Compat v3.46.0 (*)                                
          │   │       └── OrderedCollections v1.4.1                         
          │   ├── Missings v1.0.2                                           
          │   │   └── DataAPI v1.10.0                                       
          │   ├── DataStructures v0.18.13 (*)                               
          │   ├── StatsAPI v1.5.0                                           
          │   └── DataAPI v1.10.0 (*)                                       
          ├── ColorTypes v0.11.4 (*)                                        
          ├── Crayons v4.1.1                                                
          ├── FileIO v1.15.0                                                
          │   ├── Pkg v1.8.0 (*)                                            
          │   └── Requires v1.3.0                                           
          ├── StaticArrays v1.5.6 (*)                                       
          ├── Unitful v1.11.0                                               
          │   └── ConstructionBase v1.4.1                                   
          ├── FreeTypeAbstraction v0.10.0                                   
          │   ├── FreeType v4.0.0                                           
          │   │   ├── CEnum v0.4.2                                          
          │   │   └── FreeType2_jll v2.10.4+0                               
          │   │       ├── JLLWrappers v1.4.1 (*)                            
          │   │       ├── Pkg v1.8.0 (*)                                    
          │   │       ├── Bzip2_jll v1.0.8+0                                
          │   │       │   ├── JLLWrappers v1.4.1 (*)                        
          │   │       │   └── Pkg v1.8.0 (*)                                
          │   │       └── Zlib_jll v1.2.12+3 (*)                            
          │   ├── ColorVectorSpace v0.9.9 (*)                               
          │   ├── Colors v0.12.8 (*)                                        
          │   └── GeometryBasics v0.4.3                                     
          │       ├── IterTools v1.4.0                                      
          │       ├── StaticArrays v1.5.6 (*)                               
          │       ├── Tables v1.7.0                                         
          │       │   ├── DataAPI v1.10.0 (*)                               
          │       │   ├── OrderedCollections v1.4.1 (*)                     
          │       │   ├── IteratorInterfaceExtensions v1.0.0                
          │       │   ├── DataValueInterfaces v1.0.0                        
          │       │   └── TableTraits v1.0.1                                
          │       │       └── IteratorInterfaceExtensions v1.0.0 (*)        
          │       ├── EarCut_jll v2.2.3+0                                   
          │       │   ├── JLLWrappers v1.4.1 (*)                            
          │       │   └── Pkg v1.8.0 (*)                                    
          │       ├── StructArrays v0.6.12                                  
          │       │   ├── DataAPI v1.10.0 (*)                               
          │       │   ├── StaticArraysCore v1.3.0 (*)                       
          │       │   ├── Tables v1.7.0 (*)                                 
          │       │   └── Adapt v3.4.0                                      
          │       └── GeoInterface v1.0.1                                   
          │           └── Extents v0.1.1                                    
          ├── LazyModules v0.3.1                                            
          ├── Contour v0.6.2                                                
          ├── Requires v1.3.0 (*)                                           
          └── NaNMath v1.0.1                                                
              └── OpenLibm_jll v0.8.1+0 (*)  

I agree that some dependencies are problematic. However, as a developer I try to reuse as much existing julia packages in order to reduce maintenance and avoid re-inventing the wheel. Adding dependencies is unavoidable in a certain way: users are requesting more and more features: e.g. when you asked for Unitful support in #230, we had to add the Unitful dependency, and they just pile up.

I see two problematic dependencies:

  1. FreeTypeAbstraction: solely used for png exports of plots, and currently lazily loaded (lazily load FreeTypeAbstraction #260) in order to reduce latency;
  2. ColorSchemes: there was a splitting attempt at Proposal: split ColorSchemes.jl into two separate packages JuliaGraphics/ColorSchemes.jl#19, the problematic dependency looks like ColorVectorSpace (also used in FreeTypeAbstraction, so considered minor ?).

If that is not possible, do you know any alternative package for simple bar plots on the terminal that I could use to print compositional data as shown in this readme?

Not to my knowledge.

Alternatively, could the recipes in UnicodePlots.jl be split into separate modules and glued together into UnicodePlots.jl for end-users?

That would be quite difficult to implement, and I guess for small benefit (I won't have the bandwidth to work on this). IMO it is better to open upstream issues in problematic packages to request splitting packages or reduce dependencies.

As a package developer I would really prefer to just add a UnicodeBarPlots.jl package to avoid all the fuzz with 3D dependencies.

I think we can open an issue in FreeTypeAbstraction since adding GeometryBasics (with induced artifacts dependencies, and un-needed mesh related stuff) looks like an overkill for rendering characters.

@cormullion
Copy link

ColorSchemes was split successfully. But the "pretty lightweight" dependency on ColorVectorSpace was added in JuliaGraphics/ColorSchemes.jl#91 - to improve speed and memory use, apparently. SpecialFunctions (JuliaGraphics/ColorVectorSpace.jl#182) is being looked at...😀

@t-bltg
Copy link
Member

t-bltg commented Sep 30, 2022

Thanks @cormullion, I don't really see where to go with this issue.

I've made my part in JuliaGeometry/GeometryBasics.jl#179, but it seems to go nowhere.

Yes, here too we lazy load FreetypeAbstraction, but it is still listed in the dependencies. I do think this lazy approach is acceptable, since what is truly important is the load time, not the number of dependencies (if you omit the dependency hell problem 😆 ).

@t-bltg
Copy link
Member

t-bltg commented Feb 4, 2023

With JuliaGraphics/ColorVectorSpace.jl#186:

julia> using PkgDependency
julia> PkgDependency.tree("UnicodePlots")
dependency tree
 UnicodePlots v3.3.4                                            
━━━━━━━━━━━━━━━━━━━━━                                           
          │                                                     
          ├── MarchingCubes v0.1.6                              
          │   ├── StaticArrays v1.5.12                          
          │   │   ├── Statistics v1.9.0                         
          │   │   └── StaticArraysCore v1.4.0                   
          │   └── SnoopPrecompile v1.0.3                        
          │       └── Preferences v1.3.0                        
          │           └── TOML v1.0.3                           
          ├── ColorSchemes v3.20.0                              
          │   ├── ColorTypes v0.11.4                            
          │   │   └── FixedPointNumbers v0.8.4                  
          │   │       └── Statistics v1.9.0 (*)                 
          │   ├── ColorVectorSpace v0.9.9                       
          │   │   ├── Statistics v1.9.0 (*)                     
          │   │   ├── ColorTypes v0.11.4 (*)                    
          │   │   ├── TensorCore v0.1.1                         
          │   │   └── FixedPointNumbers v0.8.4 (*)              
          │   ├── Colors v0.12.10                               
          │   │   ├── ColorTypes v0.11.4 (*)                    
          │   │   ├── Reexport v1.2.2                           
          │   │   └── FixedPointNumbers v0.8.4 (*)              
          │   ├── SnoopPrecompile v1.0.3 (*)                    
          │   └── FixedPointNumbers v0.8.4 (*)                  
          ├── SnoopPrecompile v1.0.3 (*)                        
          ├── FreeType v4.0.0                                   
          │   ├── CEnum v0.4.2                                  
          │   └── FreeType2_jll v2.10.4+0                       
          │       ├── JLLWrappers v1.4.1                        
          │       │   └── Preferences v1.3.0 (*)                
          │       ├── Pkg v1.9.0                                
          │       │   ├── Downloads v1.6.0                      
          │       │   │   ├── LibCURL v0.6.3                    
          │       │   │   │   ├── MozillaCACerts_jll v2022.10.11
          │       │   │   │   └── LibCURL_jll v7.84.0+0         
          │       │   │   │       ├── LibSSH2_jll v1.10.2+0     
          │       │   │   │       │   └── MbedTLS_jll v2.28.0+0 
          │       │   │   │       ├── MbedTLS_jll v2.28.0+0 (*) 
          │       │   │   │       ├── nghttp2_jll v1.48.0+0     
          │       │   │   │       └── Zlib_jll v1.2.13+0        
          │       │   │   ├── NetworkOptions v1.2.0             
          │       │   │   └── ArgTools v1.1.1                   
          │       │   ├── Tar v1.10.0                           
          │       │   │   ├── SHA v0.7.0                        
          │       │   │   └── ArgTools v1.1.1 (*)               
          │       │   ├── SHA v0.7.0 (*)                        
          │       │   ├── p7zip_jll v17.4.0+0                   
          │       │   └── TOML v1.0.3 (*)                       
          │       ├── Bzip2_jll v1.0.8+0                        
          │       │   ├── JLLWrappers v1.4.1 (*)                
          │       │   └── Pkg v1.9.0 (*)                        
          │       └── Zlib_jll v1.2.13+0 (*)                    
          ├── StatsBase v0.33.21                                
          │   ├── Statistics v1.9.0 (*)                         
          │   ├── LogExpFunctions v0.3.20                       
          │   │   ├── IrrationalConstants v0.1.1                
          │   │   └── DocStringExtensions v0.9.3                
          │   ├── SortingAlgorithms v1.1.0                      
          │   │   └── DataStructures v0.18.13                   
          │   │       ├── Compat v4.6.0                         
          │   │       └── OrderedCollections v1.4.1             
          │   ├── Missings v1.1.0                               
          │   │   └── DataAPI v1.14.0                           
          │   ├── DataStructures v0.18.13 (*)                   
          │   ├── StatsAPI v1.5.0                               
          │   └── DataAPI v1.14.0 (*)                           
          ├── ColorTypes v0.11.4 (*)                            
          ├── Crayons v4.1.1                                    
          ├── FileIO v1.16.0                                    
          │   ├── Pkg v1.9.0 (*)                                
          │   └── Requires v1.3.0                               
          ├── StaticArrays v1.5.12 (*)                          
          ├── Unitful v1.12.2                                   
          │   └── ConstructionBase v1.4.1                       
          ├── Contour v0.6.2                                    
          ├── Requires v1.3.0 (*)                               
          └── NaNMath v1.0.1                                    
              └── OpenLibm_jll v0.8.1+0                         

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants