DavidMStraub / netviel

Web interface for the notmuch e-mail system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide "development" instructions in README / separate page

lmanul opened this issue · comments

A simple page giving some steps on setting up a development environment for improving the project would be awesome

I'm starting something like this here:

https://gist.github.com/lmanul/90ea91189ae0f37db506fb9adc6891f7

Very good, thanks.

For the backend, what I do is

python3 -m pip install -e . --user

(or even better in a virtual environment, then --user can be omitted). This installs the package in editable mode, i.e. it is always run directly from the development directory. There is no need to use python3 setup.py ... at any time.

Concerning CORS: good point. I added that header initially to make this work with my development setup, but it has been removed recently in #4 since it is a security risk in production. The question is how to make this avaiable in development... probably we have to add a command line switch.

Thank you @DavidMStraub ! I'm not an expert on stuff about pip and virtual environments so I'm just trying to keep the setup as simple as possible for anyone else. At least on my system, the command you provided still seems to run into permission issues?

~/repos/netviel % python3 -m pip install -e . --user
Obtaining file:///home/manucornet/repos/netviel
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/manucornet/repos/netviel/setup.py'"'"'; __file__='"'"'/home/manucornet/repos/netviel/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info
cwd: /home/manucornet/repos/netviel/
Complete output (2 lines):
running egg_info
error: [Errno 13] Permission denied
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Maybe I'm missing something!

Well noted on CORS, I will have a look at that. Thank you!

The question is how to make this avaiable in development... probably we have to add a command line switch.

This shouldn't be necessary because you shouldn't be making any actual cross-origin requests. It's been a minute since I've run into this issue but I'm guessing your development server publishes on 127.0.0.1 and you're opening up localhost and the browser thinks it's a cross-origin request because localhost != 127.0.0.1. I use 127.0.0.1 for everything and don't have these issues.

@ryneeverett Oooh great point, somehow I thought the logic was a little smarter than string matching and knew that localhost was the same thing. In that case I'll just change the code that opens up a browser window automatically to load the right URL. Thank you!!

The issue is that the ports are different, so it is an issue.

Concerning the pip intall issue: I suspect there is something left over from your previous build attempts, please clear everything (like egg-info stuff).

Hehe yeah I just gave it a try specifying exactly "localhost" on both and the different port still cause the strings to not match.

Thank you for the hints on pip, I will look into it and document myself a little better. :-)

Confirming that removing the netviel.egg-info directory solves the pip user-limited install. So running the backend should probably be this:

python3 -m pip install -e . --user && python3 -m netviel

Okay, I think this is a good start:

https://gist.github.com/lmanul/90ea91189ae0f37db506fb9adc6891f7

Would you like me to send you a pull request with this? Would you prefer me to add it as a separate page (and link it from the README), or as a new section at the bottom of the README directly?

Yes, very good.

Usually I would use the Wiki for this but just realized that one cannot have pull requests for Wikis; so I suggest to have a doc folder with documentation that is linked from the Readme.

Sent out a first version as PR #7 :-)