scimax icon indicating copy to clipboard operation
scimax copied to clipboard

scimax 3.0?

Open jkitchin opened this issue 5 years ago • 37 comments

This is not so much an issue as a place to spark some discussion. I am thinking about making a new version of scimax with a few goals designed to make it easier for new people to try it out. This is a somewhat long-term plan, my aim is to have this ready for deployment in Aug 2020 so I can use it for teaching in Fall 2020.

  1. Make cross-platform installation simpler

The main idea here is to create a scimax python package that installs scimax with pip install --user scimax. This will figure out what platform the user is on, and install scimax in the user site-packages directory, and create some simple commands to start scimax. I am not committed to this approach but it seems like the simplest from a user point of view. Experts will still be able to install scimax any way/where they want.

  1. Create a scimax github institution

This is mostly to separate the scimax repositories into one place for organization. It might make it more modular. For example, I would probably feel better about making a repo for latex packages for scientific publishing.

  1. update to Emacs 26+

I think I want to migrate away from ob-ipython towards emacs-jupyter. This will require emacs 26+. I need to make sure this works smoothly on Windows though, as it requires building an emacs module.

  1. Provide a curated initial set of packages

The initial installation of scimax, especially on windows, is often problematic with issues on Melpa, or gnu elpa. This would make the initial installation simpler and more robust.

Any other ideas? Post them as comments below, and I will add to/edit this issue to integrate them. Thanks!

jkitchin avatar Aug 03 '19 17:08 jkitchin

Inside the new latex repo, it would be nice to have some examples for ox-manuscript, at least for some of the templates, to see how they look.

There are two ways of starting these templates: ox-manuscript-new-ivy and ox-manuscript-new-helm. Is there a prefered way?

domingoUnican avatar Aug 04 '19 11:08 domingoUnican

You might be interested in http://catalysis-preprint-archive.github.io/. It is an experiment I worked on many years ago. Most of the templates came from articles listed at this site, and in theory most of them should have something called manuscript.org in them that became the paper. Links to these could at least be documented in the new repo.

I prefer the ivy way of starting new manuscripts. The helm one came first, and later I mostly transitioned everything to ivy.

jkitchin avatar Aug 05 '19 00:08 jkitchin

I'm excited to hear of these plans! Modularizing emacs packages and integrating emacs-jupyter are particular interesting to me for my use cases (mostly just running code and authoring jupyter notebooks in emacs).

One minor suggestion would be to consider conda packaging in addition to pip. I cannot make claims about emacs enviroments, but conda has been a huge help in getting my students up and running complicated modeling codes on different OSs. This includes compiled binaries not related to python.

singletS avatar Aug 05 '19 01:08 singletS

I thought about conda too, especially since I prefer the Anaconda python distribution. There is an emacs conda package at https://anaconda.org/conda-forge/emacs for Mac and Linux. If it is as easy as conda install -c conda-forge emacs for Windows too, I would be all in!

jkitchin avatar Aug 05 '19 11:08 jkitchin

Big thumbs up. Happy to contribute to the python module and packaging in any way.

tgbugs avatar Aug 06 '19 06:08 tgbugs

Another idea/suggestion: Have ox-ipynb be a derived export backend so it understands more of the org-mode built-in structures. Because of ipynb limitations there will always be differences, but several of the export-related issues have involved a missing org mode feature or unexpected output for an ipynb compared to HTML or LaTeX output.

singletS avatar Aug 11 '19 13:08 singletS

It would be helpful to post these as issues on the ox-ipynb repo. It is such a different exporter, I am not sure there is a way to make it like html or latex.

jkitchin avatar Aug 28 '19 17:08 jkitchin

One difference in philosophy I've seen with starter kits like Prelude versus Scimax is that they tend to offer options that the user can customise, and do not 'impose' much on the user. Like the leuven theme being default with Scimax, and customisations of the source block colors. It would be convenient if user.el example had almost all the scimax specific customisations with options of loading, or not at all. i.e default scimax is as close to default emacs and everything else is an option.

shrysr avatar Aug 28 '19 17:08 shrysr

That is a fair observation. Scimax started as a way to get my students quickly up to speed with a tool they can do their research and work with, with scientific publishing at the core of that, in a way that is compatible with what they need and I need from them. The large majority of these students do not know what they need to accomplish that, and I don't want them to spend the years I have spent figuring it out. Thus, the imposition of my opinions on what they need so they can learn from me how to do it. With this, they can on day 1 use scimax the way I do. I think of scimax as more like an app in this sense.

For those who do know what they want, it is not necessary to load all of scimax. You can start with vanilla emacs, and just add scimax to a load-path, not load init.el, and load the parts you want. That is mostly true, although there are a lot of things in scimax-org.el that might feel like impositions to just load them all. Some of these could be split out into smaller files to limit that. If there were strong feelings (which mostly have not been voiced so far), I would be happy to talk about what to move out, and make optional. This would make sense especially for the monkey-patched org-code that does things like color the src-blocks.

In its current setup, preload.el is the place to put options for loading, since this would be run before anything else is loaded. I am not too excited by this idea, as it means defining variables for each feature, then checking those variables before loading them. This would be ok for the features that are the biggest impositions, but tedious for all of them. Maybe an expert-mode-variable could be defined that doesn't load any packages and goes straight to user/user.el?

Alternatively, packages.el could be renamed to user/user.example where a user would have to rename it to user.el to get any customization. That seems like one step more than needed to me, but the install script could do this automatically. The downside of this, to me, is that this file (user/user.el) is not part of the scimax repo so it is not possible for me to update their installations. I see that this too might be unwelcome by some, but it is a necessary feature for me to support my students.

Thanks for the observation, it got me to think a lot about what is in scimax and why, and how it might be reorganized in v3 to accommodate different use cases.

jkitchin avatar Sep 09 '19 16:09 jkitchin

I see your point about treating it as an app, and it makes sense. No doubt - even as it is - Scimax rocks, and it's unlikely I can accurately estimate the time it has saved me since several years. Thank you! I do live in Scimax more or less. I can't think of other things I find imposing, other than the theme per se - but I guess for me Scimax is Emacs, and I would not be able to judge very well. I guess the comment also stemmed from a sense that native Emacs and Prelude (based on brief explorations) feel snappy(er) in terms of loading as well as response, as well a desire to have a lean and mean config, i.e only the packages I need.

Ha! It's been some years since I was a student - but w.r.t Emacs - I'm not very different from those students who don't completely know what they need either, and it has been a journey. I still don't know or leverage all of scimax's nifty customisations. In fact - I probably did not find the Scimax help file till after using Scimax for quite some time, and started using even the Scimax hydra rather late (which I'm yet to fully explore).

I can understand the tedious nature of defining variables for each feature. It doesn't seem to be the optimal long term solution either, though I guess the other starter kits appear to follow this. For eg I liked the 'doom doctor' feature during a brief exploration of Doom Emacs.

The expert-mode-variable actually sounds good. I think the expert-mode-variable makes sense in one additional way - I get to actually learn the features of scimax step by step and systematically understand what I need and do not, and not to mention what exists. I was wondering whether an Org mode based config could help here. Sort of expand scimax.org into a user-example.org, and use it to provide groups of features, or even config snippets that can optionally tangled?

FWIW: I've been meaning to convey since some time that I'm happy to help in any way I can, especially documentation and config examples. If there are specific areas you have in mind - it would guide me if you tag them 'good first issue' or something suitable and I could work on them.

shrysr avatar Sep 09 '19 21:09 shrysr

conda install -c conda-forge emacs

I actually use this as a shortcut to install newer versions of Emacs on Linux, but I guess one issue is that when the virtual env is switched - Emacs is no longer available to be called from shell?

shrysr avatar Sep 09 '19 21:09 shrysr

FWIW: apparently there is a new (still undocumented) conda option to support stacking environments that might solve this conundrum.

I have not tried it.

malcook avatar Sep 09 '19 22:09 malcook

I see your point about treating it as an app, and it makes sense. No doubt - even as it is - Scimax rocks, and it's unlikely I can accurately estimate the time it has saved me since several years. Thank you! I do live in Scimax more or less. I can't think of other things I find imposing, other than the theme per se - but I guess for me Scimax is Emacs, and I would not be able to judge very well. I guess the comment also stemmed from a sense that native Emacs and Prelude (based on brief explorations) feel snappy(er) in terms of loading as well as response, as well a desire to have a lean and mean config, i.e only the packages I need.

The theme is now configurable. It is still leuven by default. You can define a theme in user/preload.el with (setq scimax-theme 'some-theme-symbol), or set it to nil to have no theme. (https://github.com/jkitchin/scimax/commit/c5cec09d8e313dc6eac4e8ad5a60e7f7d046c29b).

It is almost certain they load faster. org-ref is the main culprit here, and it is mostly because of pdf-tools. I leave Emacs open for so long, I don't worry about the startup time, but it would be great if we found a way to make it load faster.

Ha! It's been some years since I was a student - but w.r.t Emacs - I'm not very different from those students who don't completely know what they need either, and it has been a journey. I still don't know or leverage all of scimax's nifty customisations. In fact - I probably did not find the Scimax help file till after using Scimax for quite some time, and started using even the Scimax hydra rather late (which I'm yet to fully explore).

You aren't the only one, I have occasionally found myself reinventing things I already wrote in scimax and forgot about! Some things are just ideas to try out.

I can understand the tedious nature of defining variables for each feature. It doesn't seem to be the optimal long term solution either, though I guess the other starter kits appear to follow this. For eg I liked the 'doom doctor' feature during a brief exploration of Doom Emacs.

The expert-mode-variable actually sounds good. I think the expert-mode-variable makes sense in one additional way - I get to actually learn the features of scimax step by step and systematically understand what I need and do not, and not to mention what exists. I was wondering whether an Org mode based config could help here. Sort of expand scimax.org into a user-example.org, and use it to provide groups of features, or even config snippets that can optionally tangled?

I think this wouldn't require an expert-mode variable. It sounds like more of an org-based config that starts in init.el and goes through it.

FWIW: I've been meaning to convey since some time that I'm happy to help in any way I can, especially documentation and config examples. If there are specific areas you have in mind - it would guide me if you tag them 'good first issue' or something suitable and I could work on them.

I will give this some thought.

jkitchin avatar Sep 10 '19 02:09 jkitchin

I think this wouldn't require an expert-mode variable. It sounds like more of an org-based config that starts in init.el and goes through it.

Yes. Org mode based config would not need the expert-variable. I guess there are advantages with separate .el files - but somehow using an Org mode based config has been a lot easier to manage for my custom config, and write notes in it. With a tangle on save snippet - I don't have an additional wait time for a tangle during start-up.

update to Emacs 26+

Wait - am I supposed to be using Scimax with an older version of Emacs??

shrysr avatar Sep 10 '19 21:09 shrysr

no. 26+ is nearly required these days! But the older Windows version installs with an Emacs25 I think.

jkitchin avatar Sep 10 '19 23:09 jkitchin

  1. Making scimax installable with pip is a great advantage. I recently introduced some of my colleagues to emacs and scimax and it is still a relatively steep learning curve. Anything that would make that experience easier is welcome.

  2. I like the idea of making scimax more modular.

I would like to pitch something. It has to do with the thought that scimax can be used to create self-contained publications (or lab notebooks/thesis).

I wonder how one could turn a .org file that contains everything for a paper into one neat package that can be installed on another researchers computer and easily executable. Maybe using docker or singularity? I wonder what is your approach to this and whether it would be something to keep in mind, specially when competing with current solutions for jupyter notebooks etc.

hummuscience avatar Nov 26 '19 11:11 hummuscience

In theory you could just write all the instructions and code blocks for bootstrapping the environment for the org file in the file itself that process could use containers, or any number of other possible mechanisms for replicating an environment. I use a brute for approach in setup.org to get a working scimax install. It is not a good approach because it is error prone and depends too much on the user knowing how to read and run code blocks. However, it works on windows, linux, and osx -- if they follow the instructions. In another case I have a self publishing org file that tangles files into the git commit hooks folder along with a publishing config so that pdf publishing runs every time I create a commit. I don't have that one in a public git repo yet (it is for my thesis), but have been working on a stripped down version that captures the essence of the workflow.

Portable environment bootstrapping is quite difficult if you really want it to be reproducible, not just containerized. But a source block that is a dockerfile for a minimal environment is a reasonable start.

tgbugs avatar Nov 26 '19 18:11 tgbugs

@tgbugs - how can I stay tuned to your efforts on the "stripped down version" - sounds great!

malcook avatar Nov 27 '19 01:11 malcook

@malcook I will drop a note in this thread when I create the repo.

tgbugs avatar Dec 06 '19 09:12 tgbugs

@malcook https://github.com/tgbugs/orgstrap It only took about 10 months, but I think it is more or less ready, and hopefully will be on melpa within the next week. Also potentially of interest in this thread is the bootstrapping to emacs section given the continued struggle to simplify the process of getting colleagues up and running with org-mode.

tgbugs avatar Sep 02 '20 08:09 tgbugs

A note on Emacs on Windows:

I started with native Emacs on Windows (Emax64 worked best for me) but there are lots of minor issues that made me change to Emacs in WLS (Windows Subsystem for Linux, just enable "Windows Subsystem for Linux" in "Control Panel -> Programs and Features -> Turn Windows Features on or off" and pick your favorite Linux distribution in the Microsoft Store, mine is Debian). I use MobaXTerm as Terminal and X11-Server. This setup works like charm for me, already for a couple of years. Today, I built Emacs with support for modules (Debian doesn't have it by default) to run emacs-jupyter and successfully connected to Wolfram Language. See https://gist.github.com/federkamm/c268c7268e4a1e9d85ef4866a6afc6ea for compiling instructions.

The downside from WSL is that the GPU is not available to Linux, making Machine Learning no fun (this will most likely change in the next couple of years, but that's how it is for now). However, I didn't try yet, but I suppose it is possible to run native Python and Jupyter on Windows and use WSL Emacs to connect to Windows Jupyter and use the GPU.

EDIT: Just noticed, WSL Emacs can simply run Windows binaries, like "jupyter.exe" (e.g. from M-!, when in path). This makes it probably even easier to link WSL Emacs to Windows Python/Jupyter.

federkamm avatar Sep 26 '20 19:09 federkamm

@federkamm thanks for the note. That sounds pretty promising. I think packaging is probably critical to the future success of scimax, it seems to be a stumbling block with new people, especially given the ease of Google docs and colab.

jkitchin avatar Oct 01 '20 22:10 jkitchin

Having a proper ipython/jupyter-shell will help quite a lot for data analysis workflows and debugging. I've tried various solution by connecting to jupyter kernel being used in a given org file with term/shell/eshell, but all have some issues. I guess migrating away from ob-ipython towards emacs-jupyter might provide a solution already (because emacs-jupyter give you an interactive shell, when you initialize a kernel), but not sure.

If you decided to incorporate an ipython/jupyter-shell in scimax 3.0, I'd be happy to share my experience (and help).

shervinsafavi avatar Jan 09 '21 00:01 shervinsafavi

In the current scimax you can get to an interactive shell already, with the existing ob-ipython setup. You use the command org-babel-switch-to-session or C-c C-v C-z or from the menu, Org -> ob-ipython -> Switch to repl. Does this shell not do something you want?

I do plan to eventually switch over to emacs-jupyter, hopefully this summer, at least for myself. The pandemic has really cut down on development time though, so who knows.

jkitchin avatar Jan 09 '21 00:01 jkitchin

Actually I was not aware of org-babel-switch-to-session! I just tried it, and it works quite well :) The only thing I noticed is different from emacs-jupyter shell is you could have inline images (the figure output of an ipython cell) in the shell (although I admit is not something essential at all - it's just nice to have it sometimes).

I was about to push some minor suggestions for the documentation of the org-show, I just thought it is also worth mentioning org-babel-switch-to-session in the manual, for the ipython part. I'll add it somewhere appropriate and feel free to keep it if you also find it helpful.

By the way, thanks for all the effort you have put in creating scimax! I start working with emacs relatively recently and scimax saved a lot of time and gave a lot of joy :)

shervinsafavi avatar Jan 09 '21 23:01 shervinsafavi

inline images in the shell are fancy. when i make images from org-babel-switch-to-session they pop up externally. I don't know what magic emacs-jupyter does there.

the repl switch is mentioned a few times in https://raw.githubusercontent.com/jkitchin/scimax/master/scimax-ipython.org. it would be easy to miss there though.

Glad to hear you are enjoying scimax!

jkitchin avatar Jan 11 '21 18:01 jkitchin

Hi Kitchin, just found your package when looking up how to write-up scientific text for my grad course. Tutorial videos were really inspiring :)

Just an open question here to anyone: can I install this on top of doom-emacs? I'm new to emacs but as I understand it... doom and scimax are curated 'distributions' of emacs. Scimax more so suited for the whole process of scientific writing. I'm slightly worried if I will break anything in doom if I install scimax now.

dcstang avatar Jan 26 '21 13:01 dcstang

If you are using doom you would need to port a number of the packages from scimax to work with Doom's package manager (straight) compile and configuration system. scimax includes a number of packages that are not required for the scientific writing portion, configuring the relevant set to work on doom might be tractable since I think it is most org-ref and dependencies.

tgbugs avatar Jan 26 '21 16:01 tgbugs

you can also just clone scimax, add it to your load-path, and then just manually load/require what you want from it.

jkitchin avatar Jan 26 '21 16:01 jkitchin

I have two questions.

On the topic of making scimax more modular, would it make sense to have org-db as a separate package? Lots of existing org extensions need to be reworked to work with either scimax's org-db and org-roam's database.

Also, when it comes to modifying files outside of emacs, could detection of file changes be (optionally) managed by git or something similar?

mricke avatar Jan 26 '22 22:01 mricke