Alternative pub repository

384 views
Skip to first unread message

Guillaume Girou

unread,
Aug 23, 2012, 2:16:15 PM8/23/12
to mi...@dartlang.org
Hi,

We know that it will be possible to add a dependency to an hosted package on pub.dartlang.org. But is it planned to have an alternative repository, like a private repository?
I think about the syntax, that could be:
repositories:
  default: pub.dartlang.org
  myrepo: pub.alternativehost.org
dependencies:
  transmogrify: '>=0.4.0 <1.0.0'
  otherlibfrommyrepo: '>=1.0.0'
  ...

What do you think ?

Ladislav Thon

unread,
Aug 23, 2012, 2:21:41 PM8/23/12
to mi...@dartlang.org
We know that it will be possible to add a dependency to an hosted package on pub.dartlang.org. But is it planned to have an alternative repository, like a private repository?

I believe that support for alternative repos in Pub is at least planned. I have no idea about that plan, though :-)

LT

Matthew Butler

unread,
Aug 23, 2012, 2:26:22 PM8/23/12
to mi...@dartlang.org
This functionality already exists. Already we can use a git repository for a dependancy. This means anything on github or bitbucket, etc. 

Dependencies each define their own location rather than pulled from a default location. Perhaps that will change once pub.dartlang.org is ready, but at the moment you specify a location for each dependancy separately.
Ie:

dependencies:
  i18n:
    sdk: i18n
  handle_stache:

Matthew Butler

unread,
Aug 23, 2012, 2:32:45 PM8/23/12
to mi...@dartlang.org
Actually based on the docs I see there. If a package is hosted on pub.dartlang.org then you do not need to specify the 'source'. If its hosted at an alternate location, then you need to specify the source (such as sdk, git, etc).

Matt

Guillaume Girou

unread,
Aug 23, 2012, 2:43:17 PM8/23/12
to mi...@dartlang.org
We can specify the range of versions of the hosted package and I find this functionnality very useful. You can't do that directly with git dependencies.
I think it's important to be able to manage our own private packages on our own private repo. And It could be used as a mirror to not query pub.dartlang.org each time.

Guillaume

Matthew Butler

unread,
Aug 23, 2012, 2:49:00 PM8/23/12
to mi...@dartlang.org
And I think this will come in time. I believe other methods from git, such as svn and more are planned. But all in good time. The last line of the pubspec document says:

"At some point, we may add more sources where you can get packages and more metadata in the pubspec (authors, website, etc.)."

http://www.dartlang.org/docs/pub-package-manager/pubspec.html

(emphasis mine).

However, on a personal note, I'd rather see most packages on the central pub.dartlang.org site than seeing multiple private/public repositories popping up and having to first as a developer manually search each one to find a package I want to use, and the version I may want. 

Matt

Nicolas François

unread,
Aug 23, 2012, 3:36:43 PM8/23/12
to mi...@dartlang.org
When we use a git repository like github, pub clone it from master.
Does it possible to specify a tag version or better a tag range ? Maybe it's on the roadmap ?
Indeed, the master could be a snaphost version, so a unstable library.
This solution could a way to use a specific version on alternative repository.

Nicolas


2012/8/23 Matthew Butler <butler....@gmail.com>

--
Consider asking HOWTO questions at Stack Overflow: http://stackoverflow.com/tags/dart
 
 

Bob Nystrom

unread,
Aug 23, 2012, 3:43:41 PM8/23/12
to mi...@dartlang.org
TL;DR: Yes you can host your own package servers and pull packages from them.

Let me clear up some (as yet undocumented) terminology:

A source in Pub lingo is a kind of thing that Pub knows how to pull packages from. For each source, there is unique code in Pub to know how to talk to it. Right now, Pub has three sources: Git, the SDK, and repo.

From pub's perspective, github and bitbucket aren't different sources, they're just different URLs that the one Git source can pull from.

The "repo" source is for pulling packages from pub.dartlang.org. But, more generally, it's for pulling packages from any URL that happens to speak the same HTTP API that pub.dartlang.org does.

When you add a dependency for a package, you specify the source, and then any data the source needs (called the "description"), like so:

dependencies:
  some_package:
    sdk: some_package

For SDK sourced packages, the description is just the name of the package.

If you don't specify a source, it assumes the default source, which is "repo". For repo packages, the description can include an alternate URL where the repo is located. If that's omitted, it defaults to pub.dartlang.org. But you can specify it manually, like so:

dependencies:
  some_package:
    repo:
      name: some_package

This is implemented now. Private package repositories were something we definitely had in mind. Big companies often want their own repositories that they serve packages from and we wanted to enable that.

There is still the problem that you have to manually specify the URL to that server in each dependency. At some point, we may add something more global like an environment variable that pub will look for to see the package repository URL globally.

- bob

--

Guillaume Girou

unread,
Aug 23, 2012, 3:50:48 PM8/23/12
to mi...@dartlang.org
Thank you! It's definitely the answer I expected :)

Bob Nystrom

unread,
Aug 23, 2012, 3:57:17 PM8/23/12
to mi...@dartlang.org
On Thu, Aug 23, 2012 at 12:36 PM, Nicolas François <nicola...@gmail.com> wrote:
When we use a git repository like github, pub clone it from master.
Does it possible to specify a tag version or better a tag range ? Maybe it's on the roadmap ?

The git source does let you specify a ref, which lets you refer to a specific commit or branch, like:

dependencies:
  foo:
    git:
      url: <git url>
      ref: <git ref>

I think that supports tags too? I'm not a Git expert.

- bob

Message has been deleted

Bob Nystrom

unread,
Aug 24, 2012, 5:09:22 PM8/24/12
to mi...@dartlang.org


On Fri, Aug 24, 2012 at 2:44 AM, mezoni <andrew...@gmail.com> wrote:
I think the current syntax of  pubspec.yaml  is not very good.
What is more clear?
dependencies:
  some_package:
    sdk: some_package
Or
dependencies:
  some_package:
  // Or may be dart.some_package or john_locke.some_package
    // source: sdk:some_package
    // sourcegit://github.com/ some_packages/some_package.git    
    // source: repo:some_package // from default repository
    // sourcehttp://pub.dartlang.org // almost the same as above
    // sourcehttp://pub.alternative_repo.org //  alternative_repo     
    // source: another supported url аor later support

Alternative repositories may be added to local sources list.
Pub manager may support search required packages in defined in sources list urls. 
Source is optional. 

I didn't really follow this. Can you explain what you'd like here?

- bob
 

пятница, 24 августа 2012 г., 1:43:41 UTC+6 пользователь Bob Nystrom написал:
Message has been deleted

Aza Tek

unread,
Aug 25, 2012, 5:10:19 AM8/25/12
to mi...@dartlang.org
I like what you're proposing here Mezoni, it's a lot more clearer. Also, maybe the 'sdk' keyword should be replaced with 'local'.

Bob Nystrom

unread,
Aug 27, 2012, 4:27:56 PM8/27/12
to mi...@dartlang.org
On Sat, Aug 25, 2012 at 2:10 AM, Aza Tek <aza...@gmail.com> wrote:
I like what you're proposing here Mezoni, it's a lot more clearer. Also, maybe the 'sdk' keyword should be replaced with 'local'.

"Local" would be confusing here. A "Git" sourced package may also be on your local machine, and we will have a file path source at some point too that also pulls from local directories.

The "SDK" source is specific to pulling packages from the installed Dart SDK and only the Dart SDK. It relies on the DARK_SDK environment variable, and assumes the SDK's directory structure. Calling it just "local" might give people the wrong impression that it can be used to point to any local package.

Cheers,

- bob
 

On Fri, Aug 24, 2012 at 11:44 AM, mezoni <andrew...@gmail.com> wrote:
I think the current syntax of  pubspec.yaml  is not very good.
What is more clear?
dependencies:
  some_package:
    sdk: some_package
Or
dependencies:
  some_package:
  // Or may be dart.some_package or john_locke.some_package
    // source: sdk:some_package
    // sourcegit://github.com/ some_packages/some_package.git    
    // source: repo:some_package // from default repository
    // sourcehttp://pub.dartlang.org // almost the same as above
    // sourcehttp://pub.alternative_repo.org //  alternative_repo     
    // source: another supported url аor later support

Alternative repositories may be added to local sources list.
Pub manager may support search required packages in defined in sources list urls. 
Source is optional. 

Reply all
Reply to author
Forward
0 new messages