Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/testing' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Kaiser committed Nov 18, 2020
2 parents af064cd + 4660c4c commit a576fe5
Show file tree
Hide file tree
Showing 19 changed files with 231 additions and 171 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/mysql.yml
@@ -0,0 +1,65 @@
name: MySQL

on:
push:
branches: [ master, testing, stable ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]

# Service containers to run with `runner-job`
services:
# Label used to access the service container
mysql:
image: mariadb:latest
env:
MYSQL_USER: kotti
MYSQL_PASSWORD: kotti
MYSQL_DATABASE: kotti
MYSQL_ROOT_PASSWORD: kotti
options: >-
--health-cmd="mysqladmin ping"
--health-interval=5s
--health-timeout=2s
--health-retries=3
ports:
# Maps tcp port 3306 on service container to the host
- 3306:3306

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[testing]"
pip install mysqlclient
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Verify MySQL connection
env:
PORT: ${{ job.services.mysql.ports[3306] }}
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do
sleep 1
done
- name: Test with pytest
run: |
pytest
env:
KOTTI_TEST_DB_STRING: mysql://kotti:kotti@127.0.0.1:3306/kotti

57 changes: 57 additions & 0 deletions .github/workflows/postgres.yml
@@ -0,0 +1,57 @@
name: PostgreSQL

on:
push:
branches: [ master, testing, stable ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]

# Service containers to run with `runner-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[testing]"
pip install psycopg2-binary
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
env:
KOTTI_TEST_DB_STRING: postgresql://postgres:postgres@localhost:5432/postgres

38 changes: 38 additions & 0 deletions .github/workflows/sqlite.yml
@@ -0,0 +1,38 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
name: SQLite

on:
push:
branches: [ master, testing, stable ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[testing]"
pip install psycopg2-binary
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

7 changes: 7 additions & 0 deletions CHANGES.txt
@@ -1,6 +1,13 @@
Change History
==============

2.0.3 - 2020-11-18
------------------

- Upgrade to ``pytest>=6``.
- Replace ``pytest-pep8`` with ``pytest-flake8``; fix or silence flake8 warnings/errors
in existing code (mostly tests and migrations).

2.0.2 - 2020-06-22
------------------

Expand Down
2 changes: 1 addition & 1 deletion COPYRIGHT.txt
@@ -1,2 +1,2 @@
Copyright (c) 2010-2019 Daniel Nouri, Andreas Kaiser and Contributors.
Copyright (c) 2010-2020 Daniel Nouri, Andreas Kaiser and Contributors.
All Rights Reserved
32 changes: 25 additions & 7 deletions README.rst
Expand Up @@ -4,16 +4,26 @@ Kotti

|pypi|_
|license|_
|build_status_stable|_

|build_status_stable_postgresql|_
|build_status_stable_mysql|_
|build_status_stable_sqlite|_

.. |pypi| image:: https://img.shields.io/pypi/v/Kotti.svg?style=flat-square
.. _pypi: https://pypi.python.org/pypi/Kotti/

.. |license| image:: https://img.shields.io/pypi/l/Kotti.svg?style=flat-square
.. _license: http://www.repoze.org/LICENSE.txt

.. |build_status_stable| image:: https://img.shields.io/travis/Kotti/Kotti/stable.svg?style=flat-square
.. _build_status_stable: http://travis-ci.org/Kotti/Kotti
.. |build_status_stable_postgresql| image:: https://github.com/Kotti/Kotti/workflows/PostgreSQL/badge.svg?branch=stable
.. _build_status_stable_postgresql: https://github.com/Kotti/Kotti/actions?query=workflow%3APostgreSQL+branch%3Astable

.. |build_status_stable_mysql| image:: https://github.com/Kotti/Kotti/workflows/MySQL/badge.svg?branch=stable
.. _build_status_stable_mysql: https://github.com/Kotti/Kotti/actions?query=workflow%3AMySQL+branch%3Astable

.. |build_status_stable_sqlite| image:: https://github.com/Kotti/Kotti/workflows/SQLite/badge.svg?branch=stable
.. _build_status_stable_sqlite: https://github.com/Kotti/Kotti/actions?query=workflow%3ASQLite+branch%3Astable


Kotti is a high-level, Pythonic web application framework based on Pyramid_ and SQLAlchemy_.
It includes an extensible Content Management System called the Kotti CMS (see below).
Expand Down Expand Up @@ -90,7 +100,10 @@ If you think you found a bug, open an issue on our `Github bugtracker <https://g
Development
===========

|build_status_master|_
|build_status_master_postgresql|_
|build_status_master_mysql|_
|build_status_master_sqlite|_

|coveralls|_
|codacy|_
|codeclimate|_
Expand All @@ -105,9 +118,14 @@ We adhere to `high quality coding standards`_, have an extensive test suite with

Contributions are always welcome, read our `contribution guidelines`_ and visit our `Github repository`_.

.. |build_status_master| image:: https://img.shields.io/travis/Kotti/Kotti/master.svg?style=flat-square
.. _build_status_master: http://travis-ci.org/Kotti/Kotti
.. _continuous integration: http://travis-ci.org/Kotti/Kotti
.. |build_status_master_postgresql| image:: https://github.com/Kotti/Kotti/workflows/PostgreSQL/badge.svg?branch=master
.. _build_status_master_postgresql: https://github.com/Kotti/Kotti/actions?query=workflow%3APostgreSQL+branch%3Amaster

.. |build_status_master_mysql| image:: https://github.com/Kotti/Kotti/workflows/MySQL/badge.svg?branch=master
.. _build_status_master_mysql: https://github.com/Kotti/Kotti/actions?query=workflow%3AMySQL+branch%3Amaster

.. |build_status_master_sqlite| image:: https://github.com/Kotti/Kotti/workflows/SQLite/badge.svg?branch=master
.. _build_status_master_sqlite: https://github.com/Kotti/Kotti/actions?query=workflow%3ASQLite+branch%3Amaster

.. |requires.io| image:: https://img.shields.io/requires/github/Kotti/Kotti.svg?style=flat-square
.. _requires.io: https://requires.io/github/Kotti/Kotti/requirements/?branch=master
Expand Down
18 changes: 13 additions & 5 deletions docs/first_steps/overview.rst
Expand Up @@ -67,24 +67,32 @@ Use this command:
git clone git@github.com:Kotti/Kotti
`Continuous testing`_ against different versions of Python and with *PostgreSQL*, *MySQL* and *SQLite* and a complete test coverage make Kotti a **stable** platform to work with. |build_status|_
`Continuous testing`_ against different versions of Python and with *PostgreSQL*, *MySQL* and *SQLite* and a complete test coverage make Kotti a **stable** platform to work with.

|build_status_stable_postgresql|_
|build_status_stable_mysql|_
|build_status_stable_sqlite|_

Support
-------

- Python 3.5-3.7
- Python 3.6-3.9
- Support for PostgreSQL, MySQL and SQLite (tested regularly), and a list of `other SQL databases`_
- Support for WSGI and a `variety of web servers`_, including Apache


.. _repoze.workflow: http://docs.repoze.org/workflow/
.. _Chameleon: https://chameleon.readthedocs.io/
.. _Colander: http://docs.pylonsproject.org/projects/colander/en/latest/
.. _continuous testing: http://travis-ci.org/Kotti/Kotti
.. _continuous testing: https://github.com/Kotti/Kotti/actions
.. _Deform: http://docs.pylonsproject.org/projects/deform/en/latest/
.. _developed on Github: https://github.com/Kotti/Kotti
.. |build_status| image:: https://secure.travis-ci.org/Kotti/Kotti.png?branch=master
.. _build_status: http://travis-ci.org/Kotti/Kotti
.. |build_status_stable_postgresql| image:: https://github.com/Kotti/Kotti/workflows/PostgreSQL/badge.svg?branch=stable
.. _build_status_stable_postgresql: https://github.com/Kotti/Kotti/actions?query=workflow%3APostgreSQL+branch%3Astable
.. |build_status_stable_mysql| image:: https://github.com/Kotti/Kotti/workflows/MySQL/badge.svg?branch=stable
.. _build_status_stable_mysql: https://github.com/Kotti/Kotti/actions?query=workflow%3AMySQL+branch%3Astable
.. |build_status_stable_sqlite| image:: https://github.com/Kotti/Kotti/workflows/SQLite/badge.svg?branch=stable
.. _build_status_stable_sqlite: https://github.com/Kotti/Kotti/actions?query=workflow%3ASQLite+branch%3Astable
.. _installation:
.. _other SQL databases: http://www.sqlalchemy.org/docs/core/engines.html#supported-databases
.. _variety of web servers: http://wsgi.org/wsgi/Servers
8 changes: 6 additions & 2 deletions kotti/__init__.py
@@ -1,3 +1,5 @@
import os.path

import pkg_resources
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
Expand Down Expand Up @@ -167,7 +169,6 @@ def get_settings():


def _resolve_dotted(d, keys=conf_dotted):

resolved = d.copy()

for key in keys:
Expand Down Expand Up @@ -281,7 +282,10 @@ def includeme(config):
]:
config.override_asset(to_override="kotti", override_with=override)

config.add_translation_dirs("kotti:locale")
config.add_translation_dirs(f"{os.path.dirname(__file__)}/locale")
# used to be
# config.add_translation_dirs("kotti:locale")
# which fails with recent pytest (works in non testing though)

workflow = settings["kotti.use_workflow"]
if workflow.lower() not in FALSE_VALUES:
Expand Down
2 changes: 1 addition & 1 deletion kotti/alembic/env.py
Expand Up @@ -25,7 +25,7 @@ def run_migrations_online():
try:
context.run_migrations()
mark_changed(DBSession())
except:
except: # noqa: E722
traceback.print_exc()
transaction.abort()
else:
Expand Down
2 changes: 1 addition & 1 deletion kotti/alembic/versions/413fa5fcc581_add_filedepot.py
Expand Up @@ -75,7 +75,7 @@ def process(thing):
update = files.update().where(files.c.id == bindparam('nodeid')).\
values({files.c.data: bindparam('data')})

def chunks(l, n):
def chunks(l, n): # noqa: E741
for i in range(0, len(l), n):
yield l[i:i + n]

Expand Down
4 changes: 2 additions & 2 deletions kotti/migrate.py
Expand Up @@ -107,7 +107,7 @@ def _make_script_dir(alembic_cfg: Config) -> ScriptDirectoryWithDefaultEnvPy:

def get_locations() -> List[str]:
conf_str = get_settings()["kotti.alembic_dirs"]
return [l.strip() for l in conf_str.split() if l.strip()]
return [line.strip() for line in conf_str.split() if line.strip()]


def stamp_head(location: str = DEFAULT_LOCATION, revision: None = None) -> None:
Expand Down Expand Up @@ -170,7 +170,7 @@ def upgrade_all():


def list_all():
pkg_envs = [PackageEnvironment(l) for l in get_locations()]
pkg_envs = [PackageEnvironment(location) for location in get_locations()]
for pkg_env in pkg_envs:
print(f"{pkg_env.pkg_name}:")

Expand Down

0 comments on commit a576fe5

Please sign in to comment.