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

Use up-to-date python libraries #155

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6.8
3.9
5 changes: 1 addition & 4 deletions app/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
import re

import glob2
from gears.exceptions import ImproperlyConfigured, FileNotFound
from gears.utils import safe_join

from gears.environment import Environment, DEFAULT_PUBLIC_ASSETS
from gears.environment import Environment
from gears.finders import FileSystemFinder
from gears_libsass import LibsassCompiler
from gears_coffeescript import CoffeeScriptCompiler
from gears_handlebars import HandlebarsCompiler
from gears_uglifyjs import UglifyJSCompressor
from gears_clean_css import CleanCSSCompressor

from . import env
Expand Down
4 changes: 2 additions & 2 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def read(name, load_env_key=False):
# Try to use the libyaml loader
config = yaml.load(f, Loader=yaml.CLoader)
except (AttributeError):
config = yaml.load(f)
config = yaml.load(f, Loader=yaml.SafeLoader)

if load_env_key:
return config[env.name]
Expand Down Expand Up @@ -70,6 +70,6 @@ def read_secret(name, default=None):
# Try to use the libyaml loader
_secrets = yaml.load(f, Loader=yaml.CLoader)
except (AttributeError):
_secrets = yaml.load(f)
_secrets = yaml.load(f, Loader=yaml.SafeLoader)

return _secrets.get(name, default)
15 changes: 7 additions & 8 deletions app/lib/readme_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import textile
from creole import creole2html
from creole.rest2html.clean_writer import rest2html
from creole.rest_tools.clean_writer import rest2html
import misaka
from misaka import HtmlRenderer, SmartyPants
from misaka import HtmlRenderer
from pygments import highlight, lexers, formatters
from pygments.lexers import get_lexer_by_name
from pygments.formatters import HtmlFormatter
Expand Down Expand Up @@ -74,7 +74,7 @@ def render(readme_info):
return output


class _HighlighterRenderer(HtmlRenderer, SmartyPants):
class _HighlighterRenderer(HtmlRenderer):
def block_code(self, text, lang):
s = ''
if not lang:
Expand All @@ -93,8 +93,7 @@ def block_code(self, text, lang):


def _markdown(text):
render_flags = misaka.HTML_SKIP_STYLE
renderer = _HighlighterRenderer(flags=render_flags)
renderer = _HighlighterRenderer()

extensions = misaka.EXT_FENCED_CODE | misaka.EXT_NO_INTRA_EMPHASIS | \
misaka.EXT_TABLES | misaka.EXT_AUTOLINK | misaka.EXT_STRIKETHROUGH | \
Expand All @@ -113,13 +112,13 @@ def _markdown(text):
last_line_blank = True
lines = []
for line in text.splitlines():
if re.match('\s*(```|~~~)', line):
if re.match(r'\s*(```|~~~)', line):
if not in_block and not last_line_blank:
line = "\n" + line
in_block = True
else:
in_block = False
lines.append(line)
last_line_blank = re.match('^\s*$', line) != None
last_line_blank = re.match(r'^\s*$', line) != None

return md.render("\n".join(lines))
return md("\n".join(lines))
2 changes: 1 addition & 1 deletion development.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Development Environment

This site is built using Python 3.6.8, PostgreSQL 11, Redis and Nginx.
This site is built using Python 3.9, PostgreSQL 13, Redis and Nginx.

In addition, to install the lxml package, the following C libraries' development
header are necessary to be installed. Here are some example commands:
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ packages.

The Package Control website runs on an architecture of:

- Python 3.6.8
- PostgreSQL 11
- Python 3.9
- PostgreSQL 13
- nginx
- redis

Expand Down
74 changes: 74 additions & 0 deletions setup/linux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Linux System Setup

## Install

Nodejs is used for compiling handlebars and coffeescript files.

```bash
sudo apt install nodejs
```

Make sure we have Python 3 and tools to create a virtual environment for it.

```bash
sudo apt install python3 python3-venv python3-pip
```

Install PostgreSQL for the database.

```bash
sudo apt install postgresql
```

Install Redis for caching

```bash
sudo apt install redis
```

Install Nginx for the web server

```bash
sudo apt nginx-full nginx-extras
```

Install git for downloading `package_control_channel` for crawler

```bash
sudo apt git
```

For development

```bash
sudo apt install libxml2-dev libxslt-dev
```

## Setup

Register postgresql binary path by adding the following line to ~/.profile

```bash
if [ -d "/usr/postgresql/13/bin" ] ; then
PATH="/usr/postgresql/13/bin:$PATH"
fi
```

Create the `package_control` database and set up all of the tables.

```bash
createdb -U postgres -E 'UTF-8' package_control
psql -U postgres -d package_control -f sql/up.sql
```

Set up the virtual environment and install the packages.

```bash
python -m venv venv
pip install -r setup/requirements.txt
pip install -r setup/dev-requirements.txt
```

```bash
git clone --depth 1 https://github.com/wbond/package_control_channel channel
```
63 changes: 30 additions & 33 deletions setup/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
Cython==0.19.1
Markdown==2.3.1
PyMeta3==0.5.1
PyYAML==5.1
Pygments==1.6
WebOb==1.7.0rc1
bottle==0.11.6
docutils==0.10
dogpile.cache==0.5.0
dogpile.core==0.4.1
extras==1.0.0
fixtures==3.0.0
linecache2==1.0.0
lxml==3.8.0
misaka==1.0.2
pathlib==1.0.1
pbr==1.10.0
psycopg2-binary==2.7.6.1; sys_platform == 'darwin' --no-binary=psycopg2
psycopg2==2.7.6.1 ; sys_platform != 'darwin' --no-binary=psycopg2
pybars3==0.9.1
python-creole==1.2.2
python-dateutil==2.1
python-mimeparse==0.1.4
pytz==2013b
redis==2.7.6
regex==2016.11.21
requests==2.20.0
rollbar==0.8.1
six==1.10.0
testtools==2.2.0
textile==2.2.1
traceback2==1.4.0
unittest2==1.1.0
bottle
deathaxe marked this conversation as resolved.
Show resolved Hide resolved
Cython
docutils
dogpile.cache
extras
fixtures
linecache2
lxml
Markdown
misaka
pbr
psycopg2-binary
pybars3
Pygments
PyMeta3
python-creole
python-dateutil
python-mimeparse
pytz
PyYAML
redis
regex
requests
rollbar
six
testtools
textile
traceback2
unittest2
WebOb