Comments (9)
Yeah, that would be really nice!
We can basically just pack up pixie-vm + dust + the library, but we also need to specify what program to run after unpacking. (Or we read it from a :main
key in project.edn
.)
On Linux, we could unpack to ~/.cache/<some-unique-id>
and use that if present. However, we'd really have to use some unique key, maybe an MD5 hash of the whole package.
from dust.
Kinda, I was thinking not to bundle dust with it, try to make it slim and use the project.edn to generate a thin startup script with things like the entry point derived from project.edn and proper load path, and have all the dependencies prefetched on the dev machine and bundled in the archive. Then we don't need to bundle dust, worry about curl presence or whatnot, it makes deploys to other OSes even ok'ish in the long run.
For the unpacking yes, something of that sort this could be as simple as ~/.cache/<package-name>-<version>
even (it's easier to get to it if you want to clean things up), but an md5 would be fine.
from dust.
Ah yes, baking-in the load path makes sense. To make things start up more quickly we can (and should) byte-compile everything as well.
from dust.
Yes that what I mean with "trigger compilation (pxic)", sorry I am not super clear, just throwing ideas :]
The goal is clojure like uberjar + the runtime + startup script all in one
from dust.
I have written a tarfile reader in pixie so it would be possible to make a tar.gz of a byte compiled library with all its dependencies and read them as though they were extracted.
from dust.
@thomasmulvaney the problem is that pixie would have to be installed first in that case.
I think it could be better to have all of it (runtime, deps, compiled (or not) pxi files) in a single self extracting archive. This way we just have a startup penality the first time it's run and no need for prerequisites on a fresh machine. makeself is a good example to follow and get inspiration from imho.
from dust.
Unfortunately my bash-foo is very weak, I could probably get something working but this will be poorly written. Feel free to take over this task.
from dust.
I've got an example up and running. It's not automated, but it works™.
By dark magic, you'll have to assemble the pixie stdlib, your dependencies and your own code into a directory. It will look something like the following:
$ tree packaged-base
packaged-base
├── deps
│ └── heyLu
│ └── hiccup.pxi
│ ├── LICENSE.html
│ ├── project.edn
│ ├── README.md
│ ├── src
│ │ └── hiccup
│ │ ├── compiler.pxi
│ │ ├── compiler.pxic
│ │ ├── core.pxi
│ │ ├── core.pxic
│ │ ├── def.pxic
│ │ ├── element.pxic
│ │ ├── form.pxic
│ │ ├── middleware.pxi
│ │ ├── middleware.pxic
│ │ ├── page.pxic
│ │ ├── util.pxi
│ │ └── util.pxic
│ └── test
│ └── hiccup
│ └── test
│ ├── def.clj
│ ├── element.clj
│ ├── form.clj
│ ├── middleware.clj
│ ├── page.clj
│ ├── test-core.pxi
│ ├── test-core.pxic
│ └── util.clj
├── pixie
│ ├── async.pxi
│ ├── async.pxic
│ ├── buffers.pxi
│ ├── buffers.pxic
│ ├── channels.pxi
│ ├── channels.pxic
│ ├── csp.pxi
│ ├── csp.pxic
│ ├── ffi-infer.pxi
│ ├── ffi-infer.pxic
│ ├── fs.pxi
│ ├── fs.pxic
│ ├── io
│ │ ├── common.pxi
│ │ ├── common.pxic
│ │ ├── tcp.pxi
│ │ ├── tcp.pxic
│ │ ├── tty.pxi
│ │ ├── tty.pxic
│ │ ├── uv-common.pxi
│ │ └── uv-common.pxic
│ ├── io-blocking.pxi
│ ├── io-blocking.pxic
│ ├── io.pxi
│ ├── io.pxic
│ ├── math.pxi
│ ├── math.pxic
│ ├── parser
│ │ ├── json.pxi
│ │ └── json.pxic
│ ├── parser.pxi
│ ├── parser.pxic
│ ├── PixieChecker.hpp
│ ├── repl.pxi
│ ├── repl.pxic
│ ├── set.pxi
│ ├── set.pxic
│ ├── stacklets.pxi
│ ├── stacklets.pxic
│ ├── stdlib.pxi
│ ├── stdlib.pxic
│ ├── streams
│ │ ├── utf8.pxi
│ │ ├── utf8.pxic
│ │ ├── zlib
│ │ │ ├── ffi.pxi
│ │ │ └── ffi.pxic
│ │ ├── zlib.pxi
│ │ └── zlib.pxic
│ ├── streams.pxi
│ ├── streams.pxic
│ ├── string.pxi
│ ├── string.pxic
│ ├── system.pxi
│ ├── system.pxic
│ ├── test.pxi
│ ├── test.pxic
│ ├── time.pxi
│ ├── time.pxic
│ ├── uv.pxi
│ └── uv.pxic
├── pixie-vm
├── run.pxi
├── run.sh
└── src
└── packaged
├── core.pxi
└── core.pxic
15 directories, 85 files
In addition, I added a top-level run.pxi
, which simply calls a function called main
in a namespace:
$ cat packaged-base/run.pxi
(require packaged.core)
(apply packaged.core/main program-arguments)
Now you can use makeself
to generate a self-extracting archive, that runs that script:
$ makeself packaged-base packaged.run "An example packaged pixie app" ./pixie-vm `cat .load-path` run.pxi
...
$ ./packaged.run 'hello' 'world?!'
...
<h1>HELLO WORLD?!</h1>
And then you have to automate this... Maybe I'll try that tomorrow, but if anyone wants to take over, feel free to do so!
from dust.
Cool stuff.
We don't need to include the .pxi files in the package right? just the pxic should be enough (given we compiled everything first).
There are other "improvements" we'll have to think about later, like how to handle "resources" (prolly via project.edn).
from dust.
Related Issues (18)
- Logo suggestions HOT 5
- Different dependency providers HOT 5
- rlwrap installed; dust does not start HOT 6
- Fix `dust test` HOT 1
- Set load path for dependency-less projects automatically
- Dust command oddities in OSX 10.10.1 HOT 6
- Exitting problems HOT 10
- dust test with examples broken? HOT 3
- remove the filename magic for test files
- Recur not throwing exception HOT 3
- `dust doc` improvements HOT 3
- Error on invoking (use 'hiccup.core) HOT 3
- [PROPOSAL] Don't replicate Leinigen's project structure HOT 5
- ArtifactIDs, GroupIDs etc HOT 6
- Dust should state the license somewhere in the README HOT 3
- per namespace dependency specification
- pixie new task
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dust.