Starting guide for Julia, coming from e.g. Python or C++

AI answers are often unbelievably good, and I believe also for this topic: ChatGPT - Julia Dict Comparisons

21. A particularly important Python → Julia mapping

I’m not new to Julia actually, I just though there should be a list of recommend packages coming from e.g. Python, and I recommend using OrderedCollections, Revise as a starting point, the latter just during development.

Python’s standard library is incredibly broad, you can e.g. send email with the standard library. Consider using PythonCall to get access to all of it, to use it as such as a “tool”. I’m most interested in A. more core capability/data structures, and to some degree about B. tools people know of in e.g. Python, and want a similar native Julia package for. Feel free to list a minimal list of packages for A (and/or B), even for C. for (web) frameworks for Julia parity. For those who know, or for new users who do not know the mapping, so we can help. The manual has a section for difference with many languages vs. Python, C++ etc. It and the help might need amending:

help?> Dict
..
  Dict{K,V}() constructs a hash table with keys of type K and values of type V. Keys are compared with isequal and hashed with hash.

The example is only implicit about unordered, so I suggest changing to:

  Dict{K,V}() constructs a (unordered) hash table with keys of type K and values of type V. Consider `using OrderedCollections` for access to `OrderedDict`. Keys are compared with isequal and hashed with hash.

To partially answer my own question, there is e.g. SMTPClient.jl to send email, no need for PythonCall.jl there (for basic capability, i.e. the actual sending). You can use all of Python’s current email capability, including email to construct the email, before sending; note smtpd was removed in Python 3.12, with aiosmtpd a substitute, and my answer doesn’t cover it or such servers.

I’ll just post this too even though AI generated (at least good for discussion if anything wrong there):

1. The genuinely important Python stdlib gaps

I’d put these near the top.

Python Julia stdlib/Base My assessment
heapq DataStructures.Heap Missing from stdlib, but trivial package substitute
collections.deque DataStructures.Deque Same
collections.defaultdict get! / custom types DataStructures.DefaultDict [Here AI was wrong: “No exact equivalent”]
collections.Counter StatsBase.countmap etc. Package
enum @enum Julia actually has it
dataclasses structs Julia doesn’t need the mechanism
functools do blocks, closures, higher-order functions Mostly unnecessary
itertools Base.Iterators Julia is arguably better here
operator operators/functions directly Mostly unnecessary
weakref WeakRef Julia has it
copy copy, deepcopy yes
pickle Serialization yes, though not equivalent in purpose/portability
json JSON package not stdlib
re Regex yes
argparse ArgTools.jl / packages not a real equivalent
subprocess Cmd, run, pipelines yes
pathlib Base.Filesystem yes, although less elegant
tempfile mktemp, mktempdir yes
shutil filesystem functions mostly yes
logging Logging yes
warnings Logging / warnings machinery not quite equivalent
traceback stacktrace machinery yes
inspect reflection Julia has a different, often more powerful model
ast Meta, JuliaSyntax yes, but fundamentally different
dis code_*, @code_* yes, arguably much richer
threading Base.Threads yes
multiprocessing distributed processes yes
asyncio Tasks/Channels yes, but different model
socket Base.Sockets yes
ssl MbedTLS [or rather OpenSSL.jl?] stdlib package
http.client / urllib Downloads yes
email ??? real gap
smtplib [SMTPClient.jl] real-ish gap
imaplib ??? gap
ftplib ??? gap
zipfile Tar etc. ZIP is surprisingly awkward
gzip CodecZlib.jl package
bz2 CodecBzip2.jl package
lzma CodecXz.jl package
sqlite3 SQLite.jl package
dbm [SQLite.jl] gap
configparser [avoid .ini files, rather use TOML or PythonCall.jl] gap
tomllib TOML yes
csv CSV.jl package
xml XML packages package
html.parser Gumbo etc. package
zipapp [AppBundler.jl or JuliaC.jl] gap
venv Pkg environments Julia arguably better
venv + pip Pkg major Julia advantage

zipapp is a rather unusual “library”/concept, and not a substitute to simply call it with PythonCall.jl, I replaced its ??? (and edited more such) with plausible alternatives. dbm is likely a real gap, but who cares… I put in indirect substitute…

I once had a MATLAB-Python-Julia cheatsheet saved in my collection. https://cheatsheets.quantecon.org/

seems quite old, from 2017?

Limiting this to Python’s standard library isn’t practical, including third-party Julia packages looks unfair by comparison, and it’s misleading to list those under “Julia stdlib/Base”.

For example, I would suggest uv, poetry, pixi, or pdm before venv and pip if this mapping went the other way.

It’s true that Python users don’t just use its standard library. I was just curious about the overlap, and well, what each language has additionally. I’m open to a list of any mapping you have or find relevant to have. “venv + pip” may not be important, I just kept it from the AI generated list. I suppose uv (and Conda etc.) very relevant, all map top Pkg (though there is I think one unofficial alternative by now…).

I asked the AI “What are some majorly used Python packages?” made sure to not ask for mapping right away, then for that. It seemed way too long to post, also might be based on outdated info, anyone can ask. But maybe helpful to post a partial answer:

1. General-purpose

Python Julia equivalent Status Comment
NumPy Base arrays + LinearAlgebra + Statistics Not really a gap; Julia’s array system is built into the language
SciPy SpecialFunctions, Distributions, Optim, NLsolve, DifferentialEquations, etc. ✓/≈ Functionally enormous coverage, but distributed across many packages
pandas DataFrames.jl, CSV.jl, Tables.jl [I would add Tidier.jl ecosystem here] Probably the clearest equivalent; DataFrames is explicitly the Julia analogue to pandas-style tabular work.
requests HTTP.jl / Downloads HTTP.jl is much more capable; Downloads handles simple fetching
httpx HTTP.jl Async HTTP etc.
Pydantic StructTypes.jl, JSON3.jl, Parameters.jl, Accessors.jl No single equally dominant “typed data model/validation” framework
PyYAML YAML.jl
tomlkit TOML stdlib ✓/≈ TOML itself is excellent in Julia; TOML.jl/std library covers parsing. tomlkit has specialized round-tripping/editing semantics
orjson JSON3.jl, StructTypes.jl Fast JSON; Julia’s JSON ecosystem is quite good
python-dateutil Dates stdlib Julia has this natively

..

5. Async/concurrency

Python Julia Status
asyncio Julia Tasks / Channels / Distributed / Threads
anyio Julia’s native concurrency model
trio Tasks/Channels ✓/≈
greenlet Tasks / coroutines
celery Dagger / Distributed / message-queue packages

This is one of the categories where a direct package comparison is misleading. …

6. Scientific / visualization

Python Julia Status
Matplotlib Makie.jl, Plots.jl, Gadfly.jl ✓/≈
SymPy Symbolics.jl, SymPy.jl ✓/≈
Numba Julia compiler itself
h5py HDF5.jl
networkx Graphs.jl
Pillow Images.jl, ImageIO.jl, FileIO.jl
OpenCV OpenCV.jl / image ecosystem

These are things I wouldn’t regard as reasons to use Python:

NumPy
SciPy
pandas
Matplotlib
Requests
PyYAML
python-dateutil
orjson
httpx

psycopg
redis
pyarrow
duckdb
openpyxl
h5py
NetworkX
Pillow

Numba
pytest
Black
Jupyter
XGBoost
LightGBM

In several cases Julia is arguably better positioned, because the equivalent isn’t an external library.

That’s definitely a practical improvement, though the conclusion is still very overblown.