Comments (16)
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.
from rapydscript-ng.
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.
from rapydscript-ng.
Using PyPI as a backend to store uploaded packages? Sounds like a reasonable approach to me. Some things to look out for:
- System-wide vs. user local virtualenv type installations
- Creating some mechanism to allow adding data files to rapydscript packages
- I dont know if the PyPI maintainers would be ok with using their server to host non-python packages
from rapydscript-ng.
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.
from rapydscript-ng.
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.
from rapydscript-ng.
Yeah, I dont think using a pre-existing repo is going to pan out.
from rapydscript-ng.
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.
from rapydscript-ng.
we could tequnically have a use npm too
from rapydscript-ng.
Creating some mechanism to allow adding data files to rapydscript packages
This can be done using a MANIFEST.in
file and enabling the include_package_data
in setup.py
I dont know if the PyPI maintainers would be ok with using their server to host non-python packages
Did this with my project, react pages. Everything seems to be working fine :)
https://github.com/pycampers/react-pages
Personally I prefer pip over npm any day.
from rapydscript-ng.
Interesting, thanks for the heads up.
from rapydscript-ng.
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?
If we could import jquery
, import React
and so on, and have SystemJS resolve and provide dependencies for us, this would be really cool during development. SystemJS could be leveraged to bundle dependencies for production too when building from the command line with RapydScript-NG.
from rapydscript-ng.
Here's another npm-compatible bundler compatible with the browser.
from rapydscript-ng.
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:
- Create packages
- Publish packages
- Use packages in other projects
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:
- Compile all used packages into a single JS file
- Split up packages for dynamic loading in the browser to save on bandwidth/load times
- Use packages both in the browser or in offline node contexts, either via compilation or dynamic include at runtime
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.
from rapydscript-ng.
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
and implemented a Python module loader for the Nuxt Vue.js framework: https://github.com/nuxt-community/python-module
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 src/lib/
, yes? I'll do this for now.
I think a Javascript bundler could be configured without a need for direct support in RapydScript-NG. One would use require
for this purpose in WebPack and Browserify, and it should simply work in RapydScript.
I made a RapydScript-NG transform for Browserify a few days ago:
https://www.npmjs.com/package/rapydscriptify-ng
It is based on a previous one I made for the original RapydScript:
https://www.npmjs.com/package/rapydscriptify
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).
from rapydscript-ng.
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?
from rapydscript-ng.
I've just integrated p5 library with Jappy with including a pyj file in lib/src
and thus made a way to import p5
into Jappy. Nice! This is sufficient for my use case for now! :-)
It is now possible to do import p5
and it should just work.
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 👍
from rapydscript-ng.
Related Issues (20)
- Import problem? HOT 4
- class decorator bug HOT 5
- when converting .children() to list, i get list of empty dictionaries HOT 4
- Remove typing/annotations from input HOT 1
- Ellipsis HOT 7
- bitops on booleans HOT 1
- string.split() HOT 3
- random.randint tolerates 3rd argument HOT 3
- distionary += error HOT 21
- Build question HOT 5
- pop for dict, pypop for list HOT 8
- Idle curiosity about duplication HOT 1
- Missing element from rapydscript.js?
- Mistranspilation HOT 2
- Remove a list from a list HOT 4
- while/else HOT 3
- randrange error
- Function argument handling
- Comical Bundle Size HOT 1
- Large slowdown HOT 3
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 rapydscript-ng.