-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run TimeTagger by just timetagger
#517
base: main
Are you sure you want to change the base?
Conversation
With this change, it is possible to run the server by just running `timetagger`, as an alternative to `python -m timetagger`. Move timetagger/__main__.py to timetagger/_serve.py and create a new __main__.py for special handling of --version.
setuptools might not be installed in the venv anymore, but we need pkg_resources.
Hi @AlexElvers thanks for this PR! The Could you also put a comment in |
Thanks for your response! I've implemented your suggestions (and merged the changes of the main branch). Besides Let me know if you have further suggestions. :) I would suggest to make the simple One thing I noticed: Before my changes, the resources seem to be compiled/collected twice (I don't know why), after my change only once. I think, this is rather an improvement than a problem, right? Before:
After:
|
Thank you for this great tool!
Currently, TimeTagger is started by
python -m timetagger
. I'd like to suggest adding atimetagger
console script as an alternative. This command is easier to remember.By having a console script with the same name as the package, it is possible to install and run TimeTagger using uvx, e.g.:
uvx timetagger --version
(automatically sets up a temporary venv, installs the package and runs the command) or if you want to try it as long as this change is not released on PyPI:uvx --from=. timetagger --version
oruvx --from=git+https://github.com/AlexElvers/timetagger@console-script timetagger
Because the generated console script the imports the specified module (
from timetagger.__main__ import main
),__name__
is not"__main__"
in this case. To support--version
, I moved most of the previous__main__.py
to_serve.py
and added the version info handling and the import of_serve
to the newtimetagger.__main__:main
function.Please let me know if you generally like this change, if you'd want me to change something or if I missed something. :)