andreikop / enki

A text editor for programmers
http://enki-editor.org
GNU General Public License v2.0
161 stars 38 forks source link

Update: Install instructions and script. #332

Closed bjones1 closed 8 years ago

bjones1 commented 8 years ago

I moved the Unix install instructions to the install script -- does this seem reasonable to you?

andreikop commented 8 years ago

Hi

This script is a step ahead but it seems like at also doesn't solve all problems.

If I understand correctly, now it will work only on Debian-based systems. But on Debian based it is easier to install Enki from the repository. tre, CodeChat and mathjax are not available in the repository. We can make scripts which help to install this packages. But not whole Enki.

We have prebuilt packages only for the most popular Linux distributions. But on other Linuxes this script is also likely to fail. And a user would be frustrated. We can not support all package managers and know package names for all distributions. So I think it is better to just say to a user "Install X to have optional feature Y" and let him to find a way how to install a package on his distribution if he wants.

I think a better solution would be to

Than return to this pull request and re-think if we need installation script and how it should work.

andreikop commented 8 years ago

One more thing. Some time ago I tried to install CodeChat. There are some issues:

pip install -U CodeChat
andreikop commented 8 years ago

Btw, if you need this script now, i.e. for your students to install Enki quickly on Ubuntu, I can add it to the repo.

bjones1 commented 8 years ago

Good points. Thinking a bit more, there are several cases, ordered from a fully automatic install to a full manual process:

How does this sound in terms of updating the PR?

For CodeChat, I'll rename the repo and provided clear install instructions on the home page. The current version of CodeChat is available on pip. I'm not as comfortable with providing Linux packages, so I'll ask Yajo for help.

I'm close to migrating from tre to regex, which provide pip and linux packages, so that should help.

andreikop commented 8 years ago

There are a hack for developers on supported OSes.

  1. Install enki from a package
  2. Clone only enki or qutepart repository and do hacking

OK, let's wait for regex from pip and CodeChat,

bjones1 commented 8 years ago

OK, I've done a bit of fixing. It now uses regex instead of tre, and is hopefully a bit clearer. I didn't include your developer's hack for supported OSes, since I couldn't find a good place to put it. How does this look?

andreikop commented 8 years ago

Removing tre is amazing!!!! I tried to install regex and preview Enki README.md. Sync doesn't work for me out of the box. Does it work for your on this file?

bjones1 commented 8 years ago

Hmm, strange. Works for me on Windows. I'll check on Unix when I have a minute.

andreikop commented 8 years ago

OK, notify me when you have checked. I've finished with bugs I wanted to fix and it's time to release v 15.11.

bjones1 commented 8 years ago

This works fine for me on Ubuntu 14. What OS are you using?

andreikop commented 8 years ago

Oops, I incorrectly installed regex. Now it works fine on README. However I have some test failures. See #335.

andreikop commented 8 years ago

I've discovered that it doesn't make sense to copy mdx_mathjax. See Using the extension from a Python program. It seems enough to install the extension with pip.

andreikop commented 8 years ago

Oops, mdx_mathjax is not installable from pip

bjones1 commented 8 years ago

The mdx_mathjax installation is one of my least favorite items -- no pip package, no Linux package, just an ugly file copy. Yuck. Does this get included when installing Enki via apt-get?

andreikop commented 8 years ago

No, it doesn't get included to .deb. I'm not sure if we should. markdown and mathjax are 3rdparty software. Not all users need mathjax. And if they need - they always can install it.

However, if we would like to include it, we can just copy the file to enki repository

bjones1 commented 8 years ago

IMHO, I'd like Enki to come "with batteries included" -- that is, all features available by default, following Python's philosophy (a rich standard library). So, mathjax/sphinx/ctags/etc. should all be installed by default. The only exceptions I would make is programming languages (scheme, etc.), since users who want this will already have it installed.

andreikop commented 8 years ago

"Batteries included" is very good practice. But I would like to support and be responsible for 3rdparty markdown extension.

The mdx_markdown REAME is incorrect. It seems like to get the extension working we just need to put the file at any place at python path. i.e. site-packages where the majority of the software is installed.

So, I think there are 2 better ways to simplify the installation:

bjones1 commented 8 years ago

Good ideas -- a better install process would be great. Looking at https://github.com/waylan/Python-Markdown/issues/391, the author wants extensions to live in separate repos, not the core Python-markdown repo. Also, per https://github.com/waylan/Python-Markdown/wiki/Third-Party-Extensions, there are several math extensions, and the Markdown developers don't want to support them. So, I'd suggest creating a pip package. The instructions at https://github.com/waylan/Python-Markdown/wiki/Tutorial:-Writing-Extensions-for-Python-Markdown provide a fairly easy way to do this. Perhaps a pull request to https://github.com/mayoff/python-markdown-mathjax?

bjones1 commented 8 years ago

I've rethought this. The entire script is less than 20 lines. Packing for pip adds that much code again for setup.py -- then that much again for Linux packaging. I'd suggest simply including it in enki.plugins.preview and importing it from there, instead of all this work.

andreikop commented 8 years ago

If I understood correctly, the file must be in python import path. It is bad idea to include preview to the global path. I'd suggest creating separate directory which contains only mdx_markdown.

bjones1 commented 8 years ago

I don't think so. For me, putting mdx_mathjax.py in enki.plugins.preview than changing https://github.com/hlamer/enki/blob/master/enki/plugins/preview/preview.py#L163 to from . import mdx_mathjax work fine. (WIndows -- haven't tested on Linux).

andreikop commented 8 years ago

Are you sure your imported but not globally installed mathjax is used? I tried to do similar thing but markdown complained that it can't find and import mathjax.

bjones1 commented 8 years ago

Oops, you're right. There was an mdx_markdown.pyc file I didn't delete. I started playing with this, found a few fixes, but also got confused: what does this extension do, anyway? If I don't import it at all, math in a Markdown document seems to work just fine. ???

andreikop commented 8 years ago

mdx_mathjax was contributed by @rolandschulz. I guess he knows why it is needed. I think the majority of users don't need mathjax, and the minority can install it without our help.

bjones1 commented 8 years ago

I went ahead and fixed this. The case: $$a = 2 *b* c$$, for example, doesn't work without a MathJax extension. I found a better extension that fully supports MathJax and used it instead. The old one doesn't support standard MathJax notation, such as \(*a = b + 1\). See http://docs.mathjax.org/en/latest/start.html#tex-and-latex-input for more examples.

bjones1 commented 8 years ago

I've rebased and updated. Install instructions are now much simpler! Does this seem reasonable?

andreikop commented 8 years ago

I started migration to Python 3. Qutepart is already ready. I'd like to switch Enki to Python 3, create requirements.txt and than rethink if install script is usable for users or for developers.

bjones1 commented 8 years ago

Neat! That could be a lot of work, but I'm definitely excited about the port. What do you think about moving to PyQt5 after Py3?

andreikop commented 8 years ago

It will definitely be Qt5. I'm even not sure Qt4 is available for Python3. I'm not sure yet which version to use, PyQt or PySide.

bjones1 commented 8 years ago

Yes, Qt4 is available for Py3. The migration path is:

  1. Py2 toPy3
  2. PyQt4 to PyQt4 v2 api (can be done before #1).
  3. PyQt4 to PyQt5

Personally, I'm a fan of PyQt4/5 since I'm impressed by Phil Thompson's knowledge and response time to any questions asked. I don't know about PySide.

andreikop commented 8 years ago

Yes, PyQt is better choice. PySide seems abandoned. I've pushed to qutepart master 2 first steps.

andreikop commented 8 years ago

Bryan, I've updated the install instructions (copy-pasted some text from your README version) and included requirements.txt to the repository. Now I hope it is quite easy to install Enki. I think it doesn't make sense to include a install script to the repository. The script is likely to fail on exotic systems, and users will be unhappy. It is probably easier to follow the instructions than to fix the script.

bjones1 commented 8 years ago

OK. I can see your reasoning.

What about placing requirements.txt in setup.py instead, then using setuptools to automatically download and install them if necessary? Note that the Python 3 manual recommends setuptools instead of distutils.