wakatime / wakatime-cli

Command line interface used by all WakaTime text editor plugins
https://wakatime.com/plugins
BSD 3-Clause "New" or "Revised" License
292 stars 41 forks source link

wakatime plugin for python CLI REPL #805

Closed Freed-Wu closed 1 year ago

Freed-Wu commented 1 year ago

I try to realize a wakatime plugin for python CLI REPL. Can it be added to https://wakatime.com/terminal?

And I let the plugin run

            "wakatime-cli",
            "--write",
            "--plugin=python-wakatime",
            "--entity-type=app",
            "--entity=python",
            "--alternate-language=python",

However, I don't see python in the editors, only found pycharm which I never use. What happened?

screen-2023-01-13-22-20-17

alanhamlett commented 1 year ago

The PyCharm editor sends it's plugin name as just python, so we fix it on the backend.

How about naming yours pyrepl-wakatime?

Freed-Wu commented 1 year ago

However, I have created python-wakatime in PYPI. Rename the project to pyrepl-wakatime seems to be not convenient and confusing. And I am not sure if I should give different plugin name for different REPL: python-wakatime, ipython-wakatime, ptpython-wakatime, ... If change to pyrepl-wakatime, it will not be different for different REPLs.

And why pycharm send python-wakatim not pycharm-wakatime? It sounds weird.

alanhamlett commented 1 year ago

And why pycharm send python-wakatim not pycharm-wakatime? It sounds weird.

When the plugin asks the IDE what it's name is, it says python. We could release a new version of the jetbrains plugin to rename it client-side but some people would still use an old version of the plugin for a long time so it's not practical.

Freed-Wu commented 1 year ago

we fix it on the backend.

If pycharm must be named to python-wakatime, I would rather python-repl-wakatime not pyrepl-wakatime. But I am not sure is it too long? (Perhaps python-cpython-wakatime? Oh It looks more weird. Or just py-wakatime?)

Are there any other plugin use wrong name? They should be listed in the document to let the others avoid use same name. And is there any restrict or requirement of plugin name? Or any XXX-wakatime is legal? Can I have different plugin names for python/ipython/ptpython and so on? If one plugin send pycharm-wakatime, will it be recognized same as python-wakatime, or A new plugin?

Freed-Wu commented 1 year ago

And there are many languages has a REPL. Such as reply is a REPL of perl. If one create a wakatime plugin, this plugin should be called perl-wakatime or reply-wakatime best? I hope it exists a standard to direct the name of plugin.

screen-2023-01-14-04-33-36

alanhamlett commented 1 year ago

Let's use repl-cpython-wakatime, repl-perl-reply-wakatime, repl-ipython-wakatime, repl-ptpython-wakatime, etc.

Are there any other plugin use wrong name? They should be listed in the document to let the others avoid use same name.

Here's the full list of editors we rename based on XXX-wakatime the XXX part:

RENAME_EDITORS = {
    "0xdbe": "DataGrip",
    "androidstudio": "Android Studio",
    "adobe-xd": "Adobe XD",
    "adobexd": "Adobe XD",
    "azdata": "Azure Data Studio",
    "clion": "CLion",
    "codeblocks": "Code::Blocks",
    "codetasty": "CodeTasty",
    "dbeaver": "DBeaver",
    r"eric\d+": "Eric",
    "ida_pro": "IDA Pro",
    "idea": "IntelliJ",
    "iterm2": "iTerm2",
    "netbeans": "NetBeans",
    "notepadpp": "Notepad++",
    "onivim": "Onivim",
    "onivim2": "Onivim",
    "python": "PyCharm",
    "reclass": "ReClassEx",
    "ruby": "RubyMine",
    "sqlops": "Azure Data Studio",
    "sublime": "Sublime Text",
    "texstudio": "TeXstudio",
    "visualstudio": "Visual Studio",
    "vscode": "VS Code",
    "wakatime-mode": "Emacs",
    "wakatime-zsh-plugin": "Zsh",
    r"wakatime\.fish": "fish",
}

Can I have different plugin names for python/ipython/ptpython and so on?

Yes, but ofc only use a different plugin name if your plugin is running in a different repl. If it's running in ipython, use repl-ipython-wakatime and we'll parse that as IPython in the dashboard.

Freed-Wu commented 1 year ago

Let's use

I have changed to repl-python-wakatime, repl-ipython-wakatime, repl-ptpython-wakatime. And if other REPL such as bpython can be supported, I'll use the similar name. Take the fact that they are all python REPLs into consideration, I think they can use the same color.

The project name is also python-wakatime, because changing it is too troublesome.

And this plugin is not only support cpython, also support pypy (I have tested). So I use repl-python not repl-cpython.

Now, can this plugin be added to https://wakatime.com/terminal? TIA!

alanhamlett commented 1 year ago

Now, can this plugin be added to https://wakatime.com/terminal?

Yes! We have a new policy that any plugin added to the website must be under the @wakatime GitHub org, because we've had plugins in the past become abandoned by the original authors causing a bad user-experience when things are broken.

Could you transfer ownership of the repo to @wakatime? Then you will get admin access to the repo, so you can still manage it fully.

Freed-Wu commented 1 year ago

Could you transfer ownership of the repo

How can I do?

screen-2023-01-14-20-45-07

alanhamlett commented 1 year ago

Oh, you could transfer it to @alanhamlett then I can transfer it to @wakatime.

alanhamlett commented 1 year ago

I've transferred the repo to https://github.com/wakatime/repl-python-wakatime.

alanhamlett commented 1 year ago

You should have an invite to maintain the repo in your email.

alanhamlett commented 1 year ago

It's also now listed at https://wakatime.com/terminal.

Freed-Wu commented 1 year ago

screen-2023-01-14-22-23-32

How can I enable pre-commit.ci and codecov? And I don't have the permission of webhook, so I cannot import this repo to readthedocs. Can you provide this permission or import it and add me as a collaborator?

alanhamlett commented 1 year ago

And I don't have the permission of webhook

How about now?

Freed-Wu commented 1 year ago

pre-commit.ci and codecov work, but readthedocs.io warns

screen-2023-01-15-04-09-39

https://readthedocs.org/projects/repl-python-wakatime/

alanhamlett commented 1 year ago

I just re-delivered a webhook payload from the GitHub settings and it's working, showing received on readthedocs:

Screenshot 2023-01-14 at 9 38 24 PM
Freed-Wu commented 1 year ago

We have a new policy that any plugin added to the website must be under the @wakatime GitHub org

I notice some of them like zsh-wakatime or bash-wakatime are not very active (new commits or response to issues). Will those plugins not under @wakatime be transferred to @wakatime?

alanhamlett commented 1 year ago

For the old plugins not under @wakatime, if they have PRs not merged and the repo owner isn't responding then I clone them to @wakatime and point the website instructions to the new repo location.

Freed-Wu commented 1 year ago

I try to add wakatime support for perl's REPL, can I use the name of repl-reply-wakatime? And I want to add wakatime support for a translate software, can I use the name of translate-shell-wakatime and let its category is translating not coding or browsing?

Freed-Wu commented 1 year ago

Can we have a new category translating for translate software?

alanhamlett commented 1 year ago

Can we have a new category translating for translate software?

Added translating https://wakatime.com/colors/categories

Freed-Wu commented 1 year ago
❯ wakatime-cli --help
Command line interface used by all WakaTime text editor plugins.

Usage:
  wakatime-cli [flags]

Flags:
      --category string                  Category of this heartbeat activity. Can be "coding", "building", "indexing", "debugging", "running tests", "writing tests", "manual testing", "code reviewing", "browsing", or "designing". Defaults to "coding".

The usage should be updated, too. :smile:

Freed-Wu commented 1 year ago
❯ wakatime-cli --help
Command line interface used by all WakaTime text editor plugins.

Usage:
  wakatime-cli [flags]

Flags:
      --category string                  Category of this heartbeat activity. Can be "coding", "building", "indexing", "debugging", "running tests", "writing tests", "manual testing", "code reviewing", "browsing", or "designing". Defaults to "coding".

The usage should be updated, too. smile

@alanhamlett