-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does Gravity have a package manager or module system? #37
Comments
I hope @marcobambini takes inspiration from Go's packages rather than Node's package atrocity. With Go there's no need for a "package manager," which is really nice. |
@badcc mind explaining for a person not familiar with Go? |
Haskell has a very nice package system that's tied to Github as it's central repository. From the sounds of it it's similar Go; any git repository can act as a package. |
Go encourages packages to be hosted on Bitbucket, GitHub, Google Project Hosting and Launchpad. To use a package in your project, you just include the URL in your import statement (and run |
That's quite cool, actually. @marcobambini is this something that could work for Gravity? |
I would love to see something like Go has. It is really simple and elegant sulution. |
I've always wanted it too. I would be glad to help... |
I'd like to have one for Gravity... looking for a simple and elegant solution as suggested by @Dohxis. |
I have far more experience with node than with Go, but if I understood, Go uses This is good because we avoid the "single registry" problems that affects npm. The feature I really like of npm are:
AFAIK, gravity import file modules relative to CWD. This could be problematic to implement 2) |
@parro-it import can be implement with any policy, it is delegate responsibility to locate the module/file to import. I added support for importing relative to CWD as a simple example of a delegate not as a real solution. |
Nice! Could you point to the file where you implement such example policy? |
It is in gravity.c in src/cli/ delegate function load_file. |
In my opinion, @marcobambini with the help of community should choose the path and with everyones help we sooner or later will have a working package manager. I would suggest to have a simple solution just like Go has:
For those who do not know how Simple and innovative! |
Thanks for the explanation @Dohxis, I really like the |
I think |
Record of packages is a must - too many times have I |
Please, this - something as follows would be ❤️ : $ gravity pull github.com/nanalan/meteorite@1.0.x
installed github.com/nanalan/meteorite@1.0.2: # latest version it can find that fits "1.0.x"
- github.com/gravity-lang/mysql@2.1.20 # dependencies automagically resolved
$ cat satellites.json # `gravity pull` adds all dependencies to this file so you can install all dependencies at once
[
"github.com/nanalan/meteorite": [ "1.0.x" ]
]
$ ls .satellites
github.com_nanalan_meteorite@1.0.2
github.com_gravity-lang_mysql@2.1.20
$ cat main.gravity # or whatever
import Meteorite from "github.com/nanalan/meteorite@1.0.x" |
Better import {function, Class} from "package"; and import Package from "package"; Besides names |
Also, dropping the Assume it's github unless otherwise stated? |
I'm not sure if this has been implied yet, but I definitely agree with @NanaLan's suggestion (the example w/ Go's default package installer ( This is more complex, but Python allows you to install packages from repositories based on commits and branches - |
This would be really nice. especially since not all Git hosts have a /releases. Maybe each library repo should have a file ( |
Also I definitely would prefer |
Wouldn't Git hosts have tags still, though? In any case, one potential problem with using commit hashes, branches, and tags/releases would be defining what's what - for example, if a branch is named |
I like the idea of pushing a commit to Tags, though. |
Maybe for branches, you'd start with @, and for commit hashes, you'd do #? |
Just realised something - |
I completely agree with @NanaLan suggestions. The idea of caching all downloaded packages under ~/.gravity/satellites Another doubt that come to me is if it's better to publish a package in bytecode or source code form Bytecode should be better for closed-source packages. I bet it also could be more performant. Also, I'm not sure if gravity could manage to import compiled files... @marcobambini? I think depending on a particular branch or commit could be a useful feature but not |
A Lockfile functionality similar to Yarn's lockfile, which ensure consistency between packages of different versions and their dependencies upon installing, updating and removing dependencies. Could be opt-in with a command like I also agree with @Dohxis about the @parro-it I believe published packages could be of both. The engines/archs could be specified in {
"arch": {
"darwin": ["x86_64"], // this is automatically implied
"archlinux": ["i386"],
"debian": ["i386", "amd64"]
}
} Using git tags to version releases the compiled module. Perhaps with pre-defined format of file names: |
By "binary", I meant the json form that contains the multiplatform bytecode that gravity produce. An architecture field could, anyway, be used for native modules, if gravity will support them (I hoep it will) |
Sorry, I confused bytecode with binary. |
No worries! Anyway, an arch section could be used for native modules |
What would be the command to install all the packages form |
That would be all kinds of wrong. The package manager should be 100% platform-neutral. @heyitsmeuralex |
As a user, I would want to at least have a central gravity package search engine to find useful packages that I'd like to use in my project. Perhaps it could simply be a website that you could register your package on that links to the git repository on the web? Also, I'd recommend implementing environment variables that allow you to tell the gravity package manager (erm, what's it called? |
I've always wanted to create one and Gravity looks like an amazing language - would a creation such as npm/yarn be up for grabs?
The text was updated successfully, but these errors were encountered: