Expected the file `src/HijriConverter.jl` to exist for package `HijriConverter` at `…/HijriConverter.jl`

Viewed 65

I am trying to add dependencies to a package that I am developing, but I get the following error:

(HijriConverter) pkg> add Parameters
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
ERROR: expected the file `src/HijriConverter.jl` to exist for package `HijriConverter` at `/home/jafar_isbarov/Documents/projects/hijri/hijri-converter-julia-package/HijriConverter.jl`

Adding a file named HijriConverter to the src folder does solve the problem. I have two questions.

(1) Why do I need a file with the same name as the package? Is it supposed to have certain content? (2) If I add that file, add dependencies, and delete the file afterwards, will that cause any problems?

Thanks.

1 Answers

To understand the minimal package requirements try running Pkg.generate as in code below:

julia> Pkg.generate("MyPackage")
  Generating  project MyPackage:
    MyPackage\Project.toml
    MyPackage\src/MyPackage.jl
Dict{String, Base.UUID} with 1 entry:
  "MyPackage" => UUID("bad70bc4-3cf3-42bb-9f14-6b74ac64e2d7")

And here is the minimal file layout:

shell> tree /F
C:.
└───MyPackage
    │   Project.toml
    │
    └───src
            MyPackage.jl

And this is the generated module content with a single simple function:

shell> more MyPackage\\src\\MyPackage.jl
module MyPackage

greet() = print("Hello World!")

end # module

Further reading: https://pkgdocs.julialang.org/v1/creating-packages/

Related