Skip to content
This repository has been archived by the owner on Oct 9, 2021. It is now read-only.

WakaTime support for Wolfram Language / Mathematica #255

Open
Gravifer opened this issue Feb 25, 2021 · 2 comments
Open

WakaTime support for Wolfram Language / Mathematica #255

Gravifer opened this issue Feb 25, 2021 · 2 comments

Comments

@Gravifer
Copy link

I code in the Mathematica front end a lot in the draft phase of my projects; but these time spent is not recognized by WakaTime.

Therefore, I created a package to enable this; it can be found at my repo. Since evaluation is often conducted coding in Mathematica notebooks, I took a shortcut and had the heartbeats sent on Evaluation.

For now it calls a pre-installed WakaTime CLI for heartbeats; It can also recognize the project, provided that a fairly new version of git has been installed.

I am not an experienced developer, so I am turning to the community for help.

@Gravifer Gravifer changed the title WakaTime support for Mathematica WakaTime support for Wolfram Language / Mathematica Feb 27, 2021
@luckydonald
Copy link

With command line calls like where.exe wakatime.exe I'd assume this will only work on Windows.
I think Linux and Mac support would be needed as well, assuming Mathematica can be installed on those.

Maybe the Creating Plugin Docs could be helpful, especially the Plugin Init section, as it shows how to do the steps necessary to get wakatime installed if not present.

@Gravifer
Copy link
Author

Gravifer commented Mar 4, 2021

With command line calls like where.exe wakatime.exe I'd assume this will only work on Windows.

@luckydonald I am aware of that, and for now I think Linux users could simply replace this with which (of which where.exe is just a lousy substitute).

Maybe the Creating Plugin Docs could be helpful, especially the Plugin Init section, as it shows how to do the steps necessary to get wakatime installed if not present.

I known there is still a lot to do: detection of the platform, downloading the CLI (to the add-on directory; Mathematica seems to ship Python with it since 12.1), handling timeout, logging and so on.
I intend to do this but recently got caught up by deadlines of another project; I will get back to this as soon as possible.
The merit of my current implementation (if any) is to find that it is possible to maintain a internal state for the plug-in using Once and Unset. I used this approach to keep the overhead relatively low, but there may be a better way.

There is also some other issue: during my own testing I found that sometimes in these calls to the CLI, maybe Mathematica did not set up the environment correctly, and the CLI fails to detect the project. I need more testing to really pin down what went wrong.

Last but not the least, the approach I took was to modify the $PreRead variable, i.e., to asynchronously call the CLI each time some code is executed. This is inaccurate compared to the editing-based approach, but I do wonder if Mathematica exposes the interface for monitoring file modification and user input; it allows me to detect the active file via the EvaluationNotebook[] function, but also at evaluation time, not as soon as the user switch between notebooks.

To summary the problems:

  • Help is needed to make the plug-in self contained and follow the development guideline;
  • Does Mathematica expose usual editor interfaces? If not, is this evaluation-time method satisfactory?
  • Efficiency and robustness of implementation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants