I like your decision to go with the something simple and managed like NPM. However I am very doubtful about the entire pub server thing. It seams overly complex for me, one of the good things Maven brought to Java was a standardized layout (convention over configuration).
The pub server stuff is just one mechanism (and very possibly not a great one) for enabling that. If it ends up not working, we'll ditch it. What I think is important is to starting building something that works, so that we can try to build packages and see how they feel.- bob
The current plan doesn't have Pub parsing Dart files at all, so #resource probably won't be supported. Any static resources in your package directory would be preserved, though, I think.
How would you identify "everything in the directory" if the library
was accessed by a url? (or do libraries have to be local first?)
I just read through the document - thanks for compiling it! I really
love the name "pub".
There are some questions in my mind...
First, I think there needs to be a clear separation between the use
cases. I have seen the following:
1) deploying to and serving from a remote machine
2) structure of your project on the local machine
3) using dependencies as a browser app
4) using dependencies as a server app
At the moment I feel we mix all that use cases and the result is a
little bit confusing (maybe its just me :-))
I saw already a structure suggestion for a local project. It's fine so
far, but this structure is not really what I want to see on my
dependencies server.
If I write a server app which takes the dependency from such a
structure it might results in multiple http requests. Including 20x
#source might result in 20 http requests. Therefore I would prefer a
clean and easy structure on the remote server and a single file for
each dependency, like for example Javas jar files.
Having a single file per dependency also helps pub to check signatures
and md5 files. If I make pub install (or whatever the equivalent will
be) pub should check md5 files per default. It would be great if the
md5 file could be on another, third server.
Another question which come to my mind: can browser apps depend on
packages from a remote server? Not sure if I like that. If they can,
does a user of my app need to download all dependencies? If yes, then
how do these deps get cached? Browser cache only?
Server apps might depend to remote servers more easily, as they have
the chance to store deps on a local place. It would be good to be able
to define that place. On Unix based machines I would expect .pub in my
home directory or something like that.
As for the "pub serve" command - why do we need that? imho every
webserver should do the trick. If I want to have a pub-repository on
my mass hosters webspace it should not be a problem for me: upload,
go.
Therefore I would love to see commands like:
pub list <channel> // list the available dependencies for the channel
pub install <oackage definition> // install a dependency to my local
repos, checks md5 files, if available
pub delete <oackage definition> // deletes from my local repos
pub package // packages the project i am currently in: creates a
deployable version including all dependencies for my webapp
pub deploy <channel> // creates a deployable for my remote repository
and deploys it (until i add --dry-run )
pulll update makes sense to me also. Not sure if "pub install" is
obsolete with that
I think, once the remote repository layout is there, things will
lighten up for me. Also the pub-file definition will bring more light
Speaking of the directory layout:
src/
myapp.dart
myapp.packages/
interwebs.dart
ui/
widgets.dart
base/
utils.dart
Why do we need /src/myapp.dart/ and /src/myapp.packages?
Can't it be:
/src/dart
/src/packages
?
I think it is pretty clear that we develop a specific app... or is it
usus to work on different apps in a single project?
Sorry if I missed something which should be clear already. I was off
for a while, and this is what the pub-document raised for
questions/confusion in me.
Cheers
Christian
>The current plan doesn't have Pub parsing Dart files at all, so #resourceHow will you deal with #source if pub isn't going to be parsing Dart
> probably won't be supported.
files? Especially for #import's that are url based?
I think that some reference to non-dart resources will probably be
> If we find a need for it, we may also
> support listing resources in your package's pubspec,
needed. For example, if I make available a client side library which
relies on some images and css files, then there needs to be some
mechanism to tie these into the library.
The equivalent to Java would be to think about how many non .class
files end up inside a jar (properties, translations, config, Licence
etc...)
Hi all,
I just read through the document - thanks for compiling it! I really
love the name "pub".
There are some questions in my mind...
First, I think there needs to be a clear separation between the use
cases.
I have seen the following:
1) deploying to and serving from a remote machine
2) structure of your project on the local machine
3) using dependencies as a browser app
4) using dependencies as a server app
At the moment I feel we mix all that use cases and the result is a
little bit confusing (maybe its just me :-))
I saw already a structure suggestion for a local project. It's fine so
far, but this structure is not really what I want to see on my
dependencies server.
If I write a server app which takes the dependency from such a
structure it might results in multiple http requests. Including 20x
#source might result in 20 http requests. Therefore I would prefer a
clean and easy structure on the remote server and a single file for
each dependency, like for example Javas jar files.
Having a single file per dependency also helps pub to check signatures
and md5 files. If I make pub install (or whatever the equivalent will
be) pub should check md5 files per default. It would be great if the
md5 file could be on another, third server.
Another question which come to my mind: can browser apps depend on
packages from a remote server?
Not sure if I like that. If they can, does a user of my app need to download all dependencies?
If yes, then how do these deps get cached? Browser cache only?
Server apps might depend to remote servers more easily, as they have
the chance to store deps on a local place. It would be good to be able
to define that place. On Unix based machines I would expect .pub in my
home directory or something like that.
As for the "pub serve" command - why do we need that? imho every
webserver should do the trick.
pub list <channel> // list the available dependencies for the channel
pub install <oackage definition> // install a dependency to my local
repos, checks md5 files, if available
pub delete <oackage definition> // deletes from my local repos
pub package // packages the project i am currently in: creates a
deployable version including all dependencies for my webapp
pub deploy <channel> // creates a deployable for my remote repository
and deploys it (until i add --dry-run )
Speaking of the directory layout:
src/
myapp.dart
myapp.packages/
interwebs.dart
ui/
widgets.dart
base/
utils.dart
Why do we need /src/myapp.dart/
and /src/myapp.packages?
I think it is pretty clear that we develop a specific app... or is it
usus to work on different apps in a single project?
Sorry if I missed something which should be clear already.
On Sat, Apr 7, 2012 at 10:09 AM, Christian Grobmeier <grob...@gmail.com> wrote:
Hi all,
I just read through the document - thanks for compiling it! I really
love the name "pub".Thanks. I've been sitting on that name for almost a year now. :)
In my experience
most of issues when working with Maven arise not from Maven itself,
but from some outdated issues with Java.
"Maven way" doesn't need update command (or it can be optional).
>> #library('link!/actual/real/path/to/utils.dart')
"Maven way": no need for this. The dependencies are resolved against
and used directly from the local cache (or sibling folders).
It's kind of disappointing to see almost no successful experience re-
used in Pub from Maven.
I know that the discussion is kind of split b/w the document and this thread, so I apologize if I repeat anything...
(I believe Jason van Zyl (https://plus.google.com/
110566245181212600381), the principal creator of Maven, is usually
fairly happy to share his good/bad experience while creating Maven)
First, few numbers (http://search.maven.org/#stats):
- Maven Central Repository currently hosts over 300K artifacts. This
is almost ten times the number of Rubygems on rubygems.org. It's the
biggest repository, but not the only one.
- Maven Central Repository currently boasts over 80M downloads a weak!
I.e. every 2 month more artifacts are downloaded from Maven than from
rubygems.org since its inception.
Certainly, this success couldn't have been achieved if they didn't get
some things right. Not that Dart couldn't improve on many things too.
On top of this, Maven imposes a simple standard conventional
structure,
provides very few core commands,
is well integrated with modern IDEs,
If I may comment on some points made in the document.
>> #import('../../../some/other/lib.dart');
>> #import('http:/some.com/other/lib.dart');
The "Maven way" the import could look like:
#import('other/lib.dart') // import in the local package/project
#import('package-name:other/lib.dart') // an import resolved through
other package named "package-name"
>> even imports between the files in packages work and are resolved relative to the top packages directory
>> So each package has a copy of every package it uses?
>> The idea here is that you flatten the entire dependency graph and put it in a directory in your entrypoint package
"Maven way" would either have an option to have external packages next
to "my" package (not inside) or in repository. The resolution is
simple - either the package is right next to the folder of "my"
package/project, or look in ~/.dartpub/package-name. That would really
be "flat".
>> pub update
"Maven way" doesn't need update command (or it can be optional). The
artifacts are resolved with version constraints from dependencies
file, downloaded from central repository and cached locally
automatically.
The transitive dependencies are handled exactly the
same way. Nothing is copied into the project. Local cache is somewhere
in ~/.dartpub/
>> How does it know what packages you're using?
>> it may be able to infer them by the #imports in your code
No need to infer, #import can state package's name (namespace)
explicitly (#import('package-name:lib.dar')).
>> How does pub make the packages directory?
>> #library('link!/actual/real/path/to/utils.dart')
>> No pointless duplication.
"Maven way": no need for this. The dependencies are resolved against
and used directly from the local cache (or sibling folders). This way
there truly is no pointless duplication and no extra entities to
support.
>> How do link libraries work in Dartium?
The production mode should be very similar to development mode with
few allowances. The added benefit - less entities for Dart team to
create and less things for Dart users to learn.
A simple Dart-based
HTTP server could completely handle all issues here:
a. There's already HTTP server available in Dart, so it can be
extended.
b. It can be integrated very naturally with Dart Editor (and other
IDEs)
c. It can implement the same package resolution as necessary via
global repository/local cache and expose packages this way via HTTP
interface with no security implications.
d. <script> can use the same form as import "package-name:abc/
lib.dar". Again, less to learn.
e. No "paths" outside of the project's directory except for those
strictly enforced by convention in adjacent folders and local cache.
f. If there's web server already, a simple plugin should do.
g. Finally, Dartium could support this package resolution natively.
Again, it's strict and well-defined, so some allowances could be made.
Nearly the same model can be used in production too.
standard package layout,
provide simpler discovery
> I agree that some parts are complicated and Pub probably won't have
> anything to do with those parts. But the core is strong and very
> simple:
> - Layout convention
Maven's layout convention is pretty terrible: traversing
mypackage/src/main/java/com/mypackage gets really old, most of this is
Maven's fault.
> - Repository
This is mostly solid: packages served as versioned archives over HTTP
is good, with package metadata alongside. The proliferation of brittle
maven-metadata.xml files, and .md5, .sha1, .asc, .asc.md5, .asc.sha1
files is a mess. Custom artifacts aren't needed for package
management.
> - Package resolution
It's hard for me to tell whether maven's "I'm going to download the
internet now" tendencies were due to design or implementation, but the
user experience was pretty terrible.
If they've stopped encouraging people to pin dependencies to specific
versions, then the model should work...
> - Namespace
Package names are too complex in maven (org.apache.commons:commons-math:2.2).
Lots of simpler approaches work here: gems ('commonmath'), github
('apache/math'), cpan ('Math::Commons'), even java
('org.apache.commons.math').
> A lot of complexities can be also attributed to Java.
To me it feels the other way around - java is a fairly simple
language, albeit verbose.
Much of the complexity around Java is cultural, and Maven is a shining
example of Java culture gone wrong (e.g. a great example of how not to
use XML!)
Just my 2c, I'm sure lots of people feel more warmly towards Maven and
I'd be interested in more details. But I spent over a week learning
enough about Maven to get a (somewhat complex) set of packages
deployed, and for me that qualifies it as a failure.
(Or myself, but I prefer not to think about that...)
Cheers,
Sam
I guess my point was that once you strip off the parts where 'dart doesn't have to do it that way' and 'that's Java's fault', there's nothing maven-specific left, just ideas common to all package managers.
On Apr 11, 2012 12:58 AM, "dvoytenko" <dvoy...@gmail.com> wrote:
>
> Well, thanks! This is super subjective. Maven is an optional system
> and no one is required to use it - just download a library and put it
> into your project. Yet, dozens of millions of download per week prove
> different. All while, Oracle (and Sun before it) have rather cold
> relationship with Maven. I specifically outlined _only_ package/
> repository management features of Maven not to mix in "project
> automation", not sure even how it got implied.
>
> > works okay, but it's orders of magnitude more complex than other
> > languages' package managers for no benefit.
>
> This is also subjective. Maven's package management core is tiny and
> extremely simple - combined size is probably under 2M of compiled
> bytecode or less. The whole thing is managed by about 10 interfaces.
2M byte code and 10 interfaces is what I'd call large and complex!
> > Maven's layout convention is pretty terrible: traversing
> > mypackage/src/main/java/com/mypackage gets really old, most of this is
> > Maven's fault.
>
> No, that's not Maven's fault. Other packaging systems for Java often
> have a more complicated layout than this.
The src/main/java is from Maven. At most, you need src there.
> And what does this has to do with Dart? Why
> would Dart want to borrow on a Java conventions?
If you mean maven conventions, that was my point :-)
> Plus, who ever
> traverses over Java packages?
Everyone using command-line tools to manipulate the filesystem.
> Which custom artifacts? Sources?
Maven allows you to have arbitrary named artifacts per POM, this is part of the repository format.
> > To me it feels the other way around - java is a fairly simple
> > language, albeit verbose.
> > Much of the complexity around Java is cultural, and Maven is a shining
> > example of Java culture gone wrong (e.g. a great example of how not to
> > use XML!)
>
> Not substantiated. Why would anyone use Maven if it didn't make their
> lives easier? Use Ant?
I'm not arguing that maven isn't the best solution within open-source Java-land. I think it's poor compared to package managers *in general* and am not sure what features it is a good example of (again, compared to offerings across languages).
Sorry for my strong reaction... My hope is that a package manager should feel like part of the language, require minimal effort to integrate with, and largely be invisible most of the time. These are aesthetic concerns and so often come with strong feelings and little data...
Bob,
I see pub in last dart-sdk builds. Does it mean we may try to use pub
already?
If so, would you please explain how to use it on some simple example?
I'm using unittest and currently as unittest library is included in
dart-sdk my tests contains import lines such as:
#import('../../../dart/dart-sdk/lib/unittest/unittest.dart');