AttoBot for Pkg3 projects

Currently, new packages that only supports v0.7+ will not need the REQUIRE file, however attobot will require a REQUIRE file, how should I register (and maybe update) the package then? Or should I add a REQUIRE according to Project.toml?

1 Like

For the moment, yes, use REQUIRE files and register to METADATA.

Is it OK to add a REQUIRE in addition to Project.toml, with of course identical contents (except for standard libraries)?

Yes.

1 Like

Is there a timeframe for dropping the requirement for REQUIRE for registered packages? The 1.0 manual does not even mention it, yet it is still required in practice for package registration.

Just asking because if it will be with us in the medium run, I would just generate REQUIRE from Project.toml using a git hook.

1 Like

My current workaround is the script

#!/usr/bin/env julia
######################################################################
# Overwrite REQUIRE using dependency information from Project.toml.
#
# Call from the root of the package repository.
#
# Has some basic sanity checks, but **use at your own risk**, `REQUIRE`
# will be overwritten.
######################################################################

import Pkg
const PT = Pkg.Types

Pkg.activate(pwd())             # current directory as the project
ctx = PT.Context()
pkg = ctx.env.pkg
if pkg ≡ nothing
    @error "Not in a package, I won't generate REQUIRE."
    exit(1)
else
    @info "found package" pkg = pkg
end

deps = PT.get_deps(ctx)
non_std_deps = sort(collect(setdiff(keys(deps), values(ctx.stdlibs))))

open("REQUIRE", "w") do io
    for d in non_std_deps
        println(io, d)
        @info "listing $d"
    end
end

which I call manually to generate REQUIRE. Hope this will be fixed soon, I opened an issue

https://github.com/attobot/attobot/issues/50

2 Likes

Is there any update on AttoBot recently? Or and plans?

One question about your script, @Tamas_Papp - it doesn’t seem to generate a julia x.y entry in the “REQUIRE” file. Is that intentional?

Yes, it is, since it is not something the script can easily determine.

Thanks, I suspected that might be the reason. “Project.toml” doesn’t allow to specify a Julia version range, right?

It does, see the docs.

It is rather that the script was intended to be as a super-simple workaround, and only gives package names, not versions, at the moment.

If anyone has the time to extend it, they are welcome to do modify it.

So it does, silly me. I think it’s because I’ve seen so many “Project.toml” files without Julia version spec around …