Package on gitlab not github

Hello

I was ask to make some julia code in my company. The main page 5. Creating Packages · Pkg.jl tell me to use User Guide · PkgTemplates.jl .

All need githup. We are not allowed to use githup in my company. My company has a local gitlab server. I look at many pages and youtube and it always talk about github. Am I correct when I see that my company can not use Julia since it need github?

Thank you very much

Barvid

1 Like

Hi

Gitlab is perfectly fine to use for Julia packages, and so is any other git host. Github is used as the most common example because it is the most popular one and widely used within the Julia community (for better or worse), but it’s not necessary to use it.

PkgTemplates.jl has a Github Actions plugin, but right next to it you can see that it also has a GitLab CI (for handling continuous integration tasks when using Gitlab).
In the main Template call, you can see for the user keyword, it says “GitHub (or other code hosting service) username”.
And for host it says:

  • host::AbstractString="github.com": URL to the code hosting service where packages will reside.

i.e. "github.com" is the default if no host is specified, but you can instead specify your Gitlab instance’s URL here to use that instead.

4 Likes

A quick answer: no, Julia packages can be hosted on whatever git repository, and there are several packages (altough latgely a minority) that are hosted on gitlab without problems.

1 Like

Thank you very much for so fast reply.

I think I understand. Package page only talk githup, but if I use it I can also use gitlab on my company server.

I will try it now.

thank you very much.

Barvid.

This has mostly been answered already but I can add that I have been working with company internal packages hosted on a BitBucket instance with Jenkins for CI, as well as transitioned those to a GitLab setup. There is nothing in Julia’s package manager that requires GitHub, although there are some GitHub-specific optimizations for the benefit of the large amount of public packages hosted there. Third-party tooling and documentation may sometimes be preferential to GitHub but there’s at least one packaging related functionality that’s only available for GitLab.

1 Like

Thank you @GunnarFarneback

I am very glad you confirm to me that it works.

Barvid

Hello

I try this and do what it say. It crash.

  | | |_| | | | (_| |  |  Version 1.8.0 (2022-08-17)

julia> using PkgTemplates

julia> t = Template()
ERROR: Git: Git hosting service username is required, set one with keyword `user="<username>"`
Stacktrace:
 [1] (::PkgTemplates.var"#8#14")(p::Git)

If you read the options for the template here you see that it mentions that you have to either provide a user for the code hosting service and author name or have those defined in your gitconfig.

User Options

  • user::AbstractString="username": GitHub (or other code hosting service) username. The default value comes from the global Git config (github.user). If no value is obtained, many plugins that use this value will not work.
  • authors::Union{AbstractString, Vector{<:AbstractString}}="name <email> and contributors": Package authors. Like user, it takes its default value from the global Git config (user.name and user.email).

So something like

t = Template(; user="Barvid", authors="Barvid Something barvid@something.com")
t()

could maybe work?

You probably want to set the host keyword also since github is the default.

1 Like

Thank you @albheim

It now work. I learn that information page is not correct. It say

Using PkgTemplates is straightforward. Just create a Template, and call it on a package name to generate that package:

using PkgTemplates
t = Template()
t("MyPkg")

This crash.

I learn Template() need username option. Maybe correct page with information.

Barvid

So it does work (I assume) if you have those values set up in you git config, though maybe it should be clearer that this is a required criteria. You can always add this as an issue or PR to the package if you feel strongly about it.

1 Like

Thank you @albheim

I try on new develop account and have not git config here.

I am new in Julia and it is not my place to tell esteemed julia developer how to do job.

I look very much forward to program Julia.

I thank you all for help new user.

Barvid

4 Likes