Permalink
Browse files

Initial import

  • Loading branch information...
Guillaume Gauvrit
Guillaume Gauvrit committed Dec 13, 2012
1 parent 9e3b8b9 commit 76c52f40a7ed722b5f5c0fb753ecbf7ef08580ef
Showing with 2,416 additions and 2 deletions.
  1. +3 −1 .gitignore
  2. +8 −0 CHANGES.txt
  3. +24 −0 LICENSE
  4. +2 −0 MANIFEST.in
  5. +75 −1 README.md
  6. +82 −0 development.ini
  7. +6 −0 message-extraction.ini
  8. +82 −0 production.ini
  9. +42 −0 pyshop/__init__.py
  10. 0 pyshop/assets/sass/00_vars.scss
  11. 0 pyshop/assets/sass/01_macro.scss
  12. 0 pyshop/assets/sass/02_reset.scss
  13. 0 pyshop/assets/sass/10_layout.scss
  14. +5 −0 pyshop/assets/sass/index.scss
  15. +62 −0 pyshop/bin/install.py
  16. +60 −0 pyshop/bin/shell.py
  17. +137 −0 pyshop/config.py
  18. 0 pyshop/helpers/__init__.py
  19. +60 −0 pyshop/helpers/authentication.py
  20. +55 −0 pyshop/helpers/download.py
  21. +23 −0 pyshop/helpers/i18n.py
  22. +22 −0 pyshop/helpers/pypi.py
  23. +10 −0 pyshop/helpers/restxt.py
  24. +142 −0 pyshop/helpers/sqla.py
  25. +25 −0 pyshop/helpers/task.py
  26. +19 −0 pyshop/locale/fr/LC_MESSAGES/pyshop.po
  27. +19 −0 pyshop/locale/pyshop.pot
  28. +296 −0 pyshop/models.py
  29. +31 −0 pyshop/resources.py
  30. +27 −0 pyshop/security.py
  31. BIN pyshop/static/favicon.ico
  32. BIN pyshop/static/pyramid-small.png
  33. BIN pyshop/static/pyramid.png
  34. +7 −0 pyshop/templates/macro/nav.html
  35. +8 −0 pyshop/templates/pyshop/layout.html
  36. +5 −0 pyshop/templates/pyshop/nav.html
  37. +40 −0 pyshop/templates/pyshop/package/list.html
  38. +44 −0 pyshop/templates/pyshop/package/show.html
  39. +4 −0 pyshop/templates/pyshop/simple/list.html
  40. +15 −0 pyshop/templates/pyshop/simple/show.html
  41. +20 −0 pyshop/templates/shared/base_layout.html
  42. +8 −0 pyshop/templates/shared/footer_buttons.html
  43. +15 −0 pyshop/templates/shared/form_layout.html
  44. +75 −0 pyshop/templates/shared/layout.html
  45. +23 −0 pyshop/templates/shared/login.html
  46. +20 −0 pyshop/views/__init__.py
  47. +71 −0 pyshop/views/base.py
  48. +68 −0 pyshop/views/credentials.py
  49. +6 −0 pyshop/views/json/__init__.py
  50. +70 −0 pyshop/views/json/pypi.py
  51. +30 −0 pyshop/views/package.py
  52. +24 −0 pyshop/views/repository.py
  53. +227 −0 pyshop/views/simple.py
  54. +223 −0 pyshop/views/xmlrpc.py
  55. +21 −0 setup.cfg
  56. +75 −0 setup.py
View
@@ -1,4 +1,5 @@
*.py[cod]
__pycache__
# C extensions
*.so
@@ -10,7 +11,6 @@ dist
build
eggs
parts
bin
var
sdist
develop-eggs
@@ -33,3 +33,5 @@ nosetests.xml
.mr.developer.cfg
.project
.pydevproject
/repository/*
View
@@ -0,0 +1,8 @@
0.1
---
- Initial version.
vital functionnality:
- work with pip, setuptools
- mirror package
- secure access with login password
View
24 LICENSE
@@ -0,0 +1,24 @@
Copyright (c) 2012, Guillaume Gauvrit
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
@@ -0,0 +1,2 @@
include *.txt *.ini *.cfg *.rst
recursive-include waterfall *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml
View
@@ -1,4 +1,78 @@
pyshop
======
A cheeseshop clone (PyPI server) written in pyramid
A cheeseshop clone (PyPI server) written in pyramid
Getting Started
---------------
.. code-block: bash
$ virtualenv pyshop
$ cd pyshop
(pyshop)$ source bin/activate
(pyshop)$ pip install git+https://github.com/mardiros/pyshop.git
(pyshop)$ initialize_pyshop_db development.ini
(pyshop)$ pserve development.ini
For production usage, you should create a user pyshop
with restriction right.
For editing permission, the web user interface is not ready.
You can use the pyshop shell.
(pyshop)$ pyshop_shell
The upload on PyPI will be done when the project is more advanced.
Configuring your environment to use that new PyShop
---------------------------------------------------
Here is a all configuration files by usual python tools.
~/.pip/pip.conf
~~~~~~~~~~~~~~~
Configuration used by pip
.. code-block: ini
[install]
index-url = http://admin:changeme@localhost:6543/simple/
~/.pypirc
~~~~~~~~~
Configuration used by setuptools to upload package
.. code-block: ini
[distutils]
index-servers =
pyshop
[pyshop]
username: admin
password: changeme
repository: http://localhost:6543/simple/
setup.cfg
~~~~~~~~~
.. code-block: ini
[easy_install]
index-url = http://admin:changeme@localhost:6543/simple/
Uploading a file to PyShop
--------------------------
python setup.py sdist upload -v -r pyshop
View
@@ -0,0 +1,82 @@
[app:main]
use = egg:pyshop
pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
pyramid.includes =
pyramid_tm
pyramid_jinja2
pyramid_scss
pyramid_xmlrpc
pyramid_debugtoolbar
pyshop
jinja2.directories = pyshop:templates
jinja2.i18n.domain = pyshop
scss.asset_path = pyshop:assets/sass
scss.compress = false
scss.cache = false
sqlalchemy.url = sqlite:///%(here)s/pyshop.db
sqlalchemy.echo = false
#sqlalchemy.pool_size = 1
tm.commit_veto = pyramid_tm.default_commit_veto
xmlrpc.encoding = 'utf-8'
xmlrpc.allow_none = True
xmlrpc.datetime = True
pypi.url = http://pypi.python.org/pypi
repository.root = %(here)s/repository/
cookie_key = secret
[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543
# Begin logging configuration
[loggers]
keys = root, pyshop, sqlalchemy
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = INFO
handlers = console
[logger_pyshop]
level = DEBUG
handlers =
qualname = pyshop
[logger_sqlalchemy]
level = INFO
handlers =
qualname = sqlalchemy.engine
# "level = INFO" logs SQL queries.
# "level = DEBUG" logs SQL queries and results.
# "level = WARN" logs neither. (Recommended for production systems.)
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
# End logging configuration
View
@@ -0,0 +1,6 @@
[python: **.py]
encoding = utf-8
[jinja2: **/templates/**.html]
encoding = utf-8
extensions=jinja2.ext.autoescape,jinja2.ext.with_
View
@@ -0,0 +1,82 @@
[app:main]
use = egg:pyshop
pyramid.reload_templates = false
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
pyramid.includes =
pyramid_tm
pyramid_jinja2
pyramid_scss
pyramid_xmlrpc
pyramid_debugtoolbar
pyshop
jinja2.directories = pyshop:templates
jinja2.i18n.domain = pyshop
scss.asset_path = pyshop:assets/sass
scss.compress = false
scss.cache = false
sqlalchemy.url = sqlite:///%(here)s/pyshop.db
sqlalchemy.echo = false
#sqlalchemy.pool_size = 1
tm.commit_veto = pyramid_tm.default_commit_veto
xmlrpc.encoding = 'utf-8'
xmlrpc.allow_none = True
xmlrpc.datetime = True
pypi.url = http://pypi.python.org/pypi
repository.root = %(here)s/repository/
cookie_key = secret
[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543
# Begin logging configuration
[loggers]
keys = root, pyshop, sqlalchemy
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
[logger_pyshop]
level = WARN
handlers =
qualname = pyshop
[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
# "level = INFO" logs SQL queries.
# "level = DEBUG" logs SQL queries and results.
# "level = WARN" logs neither. (Recommended for production systems.)
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
# End logging configuration
View
@@ -0,0 +1,42 @@
import sys
from pyramid.config import Configurator
from pyramid.authorization import ACLAuthorizationPolicy as ACLPolicy
from pyramid.authentication import AuthTktAuthenticationPolicy as AuthPolicy
from .security import groupfinder
# used by pyramid
from .config import includeme
from .models import create_engine
from .helpers.i18n import locale_negotiator
from .helpers.authentication import RouteSwithchAuthPolicy
__version__ = '0.1'
def main(global_config, **settings):
"""Get a PyShop WSGI application configured with settings.
"""
settings = dict(settings)
if 'celery' in sys.argv[0]:
# XXX celery must config sqlalchemy engine AFTER forkin consumer
config = Configurator(settings=settings)
else:
# Scoping sessions for Pyramid ensure session are commit/rollback
# after the template has been rendered
create_engine(settings, scoped=True)
authn_policy = RouteSwithchAuthPolicy(secret=settings['cookie_key'],
callback=groupfinder)
authz_policy = ACLPolicy()
config = Configurator(settings=settings,
root_factory='pyshop.resources.RootFactory',
locale_negotiator=locale_negotiator,
authentication_policy=authn_policy,
authorization_policy=authz_policy)
config.end()
return config.make_wsgi_app()
No changes.
No changes.
No changes.
No changes.
@@ -0,0 +1,5 @@
@import 00_vars.scss;
@import 01_macro.scss;
@import 02_reset.scss;
@import 10_layout.scss;
Oops, something went wrong.

0 comments on commit 76c52f4

Please sign in to comment.