Skip to content

Commit

Permalink
Merge pull request #8 from mkouhei/updates-dependencies
Browse files Browse the repository at this point in the history
Updates dependencies
  • Loading branch information
mkouhei committed May 17, 2020
2 parents 0821380 + fdf4e73 commit 345323c
Show file tree
Hide file tree
Showing 24 changed files with 97 additions and 204 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
@@ -1,5 +1,5 @@
[MASTER]
ignore=setup.py,docs/source/conf.py,utils,runapp.py
ignore=setup.py,utils,runapp.py

[MESSAGES CONTROL]
disable=
Expand Down
15 changes: 2 additions & 13 deletions .travis.yml
@@ -1,24 +1,13 @@
language: python
sudo: false

install:
- pip install coveralls tox
script:
- tox -e $TOX_ENV
- python setup.py check -r
after_success:
- coveralls --verbose

matrix:
include:
- python: 2.7
env: TOX_ENV=py27
- python: 3.5
env: TOX_ENV=py35
- python: 3.6
env: TOX_ENV=py36
- python: pypy
env: TOX_ENV=pypy
allow_failures:
- python: pypy3
env: TOX_ENV=pypy3
- python: 3.8
env: TOX_ENV=py38
6 changes: 3 additions & 3 deletions development.ini
@@ -1,6 +1,6 @@
###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/environment.html
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
###

[app:main]
Expand Down Expand Up @@ -33,13 +33,13 @@ password =
###

[server:main]
use = egg:waitress#main
use = egg:gunicorn#main
host = 0.0.0.0
port = 6543

###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/logging.html
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
###

[loggers]
Expand Down
3 changes: 2 additions & 1 deletion docs/source/conf.py
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
# pylint: skip-file
#
# pgraph documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 23 23:37:38 2014.
Expand Down Expand Up @@ -48,7 +49,7 @@

# General information about the project.
project = 'pgraph'
copyright = '2015, Kouhei Maeda <mkouhei@palmtb.net>'
copyright = '2015-2020, Kouhei Maeda <mkouhei@palmtb.net>'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
7 changes: 4 additions & 3 deletions docs/source/heroku.rst
Expand Up @@ -94,8 +94,9 @@ Use PostgreSQL as Celery backend

.. code-block:: shell
$ python setup.py --version
$ pip install --no-use-wheel -r requirements.txt -r heroku_requirements.txt
$ python -m venv /path/to/heroku-venv
$ . /path/to/heroku-venv
$ pip install -e . -e .[heroku]
4. Running celery worker.

Expand Down Expand Up @@ -136,7 +137,7 @@ Use RabbigMQ as Celery backend
.. code-block:: shell
$ python setup.py --version
$ pip install --no-use-wheel -r requirements.txt -r heroku_requirements.txt
$ pip install -e . -e .[heroku]
4. Running celery worker.

Expand Down
13 changes: 2 additions & 11 deletions docs/source/locally.rst
Expand Up @@ -30,24 +30,15 @@ How to run things locally

.. code-block:: shell
$ virtualenv /path/to/venv
$ python -m venv /path/to/venv
$ . /path/to/venv/bin/activate
5. Installing pgraph.

.. code-block:: shell
(venv)$ cd /path/to/pgraph
(venv)$ python setup.py develop
or

.. code-block:: shell
(venv)$ pip install --no-use-wheel pgraph
.. warning::
Not use ``pip install pgraph``. See also "`Known issue with the packages that depends on py-deps <http://py-deps.readthedocs.org/en/latest/README.html#known-issue-with-the-packages-that-depends-on-py-deps>`_".
(venv)$ pip install -e . -e .[development]
6. Running celery worker.
Expand Down
6 changes: 2 additions & 4 deletions heroku.ini
@@ -1,6 +1,6 @@
###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/environment.html
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
###

[app:main]
Expand All @@ -13,11 +13,9 @@ pyramid.debug_routematch = false
pyramid.default_locale_name = en

[celery]
#celery_result_backend = amqp
celery_result_backend = DATABASE_URL
celery_send_events = false
celery_event_queue_expires = 60
#broker_url = CLOUDAMQP_URL
broker_url = DATABASE_URL
broker_pool_limit = 1
broker_connection_timeout = 30
Expand All @@ -34,7 +32,7 @@ password = MEMCACHEDCLOUD_PASSWORD
###

[server:main]
use = egg:waitress#main
use = egg:gunicorn#main
host = 0.0.0.0
port = 6543

Expand Down
7 changes: 2 additions & 5 deletions pgraph/config.py
Expand Up @@ -2,10 +2,7 @@
"""pgraph.config module."""
import os
import sys
if sys.version_info < (3, 0):
import ConfigParser as configparser
else:
import configparser
import configparser


def load():
Expand All @@ -19,6 +16,6 @@ def load():
sys.stderr.write("Can't read file: {0}\n\n".format(config_file))
sys.exit(2)

config = configparser.SafeConfigParser()
config = configparser.ConfigParser()
config.read(config_file)
return config, config_file
13 changes: 7 additions & 6 deletions pgraph/tasks.py
Expand Up @@ -15,12 +15,13 @@
@APP.task
def gen_dependency(pkg_name, version):
"""Generate dependencies."""
return Package(pkg_name,
version=version,
cache_name=CACHE_NAME,
servers=MEMCACHED_SERVERS,
username=MEMCACHED_USERNAME,
password=MEMCACHED_PASSWORD)
pkg = Package(pkg_name,
version=version,
cache_name=CACHE_NAME,
servers=MEMCACHED_SERVERS,
username=MEMCACHED_USERNAME,
password=MEMCACHED_PASSWORD)
return pkg.draw(draw_type='linkdraw', link_prefix='/graph')


def read_cache(pkg_name, version):
Expand Down
2 changes: 1 addition & 1 deletion pgraph/templates/layout.pt
Expand Up @@ -40,7 +40,7 @@
</div>

<div class="collapse navbar-collapse" id="navbar-h">
<form tal:condition="python: request.path is not '/'"
<form tal:condition="python: request.path != '/'"
class="navbar-form navbar-left" action="/search">
<div class="form-group">
<input name="pkg_name" type="text" class="form-control"
Expand Down
32 changes: 11 additions & 21 deletions pgraph/views.py
Expand Up @@ -10,15 +10,12 @@


def get_ver(pkg_name):
"""package version."""
if 'PyPy' in sys.version and pkg_name == 'pylibmc':
version = ''
else:
version = pkg_resources.get_distribution(pkg_name).version
"""Get package version."""
version = pkg_resources.get_distribution(pkg_name).version
return version


class GraphViews(object):
class GraphViews:
"""Graph view class."""

def __init__(self, request):
Expand All @@ -40,12 +37,12 @@ def __init__(self, request):
# pylint: disable=unused-argument
@view_config(route_name='index', renderer='templates/index.pt')
def index(self):
"""index view."""
"""Index view."""
return self.meta

@view_config(route_name='config', renderer='templates/config.pt')
def config(self):
"""Configuration for Linkdraw."""
"""Configure for Linkdraw."""
self.request.response.content_type = 'application/javascript'
pkg_name = self.request.matchdict['pkg']
self.meta['pkg_name'] = pkg_name
Expand All @@ -61,11 +58,7 @@ def linkdraw(self):
self.meta['pkg_name'] = pkg_name
data = tasks.read_cache(pkg_name, version)
if data:
result = data.draw('linkdraw',
decode_type='json',
disable_time=True,
disable_descr=True,
link_prefix='/graph')
result = data.draw('linkdraw', link_prefix='/graph')
result['status'] = 200
else:
if task_id:
Expand All @@ -79,10 +72,7 @@ def linkdraw(self):
else:
if job.successful():
try:
result = job.result.draw('linkdraw',
decode_type='json',
disable_time=True,
disable_descr=True)
result = job.result
result['status'] = 200
except InvalidMetadata:
result = {'status': 500,
Expand All @@ -98,7 +88,7 @@ def linkdraw(self):

@view_config(route_name='graph', renderer='templates/graph.pt')
def graph(self):
"""drawing graph."""
"""Drawing graph."""
pkg_name = self.request.matchdict['pkg']
version = self.request.matchdict['version']
link = 'https://pypi.python.org/pypi/{0}/{1}'.format(pkg_name, version)
Expand All @@ -109,7 +99,7 @@ def graph(self):

@view_config(route_name='graph_latest', renderer='templates/graph.pt')
def graph_latest(self):
"""drawing graph."""
"""Drawing latest version graph."""
pkg_name = self.request.matchdict['pkg']
version = tasks.latest_version(pkg_name)
link = 'https://pypi.python.org/pypi/{0}/{1}'.format(pkg_name, version)
Expand All @@ -120,15 +110,15 @@ def graph_latest(self):

@view_config(route_name='search', renderer='templates/search.pt')
def search(self):
"""search package."""
"""Search package."""
pkg_name = self.request.GET.get('pkg_name')
self.meta['pkg_name'] = pkg_name
self.meta['results'] = tasks.search(pkg_name)
return self.meta

@view_config(context=BackendFailure, renderer='templates/error.pt')
def failed_backend(self):
"""backend failure error page."""
"""Backend failure error page."""
self.request.response.status = '500 Internal Server Error'
self.meta['title'] = self.request.response.status
self.meta['reason'] = 'PyPI: {}'.format(
Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
@@ -1,7 +1,7 @@
[pytest]
addopts =
-v
--flakes
--flake8
--cov pgraph
--cov-report=term
--cov-report=html
Expand Down
4 changes: 2 additions & 2 deletions run
@@ -1,4 +1,4 @@
#!/bin/sh -e

python setup.py develop
python runapp.py
pip install -e . -e .[heroku]
gunicorn --paste heroku.ini -b 0.0.0.0:5000 --log-level info
12 changes: 0 additions & 12 deletions runapp.py

This file was deleted.

2 changes: 1 addition & 1 deletion runtime.txt
@@ -1 +1 @@
python-3.5.1
python-3.8.2
30 changes: 10 additions & 20 deletions setup.py
Expand Up @@ -40,13 +40,9 @@ def run_tests(self):
"License :: OSI Approved :: "
"GNU General Public License v3 or later (GPLv3+)",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
]
Expand All @@ -58,27 +54,21 @@ def run_tests(self):

requires = ['pyramid',
'pyramid_chameleon',
'pyramid_debugtoolbar',
'waitress',
'gunicorn',
'setuptools>=46.0, <47.0',
'celery',
'webtest',
'mock']
if sys.version_info < (3, 3):
requires.append('funcsigs')

if hasattr(sys, 'pypy_version_info'):
requires.append('py-deps>=0.5.5')
else:
requires.append('py-deps[memcache]>=0.5.5')
'pip>=20.0, <21.0',
'py-deps==1.0.0']

extras_require = {
'development': ['pyramid_debugtoolbar',
'webtest',
'mock'],
'reST': ['Sphinx'],
'heroku': ['CherryPy',
'PasteScript',
'PasteDeploy',
'heroku': ['PasteDeploy',
'sqlalchemy',
'psycopg2',
'pylibmc',
'psycopg2',
'newrelic']}
if os.environ.get('READTHEDOCS', None):
extras_require['reST'].append('recommonmark')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,11 +1,7 @@
# -*- coding: utf-8 -*-
"""pgraph.tests.test_config module."""
import sys
import unittest
if sys.version_info < (3, 0):
from test.test_support import EnvironmentVarGuard
else:
from test.support import EnvironmentVarGuard
from test.support import EnvironmentVarGuard


class BackednConfigTests(unittest.TestCase):
Expand All @@ -16,7 +12,7 @@ def test_heroku_config(self):
"""Load configuration for Heroku."""
with EnvironmentVarGuard() as env:
env.set('CONFIG_FILE', 'heroku.ini')
from pgraph import backend_config as bconfig
from pgraph import backend_config as bconfig # pylint: disable=import-outside-toplevel
self.assertTrue(hasattr(bconfig, 'CELERY_RESULT_BACKEND'))
self.assertTrue(hasattr(bconfig, 'BROKER_URL'))
self.assertTrue(hasattr(bconfig, 'CELERY_SEND_EVENTS'))
Expand Down

0 comments on commit 345323c

Please sign in to comment.