These are chat archives for ensime/ensime-sublime

22nd
Jun 2017
Vishesh Chauhan
@VC1995
Jun 22 2017 08:59
So I have removed server.py and now using server-jars and compiler-jars for initialising classpath instead of running a sbt task :) We shifted from EnsimeModule to EnsimeProject, so I'm doing those changes
What should I do next
I was working towards 2.0 support now and thought I'll pick up the completions task later
@dickwall What all changes did you have in mind for 1)2.0 startup support and 2)switching to updated protocol
Rory Graves
@rorygraves
Jun 22 2017 09:22
Great. 2.0 support would be good. As would be moving to the JSON protocol.
Adding proper test support would be great too
Some bits might be harder so pick and choose to add maximum value.
Ghost
@ghost~540393fe163965c9bc2018ce
Jun 22 2017 09:24
I'd almost recommend building up something from scratch with good testing principles for starting the server and communicating to the server, and then port/migrate the features over one at a time to use that comm channel.
the only code I'd consider keeping in that would be the s-expression parser, but check if somebody else hasn't written a better one already
Vishesh Chauhan
@VC1995
Jun 22 2017 09:28
Okay, I'll study the communicating to server bit first
and start building up from scratch

Sorry I didn't quite get this?

Some bits might be harder so pick and choose to add maximum value.

Ghost
@ghost~540393fe163965c9bc2018ce
Jun 22 2017 09:30
you'll need these components initially: 1) s-expression parser 2) something to start the server and get the port number 3) websockets connection 4) JSON 5) tests
then you're in an exceptionally good position to just pick one feature at a time and move over to your new code
btw I use virtualenv when I do my python hacking at work, I have a setup file that looks like this
#!/bin/sh

# try your best to install as many of the optimised packages
# system-wide as possible, to get your package manager's compiled
# versions (i.e. the most compatible binaries).
#
#   sudo pacman -S python-virtualenv python-pip python3-numpy python3-scipy python-matplotlib python-pandas
#   yaourt -S python-imageio python-scikit-image
#
# OSX requires venv for matlibplot to work.

if [ `uname` = "Linux" ] ; then
    virtualenv --clear -p python3.6 --always-copy --system-site-packages .env
else
    python3.6 -m venv .env
fi

# temporarily enables the virtualenv for this terminal
source .env/bin/activate
# `deactivate' to escape the virtualenv

# https://github.com/Zulko/moviepy/
pip install moviepy

# http://pandas.pydata.org/
pip install pandas

# http://pillow.readthedocs.io/en/latest/
pip install Pillow

# https://www.scipy.org/
pip install scipy

# http://scikit-image.org/download.html
pip install scikit-image

# https://matplotlib.org/
pip install matplotlib

# http://mikeboers.github.io/PyAV/
pip install av

# for elpy / CLI support
pip install importmagic yapf flake8

# for better debugging
pip install ipdb
(most of this is not relevant for you, but you get the idea0
apparently there is a file input for pip, it might be better to use
then I also have a small script called py like this
#!/bin/sh

# allows running batch python commands from the shell without mutating
# your prompt. e.g. ./py metrics.py

source .env/bin/activate
exec python $*
which almost makes python feel like it is all grown up and has a build tool
my .flake8 (linting, style rules) looks like this
[flake8]
ignore=F841
because F841 is just one big massive pain in the arse
Vishesh Chauhan
@VC1995
Jun 22 2017 09:34
This is all good :) thanks
I am using virtualenvwrapper btw
Ghost
@ghost~540393fe163965c9bc2018ce
Jun 22 2017 09:35
there are so many of them, what does it do?
oh I looked into that
it's one of those tools where I couldn't understand what it did
in JVM we have jenv, it would be very very good if somebody did the same for python, assuming that virtualenvs are in a .env directory in the current or parent dirs.
then we wouldn't need my py script
Vishesh Chauhan
@VC1995
Jun 22 2017 09:37
it's a simple wrapper around virtualenv
Keeps all the virtual envs in one place, can list them use any as u would a simple virtual env
yep they are in .env
Ghost
@ghost~540393fe163965c9bc2018ce
Jun 22 2017 09:37
Emacs support for python is better than anything else I've seen. Which was a surprise to me because I thought it was really terrible, much less polished than ENSIME. But then I paired with somebody using PyCharm and I was shocked how bad it was.
Vishesh Chauhan
@VC1995
Jun 22 2017 09:37
with virtualenvwrapper
Ghost
@ghost~540393fe163965c9bc2018ce
Jun 22 2017 09:37
management of virtualenvs is not the problem... it's remembering to use the virtualenv is the problem
I mean a .env in the project folder
I think that's the right way to do it
Vishesh Chauhan
@VC1995
Jun 22 2017 09:38
oh,okay
Ghost
@ghost~540393fe163965c9bc2018ce
Jun 22 2017 09:38
but of course do what is working for you, there are an infinite number of ways of setting it up
Rory Graves
@rorygraves
Jun 22 2017 09:42
There is also the 'sublime way of doing things' when you are writing a plugin which seems different again
Vishesh Chauhan
@VC1995
Jun 22 2017 09:42
through the new plugin option ?
Rory Graves
@rorygraves
Jun 22 2017 09:43
My original comment was more 'these are ideas, and I'm not sure of the complexity of each of them to take them with a pinch of salt'
My brief investigation with sublime plugins and dependencies left me lost down a rabbit hole. E.g. How to depend on a json library.
Ghost
@ghost~540393fe163965c9bc2018ce
Jun 22 2017 09:57
@rorygraves it's built into the language, like all good programming languages, you must have missed that massive scala json rage war :laughing:
but yeah, even if other packages are installed, the import system in python is extremely flakey
it all boils down to thinking in terms of hacks... like loading relative .py files, instead of thinking like a programmer with a mental model of the package structure.