File uploads with Meteor

MeteorJS is an amazing framework for developing web apps, and it is really helpful in increasing development speed. One of the few things that is not provided by Meteor OOTB is file uploads. Most apps will need file uploads at some point or the other, and one of the main reasons you might end up using a framework and not writing all the code for authentication, routing, and the hundred other things you’d otherwise have to do manually, is so you do not have to waste time doing unproductive tasks that will suck away precious development time.


Previously, Meteor had a leading file management solution called CollectionFS. The developers behind this suite of packages are also responsible for a huge list of other Meteor packages that increase the utility of the entire Meteor ecosystem by leaps and bounds, and I am really thankful for their work.

Sadly, CollectionFS has been deprecated, and it is no longer recommended to use it. Which leads to the inevitable question - What do I use now?

The available options

These are the currently maintained solutions I’ve come across:

Coming from a Python background, I find this situation to be very fragmented.

There should be one– and preferably only one –obvious way to do it.

  • The Zen of Python, by Tim Peters

So what should you choose?

Client-side solutions

Client side solutions like Slingshot and S3 are not fit for my particular use case of having a Meteor backend with native mobile apps, since that means I have to re-implement file uploads on the native apps again, so they are not going to be included in the list below.

Meteor-Files

Well supported, frequent commits, actively developed, good design. Supports uploads via HTTP, DDP, and WebRTC, with support for a large number of storage backends(custom backends are also supported). I think Meteor-Files is THE replacement for CollectionFS. My gripe with it? Uploads without the JS client are not straightforward, but I’ve seen movement towards fixing this.

UploadFS

UploadFS also sees commits frequently, and has support for GridFS, S3, WABS, and supports custom backends too. I really like the way generating thumbnails or creating copies is handled by UploadFS(transformRead/transformWrite). There’s built-in support for uploading files from URLs. ufs is also used by Rocket.Chat, which makes it unlikely to disappear. However, the package does not publicize any way of uploading files directly without the JS client code, which is a dealbreaker for me.

File-Collection

Hasn’t seen commits in two months, which makes me fear that it might go the same direction CollectionFS went, but it is pretty popular on Atmosphere. It seems well developed, and it will easily support uploads via HTTP, so no trouble with native apps. There is an example for uploading via curl in the README. There is one catch though. It is tightly coupled with GridFS, and S3 integration would have to be manual. They provide an example for generating thumbnails, and apart from the lack of S3 support, it seems rather well executed.

Meteor-Dropzone

This is basically just a client side wrapper over Dropzone.js. It lets you POST the uploaded files to any URL. The example documentation recommends tomi:upload-server for the upload backend, which only supports direct filesystem storage. Technically, you can implement the backend however you wish, but unless you use a package which meets your needs, it will be a good amount of work to implement the backend.

Meteor-Uploads

This package was marked deprecated by the author 12 days ago as of this writing. It does support uploads via HTTP POST, but only stores files on the filesystem, and it does not look like S3/GridFS would be implemented now since the package is unmaintained. Regardless, this was not the solution for me.

Conclusion

We have considered 7 solutions here, and out of those, File-Collection is the one that meets most of my requirements. Meteor-Files would be my go-to if they added a way to just POST files to a URL like File-Collection.

PyCharm CE vs Sublime Text for Python Development

PyCharm and Sublime Text are both great editors, and they are both recommended quite often for Python development. While PyCharm is a full-fledged IDE, Sublime Text is a sophisticated text editor that is massively extensible via plugins. But which one is better?

Throughout the text of this post, whenever I say PyCharm, I am referring to PyCharm CE, and when I say Sublime, I am referring to Sublime Text 3(with Anaconda & GitGutter plugins installed).

Autocomplete

Code completion is a very useful feature to have for Python development. To get code completion in Sublime for Python, there are multiple plugins you can use. There’s SublimeCodeIntel, SublimeJEDI, and Anaconda. I personally prefer Anaconda.

Imports

PyCharms support for import autocompletion is no doubt worlds better compared to what Sublime has to offer.

(PyCharm)

(Sublime)

For some reason, it seems Anaconda doesn’t want to offer autocompletion without the from … import … syntax.

Functions

For functions, both Sublime and PyCharm have quality autocompletion. With Anaconda, it is possible to combine the docstring with the method signature, while you will have to settle with Ctrl+J on PyCharm.

(Sublime)

(PyCharm)

One place where PyCharm is lacking is automatic parameter insertion. While Sublime supports automatic parameter insertion, PyCharm only has automatic parameter hinting.

(Sublime)

(PyCharm)

Score: PyCharm - 2.5 points Sublime - 3 points

Virtual Environments

Both Sublime and PyCharm have support for virtualenv, while only Sublime supports Vagrant. Both Sublime and PyCharm can lint code using a virtual environment. If you are on Linux or OSX, you can symlink a virtual environment from within a Vagrant VM, but doing so is not possible on Windows.

Score: PyCharm - 1.5 points Sublime - 2 points

Git integration

Both Sublime and PyCharm provide Git integration. PyCharm definitely comes out at the top here, with the ability to see exact diffs, and integrate external diff and merge tools.

(Sublime)

(PyCharm)

Score: PyCharm - 2 points Sublime - 1 point

Resource usage

Energy usage

I use both Sublime and PyCharm on OSX, and OSX has nice Energy Impact information available in the Activity Monitor. Let’s take a look at that.

It seems that with my choice of plugins, Sublime has slightly higher energy usage compared to PyCharm. Almost all the plugins that I have installed in Sublime related to Python development are emulating some functionality that PyCharm already provides. Also, GitGutter and Anaconda are the only plugins which have always-running background processes that could elevate energy usage, and the functionality provided by them is present in PyCharm by default.

Memory usage

There is a stark difference between memory consumption while idling between the two editors. While Sublime consumes ~50MB RAM when not in use, PyCharm chomps up 700MB.

Score: PyCharm - 1 point Sublime - 1 point

Overall

Both Sublime and PyCharm have similar functionality, but PyCharm does most things better in comparison to Sublime. While Sublime Text is nagware with a $70 license fee, PyCharm CE is freeware, and PyCharm Professional Edition is priced at $99.

If you can spare $99 for a PyCharm Professional Edition license, it gets you some serious new features, like Flask/Django support, JS/HTML/CSS support, Database/SQL support, and more.

While points-wise, both tie at 7 points, I personally prefer PyCharm due to its superior built-in functionality, and I’m gonna stick with it.

GitHub Language Popularity Statistics

I’ve been wanting to get an idea of the division between languages on GitHub for a while now. While there are some articles available on the matter, none of them were really clear. So I’ve decided to do some research of my own.

Stars

Currently, there are 68 repositories on GitHub with more than 10000 stars.

JavaScript is the language that has the highest number of repositories with greater than 10,000 stars on GitHub.

Having a look at the top 10 most starred repositories on GitHub(that have a language associated with them).

Again, JavaScript comes out at the top with a clear majority.

There are currently 2209178 repositories on GitHub with 1 or more stars.

Once again, we have JavaScript coming out at the top with a 23.2% share of starred repositories on GitHub.

Forks

There are 10 repositories on GitHub with more than 8000 forks. Out of these, only 8 have a language associated with them.

This time, it looks like CSS is the language with the highest number of repositories with more than 8000 forks on GitHub.

There are currently 944872 repositories with 1 or more forks on GitHub.

This time again, we have JavaScript on the top.

Repositories

According to GitHub, there are 16.9M repositories on GitHub at the moment.

The chart below shows the top 10 languages.

Together, the top 10 languages account for 4541698 repositories, or about 21.2% of the supposed total of 16.9M repositories.

Issues

Going by what GitHub says, there are about 42.2M issues on GitHub, however, I’m only able to account for 12.4M of those.

Open

Closed


layout: post title: “PyCharm CE vs Sublime Text for Python Development” date: 2015-05-08 21:01:59 +0530 comments: true categories: —

PyCharm and Sublime Text are both great editors, and they are both recommended quite often for Python development. While PyCharm is a full-fledged IDE, Sublime Text is a sophisticated text editor that is massively extensible via plugins. But which one is better?

Throughout the text of this post, whenever I say PyCharm, I am referring to PyCharm CE, and when I say Sublime, I am referring to Sublime Text 3(with Anaconda & GitGutter plugins installed).

Autocomplete

Code completion is a very useful feature to have for Python development. To get code completion in Sublime for Python, there are multiple plugins you can use. There’s SublimeCodeIntel, SublimeJEDI, and Anaconda. I personally prefer Anaconda.

Imports

PyCharms support for import autocompletion is no doubt worlds better compared to what Sublime has to offer.

(PyCharm)

(Sublime)

For some reason, it seems Anaconda doesn’t want to offer autocompletion without the from … import … syntax.

Functions

For functions, both Sublime and PyCharm have quality autocompletion. With Anaconda, it is possible to combine the docstring with the method signature, while you will have to settle with Ctrl+J on PyCharm.

(Sublime)

(PyCharm)

One place where PyCharm is lacking is automatic parameter insertion. While Sublime supports automatic parameter insertion, PyCharm only has automatic parameter hinting.

(Sublime)

(PyCharm)

Score: PyCharm - 2.5 points Sublime - 3 points

Virtual Environments

Both Sublime and PyCharm have support for virtualenv, while only Sublime supports Vagrant. Both Sublime and PyCharm can lint code using a virtual environment. If you are on Linux or OSX, you can symlink a virtual environment from within a Vagrant VM, but doing so is not possible on Windows.

Score: PyCharm - 1.5 points Sublime - 2 points

Git integration

Both Sublime and PyCharm provide Git integration. PyCharm definitely comes out at the top here, with the ability to see exact diffs, and integrate external diff and merge tools.

(Sublime)

(PyCharm)

Score: PyCharm - 2 points Sublime - 1 point

Resource usage

Energy usage

I use both Sublime and PyCharm on OSX, and OSX has nice Energy Impact information available in the Activity Monitor. Let’s take a look at that.

It seems that with my choice of plugins, Sublime has slightly higher energy usage compared to PyCharm. Almost all the plugins that I have installed in Sublime related to Python development are emulating some functionality that PyCharm already provides. Also, GitGutter and Anaconda are the only plugins which have always-running background processes that could elevate energy usage, and the functionality provided by them is present in PyCharm by default.

Memory usage

There is a stark difference between memory consumption while idling between the two editors. While Sublime consumes ~50MB RAM when not in use, PyCharm chomps up 700MB.

Score: PyCharm - 1 point Sublime - 1 point

Overall

Both Sublime and PyCharm have similar functionality, but PyCharm does most things better in comparison to Sublime. While Sublime Text is nagware with a $70 license fee, PyCharm CE is freeware, and PyCharm Professional Edition is priced at $99.

If you can spare $99 for a PyCharm Professional Edition license, it gets you some serious new features, like Flask/Django support, JS/HTML/CSS support, Database/SQL support, and more.

While points-wise, both tie at 7 points, I personally prefer PyCharm due to its superior built-in functionality, and I’m gonna stick with it. %