-
Notifications
You must be signed in to change notification settings - Fork 44
How/where to publish RapydScript packages? #40
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
Comments
This is not something I have though about much. Personally, I just use like to use git to distribute my packages. Then you can make the RS compiler aware of them by using the --import-path command line option. This works like PYTHONPATH for python packages. The only thing using systems like pip/npm buys you is the ability to auto-resolve dependencies, but IMO this is more of a mis-feature as it leads to enormous and unneeded dependency chains. You can see this particularly in the npm ecosystem, but python is getting there as well. That said I am not adamantly opposed to having a package repo for RS, it is just not much a priority for me. I will leave this issue open in case other people would like to comment. |
What if I made a command called rapyd_install that basically does what pip does except it also creates a rapyd_modules folder with symlinks to the RapydScript-specific module directories in site-packages? Maybe you could also do something similar with npm but I'm not as familiar with that package management system. |
Using PyPI as a backend to store uploaded packages? Sounds like a reasonable approach to me. Some things to look out for:
|
Actually, thinking about (3) I think we could just use github itself as a package repo. We just need to establish some conventions for repository layout of rapydscript packages, then the package installer could just fetch them using git for github (or any other git host). This will work rather like pathogen works for vim packages. As for creating a central package index, that can be left for the future, at which time the package manage tool can grow a "publish" sub-command. |
I looked a little into using npm since there are packages in there not written in JavaScript. But unless you are willing to compile your code to ES5 when publishing, it doesn't make sense to publish RapydScript packages to npm. |
Yeah, I dont think using a pre-existing repo is going to pan out. |
We could have a central repository with a list to the packages hardcoded into the source. There's also the option of a central repository which contains all of the packages. |
we could tequnically have a use npm too |
This can be done using a
Did this with my project, react pages. Everything seems to be working fine :) Personally I prefer pip over npm any day. |
Interesting, thanks for the heads up. |
Thinking about the "batteries included" aspect of Rapydscript-NG - that they are the Javascript batteries not the Python ones, maybe check out a browser side bundler such as this? |
Here's another npm-compatible bundler compatible with the browser. |
It's hard for me to get a good sense of what's needed, as the current rs-ng infrastructure fully meets my needs. The most basic elements of a packaging system are:
This is complicated in the case of rs-ng by the fact that packages can be in two languages (rs-ng and javascript), with many different runtimes (browser, nodejs, other JS runtimes such as duktape). Further, one would want to be able to both:
All in all, this seems like a pretty large problem, I dont think I have the bandwidth/motivation available to tackle it, as the RS compiler meets all my personal needs as is. |
Thanks Kovid. Your reasoning is sound. I was describing what "bundlers" do in JavaScript. Naturally I don't think RapydScript-NG should try to be a bundler. I'm still an apprentice with regard to JavaScript - I've used WebPack and Browserify. In my learning process I contributed to a Python loader for Webpack: https://github.com/martim00/python-webpack-loader The reason I care about this is I'm polishing Jappy Creator (repo) which basically is a learning IDE with RapydScript-NG as engine and facing a few design questions with regard to how to offer popular modules to end users and to publish user's creations. Jappy is meant to work on the client side only relying on a server for access to reading/writing files. The current approach would be to add .pyj files to I think a Javascript bundler could be configured without a need for direct support in RapydScript-NG. One would use I made a RapydScript-NG transform for Browserify a few days ago: It is based on a previous one I made for the original RapydScript: With this, one can use Browserify to bundle Rapydscript files (this covers the points 1-2-3 you listed previously). I'll think hard how to provide a consistent experience when compiling RapydScript-NG code in the browser. I think RequireJS or SystemJS bundlers could provide solutions for Jappy Creator's requirements (internally it already uses RequireJS). |
If you need any additional API in the embedded compiler to facilitate your use case, let me know and I'll take a look. It's not clear to me what exactly you need, do you want the ability to add rapydscript modules to the embedded compiler when it is generated? Dynamically at runtime? Some combination of the two? |
I've just integrated p5 library with Jappy with including a pyj file in It is now possible to do With regard to making new .pyj available for importing at runtime for files compiled in the browser, I've overriden the file_data object and this seems to work. This was asked here too by another project. It's a bit clunky, not sure if it's meant to be used or internal. Perhaps a better interface or docs on how to do it cleanly would be super. Thank you in any case, we love RapydScript-NG 👍 |
If I make a RapydScript library, what is the best way to publish it? I know of npm, but it seems like it's mostly for JavaScript packages. Maybe PyPI? But if I use pip to install a package, is there a good way to make it visible to the RapydScript compiler?
The text was updated successfully, but these errors were encountered: