Skip to content
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

No serverpy #324

Merged
merged 13 commits into from
May 6, 2014
Merged

No serverpy #324

merged 13 commits into from
May 6, 2014

Conversation

pjz
Copy link
Contributor

@pjz pjz commented Apr 4, 2014

Fix #283 - remove server.py, fix code that relied on it, and remove execution.py also.

pjz added 2 commits April 21, 2014 14:38
Also fix up the testing client to instantiate Website
instead of Server
@chadwhitacre
Copy link
Contributor

I tried serving the docs so I could review the docs:

[aspen]$ python build.py docs
Traceback (most recent call last):
  File "env/bin/aspen", line 9, in <module>
    load_entry_point('aspen==0.30-dev', 'console_scripts', 'aspen')()
  File "/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/site-packages/pkg_resources.py", line 353, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/site-packages/pkg_resources.py", line 2321, in load_entry_point
    return ep.load()
  File "/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/site-packages/pkg_resources.py", line 2048, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
ImportError: No module named server
fabricate: 'aspen' exited with status 1
[aspen]$

@chadwhitacre
Copy link
Contributor

It's weird that we still use argv to configure even though we aren't a cli anymore. I guess that gets ripped out after this lands.

@pjz
Copy link
Contributor Author

pjz commented Apr 22, 2014

Yeah, it's currently ignored, though I guess it doesn't have to be - other modules take args from the cmdline. As long as we're also configurable from the environment and/or a config file, it's fine, I think.

@chadwhitacre
Copy link
Contributor

pid-37703 thread-140735299662208 (MainThread) project_root set to /Users/whit537/personal/gittip/aspen-python/doc/.aspen.
Traceback (most recent call last):
  File "/Users/whit537/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Users/whit537/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/whit537/personal/gittip/aspen-python/aspen/__main__.py", line 26, in <module>
    make_server('0.0.0.0', 8080, Website()).serve_forever()
  File "aspen/website.py", line 35, in __init__
  File "aspen/configuration/__init__.py", line 275, in configure
  File "/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/site-packages/pkg_resources.py", line 2048, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/site-packages/aspen_tornado_renderer.py", line 2, in <module>
    from aspen import renderers
ImportError: cannot import name renderers
fabricate: 'python' exited with status 1

@pjz
Copy link
Contributor Author

pjz commented Apr 25, 2014

Replicable from the commandline. Do python build.py clean docs, watch it fail, then to manually see it fail again do ./env/bin/python -m aspen -a:5370 -wdoc -pdoc/.aspen.

There's a hint in the fact that a simple ./env/bin/python -m aspen -a:5370 does NOT fail, but I'm too out of it to dig it out right now.

@chadwhitacre
Copy link
Contributor

Good find!

@pjz
Copy link
Contributor Author

pjz commented Apr 25, 2014

Also, putting an absolute path as an arg to -w doesn't help either.

@chadwhitacre
Copy link
Contributor

Confirmed that ./env/bin/python -m aspen -a:5370 doesn't fail while ./env/bin/python -m aspen -a:5370 -wdoc -pdoc/.aspen does.

@chadwhitacre
Copy link
Contributor

python -m aspen -a:5370 -wdoc fails!

@chadwhitacre
Copy link
Contributor

[aspen]$ python -m aspen -a:5370 
> /Users/whit537/personal/gittip/aspen-python/aspen/__main__.py(27)<module>()
-> make_server('0.0.0.0', 8080, Website()).serve_forever()
(Pdb) import sys
(Pdb) pp sys.path
['',
 '/Users/whit537/personal/gittip/aspen-python',
 '/Users/whit537/lib/python',
 '/Users/whit537/personal/gittip/aspen-python/lib/python',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python27.zip',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/plat-darwin',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/plat-mac',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/lib-tk',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/lib-old',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/lib-dynload',
 '/Users/whit537/lib/python2.7',
 '/Users/whit537/lib/python2.7/plat-darwin',
 '/Users/whit537/lib/python2.7/lib-tk',
 '/Users/whit537/lib/python2.7/plat-mac',
 '/Users/whit537/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/site-packages']
(Pdb)

@chadwhitacre
Copy link
Contributor

IRC, btw.

@chadwhitacre
Copy link
Contributor

[aspen]$ python -m aspen -a:5370 -wdoc
> /Users/whit537/personal/gittip/aspen-python/aspen/__main__.py(27)<module>()
-> make_server('0.0.0.0', 8080, Website()).serve_forever()
(Pdb) import sys
(Pdb) pp sys.path
['',
 '/Users/whit537/personal/gittip/aspen-python',
 '/Users/whit537/lib/python',
 '/Users/whit537/personal/gittip/aspen-python/lib/python',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python27.zip',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/plat-darwin',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/plat-mac',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/lib-tk',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/lib-old',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/lib-dynload',
 '/Users/whit537/lib/python2.7',
 '/Users/whit537/lib/python2.7/plat-darwin',
 '/Users/whit537/lib/python2.7/lib-tk',
 '/Users/whit537/lib/python2.7/plat-mac',
 '/Users/whit537/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Users/whit537/personal/gittip/aspen-python/env/lib/python2.7/site-packages']
(Pdb)

@chadwhitacre
Copy link
Contributor

So it looks like sys.path is the same for both. os.getcwd() is also the same.

@chadwhitacre
Copy link
Contributor

My hunch is that this is somehow related to the fact that we have a docs/aspen directory.

@chadwhitacre
Copy link
Contributor

(Pdb) l
  1     from __future__ import absolute_import
  2     import pdb; pdb.set_trace()
  3  -> from aspen import renderers
  4     from tornado.template import Loader, Template
  5     import os
  6     
  7     
  8     class Renderer(renderers.Renderer):
  9     
 10         def compile(self, filepath, raw):
 11             loader = self.meta
(Pdb) import aspen
(Pdb) from aspen import renderers
*** ImportError: cannot import name renderers
(Pdb) aspen.__file__
'aspen/__init__.py'
(Pdb) import os
(Pdb) os.getcwd()
'/Users/whit537/personal/gittip/aspen-python/doc'
(Pdb)

That's inside of the aspen_tornado_renderer.py at the bottom of the traceback.

@chadwhitacre
Copy link
Contributor

Why is getcwd() different there than above?

@pjz
Copy link
Contributor Author

pjz commented Apr 30, 2014

@chadwhitacre
Copy link
Contributor

Yeah, but the question is why the chdir call is interacting badly with the python -m machinery.

@chadwhitacre
Copy link
Contributor

If I cd into env (could be any other directory besides the repo root) and then do python -m aspen -a:8537 -w../doc it works fine. That indicates that the presence of the aspen directory in the repo root is implicated in the confusion.

@chadwhitacre
Copy link
Contributor

We decided to take stop calling chdir at all. That fixes the behavior we're seeing here and fits with the theme of not being an app server anymore. If someone wants their simplates to have a certain cwd then they should call chdir themselves. IRC

pjz and others added 2 commits April 30, 2014 14:51
Calling chdir() was causing an issue serving the docs,
and had the potential to cause many more. Let's just Not Do That.
We stopped calling chdir automatically as part of our inversion effort
(we're a library, not a framework).
No two ways about it: if we're going to be "just a WSGI library" then we
can't implement Socket.IO ourselves. Instead we'll have to figure out
how to use gevent-socketio or similar. That rebuilding step is on the
other side of the Great Purge of 2014.
This rips out network_address and network_engine and the rest of
sockets.W
@chadwhitacre
Copy link
Contributor

IRC

Conflicts:
	aspen/__main__.py
	tests/test_sockets_transport.py
pjz added a commit that referenced this pull request May 6, 2014
@pjz pjz merged commit 45551f3 into master May 6, 2014
@pjz pjz deleted the no_serverpy branch May 6, 2014 19:48
@chadwhitacre chadwhitacre mentioned this pull request Nov 10, 2015
chadwhitacre added a commit that referenced this pull request Nov 10, 2015
We've only had one ever since we removed the server in #324.
Changaco pushed a commit that referenced this pull request Mar 10, 2016
We've only had one ever since we removed the server in #324.
Changaco pushed a commit that referenced this pull request Mar 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rip out server.py
2 participants