PSA: make it easier to help you


Sometimes questions on this forum fail to get a quick answer for reasons that may not be obvious to the person who opened the topic, but could be fixed easily when known. This is a list of suggestions that are commonly made, with the intention to make it linkable instead of being repeated every time.

Keywords are highlighted to make it easier to refer to specific points.

  1. Post quoted code, enclosing code blocks in triple-backticks ```:

    function f(x, y)
        x + y

    This will highlight the syntax and use a monospace font.

    Don’t post your code as a screenshot, as it becomes very difficult to read and impossible to copy-paste, so many people will just ignore it.

  2. Indent your code to reflect its block structure (your editor should help you with this). Our eyes are used to indented code, and find it more easier for spotting errors.

  3. Make your example self-contained (“minimal working example”, MWE), so that it runs (or at least gets to the error that you want help with) as is, without any additional steps. This means including package loading, eg

    using ThatPackage

    and, if applicable, data that the code operates on. If your data is large or proprietary, generate test data and include the functions for that.

  4. Simplify your problem. Unless you are absolutely certain that the whole code is needed to exhibit what you want to show, make an effort come up with a simpler version. This step takes the most effort, but often this alone helps with locating the problem. Also, shorter and simpler examples get answers quicker.

  5. Include code instead of REPL output, except when the latter is relevant.

  6. People assume that you are using the latest stable version of Julia and released packages (you can ensure the latter with pkg> up). If this is not the case, make sure you note the relevant versions.

  7. If you have a plotting (style) question, including a plot with the desired output (possibly generated with other software) is helpful.

  8. You may not get a response here for packages with a very narrow audience. In that case, you may want to consider opening an issue on Github (or Gitlab, etc) for the package repository, just to ask a question. Most packages are OK with this.

Simple type question
Format x-labels using VegaLite
Parallelizing function returns no output
Why doesn't this code work? I can't figure out
Large size of plot files generated using Plots.jl with GR backend
ML feature importance in julia
Unexpected Type conversion
Is there a way to suppress "method overwritten" warnings?
Custom likelihoods in Turing.jl
Performance of Memory Mapped Arrays (vs. JLD2)
Function change
A usage about multi-dimension arrays
Unnecessary compilation happening on every call
Logical processes remain active after my parallelized program ends
Julia stops unexpectedly (after 10 mins of use)
Weave with PyPlot.jl
Slow runtime when assigning struct reference
Trying to require Modules in a circular way, program just crashes
Convert array to dictionary
Question on use of include from 0.6 -- 1.0
How to convert CartesianIndex{N} values to Int64
Testing a package with runtests.jl does not generate graphical outputs
CUDAnative support for Float16
Applicationerror: solver (gurobi) did not exit normally

This is great! Consider changing the title to something like “Guidelines for asking questions about code” (or something a little simpler).



Good idea. I do not even know what PSA refers to here :blush: I have two suggestions:

  1. Change the title to “Advice on posting to Julia Discourse”
  2. The advice (or an improved version) should be a Julia Discourse FAQ.

For more inspiration, here is the link to the equivalent FAQ for Stata:

Update thanks to Google: PSA = Public Service Announcement


Thanks for the suggestion, but I don’t think that a document like the Stata FAQ is what I had in mind, keeping it short was a priority.


My personal addition:

  1. Be clear about which package you are talking about. A link to the github project repo is a good idea. Don’t assume there is only one package for doing a particular task, and that we will thus know what you mean when you say “the plotting package” or “the Markov Chain Monte Carlo package”. If you have an example following point 3 “Make your example self-contained” you should be fine.


Thanks for the suggestions. I will wait a while for more and then edit. Another thing I missed is guidance about cross-posting.


I’d like to add a comment for those seeking to post this in the future - while simply posting the link by itself may have the desired effect, including a sentence about why you’re posting it will be seen as far more friendly and welcoming. Eg:

Welcome to the Julia forums! Just so you know, you might have better luck getting answers if you follow some of these simple guidelines.

Or something.


Very nice list!
I also had no idea what “PSA” might mean.
I’d especially value the 4th step: Simplify your problem. So I’d move that item to the top!


Also to me it seems like a good idea to pin this topic.


I would like to thank everyone for the suggestions. I updated the post, mostly minor rewording and highlighting keywords for easier reference.

This is a good suggestion, but I think that the point about MWE should cover this, so I decided not to make the list longer (lest it would not be read).