You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When developing ipwb, I have been using a cycle of pip installing the source then testing. This gets tedious, repetitive, and incurs additional iterative temporal cost. It would be useful to be able to run the replay system, for example, using the Python script directly without installing it.
At one point, the replay and indexer scripts handled this via:
if__name__=="__main__":
do_something()
This is executed, for example, when running python -m ipwb.replay sample.cdxj. Currently, because all functionality is enclosed within functions (as appropriate), the previous command immediately exits. This would be different if the default execution (e.g., do_something() snippet) were added.
It would be worthwhile to identify how this is implemented in other projects that act as system "binaries" executed directly from the command-line.
The text was updated successfully, but these errors were encountered:
I think we should be able to use ipwb/__main__.py in place of ipwb from the project root after some changes in how relative imports work and making the script executable (by adding the shebang line and changing permissions). I made it work in AccessLog Parser.
@ibnesayeed Can you provide more information on what changes you anticipate for "how relative imports work"? I do not want to change too much with the logic of the code, but would like to execute the current state of the code using the python command, as I would run a conventional script.
I am a little busy, so I cannot elaborate much on this for the next few weeks, but if you want to investigate it now, I would suggest you start a fresh Python Docker container, clone the repo there (or mount from outside) so that dependencies do not leak in or out. One problem that I faced when I was working on accesslog-parser has to do with how relative imports work (or rather not work) when running modules as scripts. For that, I have added these two lines and then I was able to execute the __main__.py script directly, using the folder, or using it as a zip file, while also being able to install via pip and use it as system-wide executable configured via setup-py.
When developing ipwb, I have been using a cycle of
pip install
ing the source then testing. This gets tedious, repetitive, and incurs additional iterative temporal cost. It would be useful to be able to run the replay system, for example, using the Python script directly without installing it.At one point, the replay and indexer scripts handled this via:
This is executed, for example, when running
python -m ipwb.replay sample.cdxj
. Currently, because all functionality is enclosed within functions (as appropriate), the previous command immediately exits. This would be different if the default execution (e.g.,do_something()
snippet) were added.It would be worthwhile to identify how this is implemented in other projects that act as system "binaries" executed directly from the command-line.
The text was updated successfully, but these errors were encountered: