# Exclude parsing of \`public\` statements in Julia v1.10 CI

**URL:** https://discourse.julialang.org/t/exclude-parsing-of-public-statements-in-julia-v1-10-ci/126998
**Category:** Tooling
**Tags:** codecov, ci
**Created:** [March 15, 2025, 11:59pm UTC](https://discourse.julialang.org/t/exclude-parsing-of-public-statements-in-julia-v1-10-ci/126998 "2025-03-15T23:59:16Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![nandoconde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nandoconde/32/19497_2.png) [@nandoconde](https://discourse.julialang.org/u/nandoconde)
#### Post date: [March 15, 2025, 11:59pm UTC](https://discourse.julialang.org/t/exclude-parsing-of-public-statements-in-julia-v1-10-ci/126998/1 "2025-03-15T23:59:17Z")

</div>

Hi!

I am in the latest steps of setting up my repo for publishing and I am now setting up CI. My repo has some symbols declared as `public` for v1.11+ releases, but I want to keep compatibility in LTS (since there is no _a priori_ incompatibility).

I have all my `public` declarations in a single file (`public.jl`), and I protect inclusion with what is recommended somewhere in Discourse:

```julia
VERSION >= v"1.11" && include("public.jl")

```

However, in CI, when no coverage is produced for the file, it tries to parse it with `JuliaParse`, which fails for Julia v1.10.

Is there a way to exclude this file for v1.10, or to avoid the errors in parsing?

---

<div class="post-metadata">

### Author: ![GHTaarn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ghtaarn/32/216007_2.png) [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)
#### Post date: [March 16, 2025, 6:16am UTC](https://discourse.julialang.org/t/exclude-parsing-of-public-statements-in-julia-v1-10-ci/126998/2 "2025-03-16T06:16:07Z")

</div>

There are the possible solutions of either using the `Compat.jl` package or using

```julia
public_declarations = "public x,y,z"
VERSION >= v"1.11" && eval(meta.parse(public_declarations))

```

I cannot test it myself, but maybe it would work if you moved your `public.jl` file to a directory that is not a subdirectory of `src`, e.g. `include("../publicdeclarations/public.jl")`.

---

<div class="post-metadata">

### Author: ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)
#### Post date: [March 16, 2025, 7:10am UTC](https://discourse.julialang.org/t/exclude-parsing-of-public-statements-in-julia-v1-10-ci/126998/3 "2025-03-16T07:10:10Z")

</div>

A multiline string holding all the public statements can be iterated over with `eachsplit(..., "\n")`, allowing `eval(Meta.parse(...))` in a loop. Still, the proper thing to do would be not to parse conditionally `include`-d files when they’re not `include`-d, but I don’t know the inner workings to know how feasible that is to do.

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [March 16, 2025, 7:19am UTC](https://discourse.julialang.org/t/exclude-parsing-of-public-statements-in-julia-v1-10-ci/126998/4 "2025-03-16T07:19:14Z")

</div>

> [@nandoconde](#):
>
> However, in CI, when no coverage is produced for the file, it tries to parse it with `JuliaParse`, which fails for Julia v1.10.

What does this mean? What’s “it”?

---

<div class="post-metadata">

### Author: ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)
#### Post date: [March 16, 2025, 7:19am UTC](https://discourse.julialang.org/t/exclude-parsing-of-public-statements-in-julia-v1-10-ci/126998/5 "2025-03-16T07:19:15Z")

</div>

See also

> [@Is Compat.jl worth it for the \`public\` keyword?](https://discourse.julialang.org/t/is-compat-jl-worth-it-for-the-public-keyword/119041):
>
> With the introduction of public by @Lilith, many packages will want to mark their unexported public symbols that way. Since public is only available in Julia 1.11, the current recommended way to do this in 1.10 is with the Compat.jl package. Before we add it everywhere, I’m wondering if there are any negative side effects to it? @stevengj seems to think it’s fine but I’d love to get other opinions. In particular, it depends on 4 stdlibs: Dates, LinearAlgebra, TOML and UUIDs.

---

<div class="post-metadata">

### Author: ![nandoconde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nandoconde/32/19497_2.png) [@nandoconde](https://discourse.julialang.org/u/nandoconde)
#### Post date: [March 16, 2025, 8:50am UTC](https://discourse.julialang.org/t/exclude-parsing-of-public-statements-in-julia-v1-10-ci/126998/6 "2025-03-16T08:50:34Z")

</div>

The codecov action (or whatever generates codecov files in Julia), detects that the file was not included when running Julia v1.10 and thus no codecov file was generated, and attempts to run the Julia parser directly on it to generate it. This is the step that fails.

I am away from my PC, but I’ll post screenshot as soon as I get back.

---

<div class="post-metadata">

### Author: ![nandoconde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nandoconde/32/19497_2.png) [@nandoconde](https://discourse.julialang.org/u/nandoconde)
#### Post date: [March 16, 2025, 8:55am UTC](https://discourse.julialang.org/t/exclude-parsing-of-public-statements-in-julia-v1-10-ci/126998/7 "2025-03-16T08:55:27Z")

</div>

Yeah, I knew about this solution but I prefer to leave it as the last resort, because it is not very aesthetic ☹

---

<div class="post-metadata">

### Author: ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)
#### Post date: [March 16, 2025, 9:14am UTC](https://discourse.julialang.org/t/exclude-parsing-of-public-statements-in-julia-v1-10-ci/126998/8 "2025-03-16T09:14:38Z")

</div>

Oh what am I thinking, we wouldn’t need to iterate a multi-line string and `eval(Meta.parse(...))` each line ourselves, `include`’s underlying `include_string(@ __MODULE__ , ...)` is also API. I would still prefer that non-`include`-d files aren’t parsed by codecov, but the upside of this is you don’t need to move public statements to a separate file to dodge the v1.10- parsers in precompilation either.

---

<div class="post-metadata">

### Author: ![nandoconde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nandoconde/32/19497_2.png) [@nandoconde](https://discourse.julialang.org/u/nandoconde)
#### Post date: [March 16, 2025, 11:19pm UTC](https://discourse.julialang.org/t/exclude-parsing-of-public-statements-in-julia-v1-10-ci/126998/9 "2025-03-16T23:19:01Z")

</div>

This is the report from the GitHub Action

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/0/c0be7383af8e949b6a056f3a9827aea8b21bc812.png)
