Skip to content

Commit

Permalink
Installation instructions (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman authored Dec 4, 2024
1 parent 01e0f35 commit 9bc0e97
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 89 deletions.
79 changes: 0 additions & 79 deletions .github/workflows/CI.yml

This file was deleted.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ julia> using Pkg: Pkg

julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry")
```
or:
```julia
julia> Pkg.Registry.add(url="[email protected]:ITensor/ITensorRegistry.git")
```
if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages.

Then, the package can be added as usual through the package manager:

```julia
Expand Down
1 change: 0 additions & 1 deletion examples/Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[deps]
Git_jll = "f8c6e375-362e-5223-8a59-34ff63f689eb"
ITensorPkgSkeleton = "3d388ab1-018a-49f4-ae50-18094d5f71ea"
8 changes: 8 additions & 0 deletions examples/README.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ julia> using Pkg: Pkg
julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry")
```
=#
# or:
#=
```julia
julia> Pkg.Registry.add(url="[email protected]:ITensor/ITensorRegistry.git")
```
=#
# if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages.

# Then, the package can be added as usual through the package manager:

#=
Expand Down
30 changes: 29 additions & 1 deletion src/ITensorPkgSkeleton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,31 @@ function to_pkgskeleton(user_replacements)
return Dict(uppercase.(string.(keys(user_replacements))) .=> values(user_replacements))
end

function pkg_registration_message(; pkgname, path)
return """
The package "$pkgname" has been generated at "$path".
To register the package in the [ITensor registry](https://github.com/ITensor/ITensorRegistry), first add
the registry if you haven't already with:
```julia
julia> using Pkg: Pkg
julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry")
```
or:
```julia
julia> Pkg.Registry.add(url="[email protected]:ITensor/ITensorRegistry.git")
```
if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages.
Then, use `LocalRegistry.jl` to register the package. First, you should add `LocalRegistry.jl` in your global environment. Then, activate the package and call:
```julia
using LocalRegistry: LocalRegistry
LocalRegistry.register()
```
"""
end

"""
$(SIGNATURES)
Expand All @@ -165,7 +190,7 @@ Generate a package template for a package, by default in the ITensor organizatio
# Examples
```jldoctest
```julia
julia> using ITensorPkgSkeleton: ITensorPkgSkeleton;
julia> ITensorPkgSkeleton.generate("NewPkg"; path=mktempdir());
Expand Down Expand Up @@ -232,6 +257,9 @@ function generate(
change_branch_name(pkgpath, branch_name)
set_remote_url(path, pkgname, user_replacements.ghuser)
end
if is_new_repo
println(pkg_registration_message(; pkgname, path))
end
return nothing
end

Expand Down
7 changes: 5 additions & 2 deletions templates/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@
This package resides in the `ITensor/ITensorRegistry` local registry.
In order to install, simply add that registry through your package manager.
This step is only required once.

```julia
julia> using Pkg: Pkg

julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry")
```
or:
```julia
julia> Pkg.Registry.add(url="[email protected]:ITensor/ITensorRegistry.git")
```
if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages.

Then, the package can be added as usual through the package manager:


```julia
julia> Pkg.add("{PKGNAME}")
```
Expand Down
8 changes: 8 additions & 0 deletions templates/examples/examples/README.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ julia> using Pkg: Pkg
julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry")
```
=#
# or:
#=
```julia
julia> Pkg.Registry.add(url="[email protected]:ITensor/ITensorRegistry.git")
```
=#
# if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages.

# Then, the package can be added as usual through the package manager:

#=
Expand Down
1 change: 1 addition & 0 deletions templates/test/test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[deps]
{PKGNAME} = "{UUID}"
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
13 changes: 10 additions & 3 deletions templates/test/test/test_examples.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
@eval module $(gensym())
using {PKGNAME}: {PKGNAME}
using Test: @test, @testset
using Suppressor: @suppress
using Test: @testset

@testset "examples" begin
include(joinpath(pkgdir({PKGNAME}), "examples", "README.jl"))
@testset "{PKGNAME}.jl examples" begin
examples_path = joinpath(pkgdir({PKGNAME}), "examples")
filenames = filter(readdir(examples_path; join=true)) do f
endswith(".jl")(f)
end
@testset "Test $filename" for filename in filenames
@suppress include(filename)
end
end
end
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Git_jll = "f8c6e375-362e-5223-8a59-34ff63f689eb"
ITensorPkgSkeleton = "3d388ab1-018a-49f4-ae50-18094d5f71ea"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
13 changes: 10 additions & 3 deletions test/test_examples.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
@eval module $(gensym())
using ITensorPkgSkeleton: ITensorPkgSkeleton
using Test: @test, @testset
using Suppressor: @suppress
using Test: @testset

@testset "examples" begin
include(joinpath(pkgdir(ITensorPkgSkeleton), "examples", "README.jl"))
@testset "ITensorPkgSkeleton.jl examples" begin
examples_path = joinpath(pkgdir(ITensorPkgSkeleton), "examples")
filenames = filter(readdir(examples_path; join=true)) do f
endswith(".jl")(f)
end
@testset "Test $filename" for filename in filenames
@suppress include(filename)
end
end
end

0 comments on commit 9bc0e97

Please sign in to comment.