Bootstrap the repository with the basic machinery (#1)
- Make the project installable with pbr - Use tox to run tests, build docs, runserver - Flesh out the README a little bit - Real docs is WIP. Change-Id: I3dc92250cd93add0cdf11c6a67d8f1081560d4e1
This commit is contained in:
parent
3d42296683
commit
5fbbdac265
1
.gitignore
vendored
1
.gitignore
vendored
@ -46,6 +46,7 @@ nosetests.xml
|
|||||||
coverage.xml
|
coverage.xml
|
||||||
*,cover
|
*,cover
|
||||||
.hypothesis/
|
.hypothesis/
|
||||||
|
reports/
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
*.mo
|
*.mo
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
dist: trusty
|
|
||||||
sudo: required
|
|
||||||
language: python
|
|
||||||
python:
|
|
||||||
- 3
|
|
||||||
install: pip install -r requirements.txt
|
|
||||||
script: python manage.py test
|
|
23
README.md
23
README.md
@ -1,23 +0,0 @@
|
|||||||
# ara django
|
|
||||||
|
|
||||||
## requirements
|
|
||||||
|
|
||||||
python3
|
|
||||||
|
|
||||||
## install
|
|
||||||
|
|
||||||
create virtual env
|
|
||||||
|
|
||||||
./scripts/createvenv.sh
|
|
||||||
|
|
||||||
## start
|
|
||||||
|
|
||||||
run test server
|
|
||||||
|
|
||||||
./scripts/runserver.sh
|
|
||||||
|
|
||||||
then visit [http://127.0.0.1:8000/api/v1/](http://127.0.0.1:8000/api/v1/)
|
|
||||||
|
|
||||||
## tests
|
|
||||||
|
|
||||||
./scripts/test.sh
|
|
69
README.rst
Normal file
69
README.rst
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
ara-django
|
||||||
|
==========
|
||||||
|
|
||||||
|
.. image:: doc/source/_static/screenshot.png
|
||||||
|
|
||||||
|
An experiment with Django at the core of the ARA 1.0 backend.
|
||||||
|
This is not stable or production-ready.
|
||||||
|
|
||||||
|
If you are looking for ARA Records Ansible, the Ansible callback plugin and
|
||||||
|
reporting interface, you will find the repository here_.
|
||||||
|
|
||||||
|
We are prototyping outside the main repository due to the vast changes
|
||||||
|
involved and will merge back as appropriate.
|
||||||
|
|
||||||
|
.. _here: https://github.com/openstack/ara
|
||||||
|
|
||||||
|
Documentation
|
||||||
|
=============
|
||||||
|
|
||||||
|
*Work in progress*
|
||||||
|
|
||||||
|
This is python3 only right now.
|
||||||
|
|
||||||
|
**TL;DR**: Using tox is convenient for the time being::
|
||||||
|
|
||||||
|
# Use the source Luke
|
||||||
|
git clone https://github.com/dmsimard/ara-django
|
||||||
|
cd ara-django
|
||||||
|
|
||||||
|
# Install tox
|
||||||
|
pip install tox # (or the tox python library from your distro packages)
|
||||||
|
|
||||||
|
# Run test server -> http://127.0.0.1:8000/api/v1/
|
||||||
|
tox -e runserver
|
||||||
|
|
||||||
|
# Run actual tests or get coverage
|
||||||
|
tox -e pep8
|
||||||
|
tox -e py35
|
||||||
|
tox -e cover
|
||||||
|
|
||||||
|
# Build docs
|
||||||
|
tox -e docs
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
============
|
||||||
|
|
||||||
|
See contributors on GitHub_.
|
||||||
|
|
||||||
|
.. _GitHub: https://github.com/dmsimard/ara-django/graphs/contributors
|
||||||
|
|
||||||
|
Copyright
|
||||||
|
=========
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
Copyright (c) 2018 Red Hat, Inc.
|
||||||
|
|
||||||
|
ARA is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ARA is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
BIN
doc/source/_static/screenshot.png
Normal file
BIN
doc/source/_static/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
@ -1,3 +1,5 @@
|
|||||||
|
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||||
|
|
||||||
Django<2
|
Django<2
|
||||||
djangorestframework
|
djangorestframework
|
||||||
envparse
|
envparse
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
RED='\033[0;31m'
|
|
||||||
NOCOLOR='\033[0m'
|
|
||||||
|
|
||||||
if [ ! -f requirements.txt ]; then
|
|
||||||
echo -e "${RED}You seems to be in the wrong directory"
|
|
||||||
echo -e "Execute this script from the root of ara with ./scripts/${0##*/}${NOCOLOR}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -d "venv" ] && rm -rf venv
|
|
||||||
python3 -m venv venv
|
|
||||||
source venv/bin/activate
|
|
||||||
pip install -r requirements.txt
|
|
||||||
pip install -r test-requirements.txt
|
|
||||||
deactivate
|
|
@ -1,18 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
RED='\033[0;31m'
|
|
||||||
NOCOLOR='\033[0m'
|
|
||||||
|
|
||||||
if [ ! -f requirements.txt ]; then
|
|
||||||
echo -e "${RED}You seems to be in the wrong directory"
|
|
||||||
echo -e "Execute this script from the root of ara with ./scripts/${0##*/}${NOCOLOR}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
source venv/bin/activate
|
|
||||||
|
|
||||||
python manage.py migrate
|
|
||||||
python manage.py collectstatic --clear --no-input
|
|
||||||
DJANGO_DEBUG=1 python manage.py runserver
|
|
||||||
|
|
||||||
deactivate
|
|
@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
RED='\033[0;31m'
|
|
||||||
NOCOLOR='\033[0m'
|
|
||||||
|
|
||||||
if [ ! -f requirements.txt ]; then
|
|
||||||
echo -e "${RED}You seems to be in the wrong directory"
|
|
||||||
echo -e "Execute this script from the root of ara with ./scripts/${0##*/}${NOCOLOR}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
source venv/bin/activate
|
|
||||||
|
|
||||||
python manage.py test
|
|
||||||
|
|
||||||
deactivate
|
|
59
setup.cfg
Normal file
59
setup.cfg
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
[metadata]
|
||||||
|
name = ara-backend
|
||||||
|
summary = ARA Records Ansible backend
|
||||||
|
description-file =
|
||||||
|
README.rst
|
||||||
|
author = OpenStack Community
|
||||||
|
author-email = openstack-dev@lists.openstack.org
|
||||||
|
home-page = https://github.com/openstack/ara-backend
|
||||||
|
classifier =
|
||||||
|
Environment :: OpenStack
|
||||||
|
Intended Audience :: Information Technology
|
||||||
|
Intended Audience :: System Administrators
|
||||||
|
Intended Audience :: Developers
|
||||||
|
Topic :: Utilities
|
||||||
|
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
||||||
|
Operating System :: POSIX :: Linux
|
||||||
|
Programming Language :: Python
|
||||||
|
Programming Language :: Python :: 2
|
||||||
|
Programming Language :: Python :: 2.7
|
||||||
|
Programming Language :: Python :: 3
|
||||||
|
Programming Language :: Python :: 3.5
|
||||||
|
Development Status :: 4 - Beta
|
||||||
|
|
||||||
|
[global]
|
||||||
|
setup-hooks =
|
||||||
|
pbr.hooks.setup_hook
|
||||||
|
|
||||||
|
[files]
|
||||||
|
packages =
|
||||||
|
ara-backend
|
||||||
|
|
||||||
|
[build_sphinx]
|
||||||
|
source-dir = doc/source
|
||||||
|
build-dir = doc/build
|
||||||
|
all_files = 1
|
||||||
|
|
||||||
|
[upload_sphinx]
|
||||||
|
upload-dir = docs/html
|
||||||
|
|
||||||
|
[coverage:report]
|
||||||
|
ignore_errors = True
|
||||||
|
include =
|
||||||
|
ara/*
|
||||||
|
api/*
|
||||||
|
omit =
|
||||||
|
/usr*
|
||||||
|
setup.py
|
||||||
|
*egg*
|
||||||
|
.venv/*
|
||||||
|
|
||||||
|
[coverage:html]
|
||||||
|
directory = reports
|
||||||
|
|
||||||
|
[wheel]
|
||||||
|
universal = 1
|
||||||
|
|
||||||
|
[pbr]
|
||||||
|
skip_authors = True
|
||||||
|
skip_changelog = True
|
22
setup.py
Normal file
22
setup.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# Copyright (c) 2018 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# This file is part of ARA: Ansible Run Analysis.
|
||||||
|
#
|
||||||
|
# ARA is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# ARA is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['pbr'],
|
||||||
|
pbr=True)
|
@ -1 +1,6 @@
|
|||||||
factory-boy
|
factory-boy
|
||||||
|
bandit>=1.1.0 # Apache-2.0
|
||||||
|
coverage
|
||||||
|
flake8
|
||||||
|
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
|
||||||
|
sphinx-rtd-theme
|
||||||
|
52
tox.ini
Normal file
52
tox.ini
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
[tox]
|
||||||
|
minversion = 2.0
|
||||||
|
envlist = py35,pep8
|
||||||
|
skipdist = True
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
basepython = python3
|
||||||
|
sitepackages = False
|
||||||
|
usedevelop = True
|
||||||
|
install_command = pip install -U {opts} {packages} -c{env:CONSTRAINTS_FILE:/dev/null}
|
||||||
|
setenv = VIRTUAL_ENV={envdir}
|
||||||
|
deps = -r{toxinidir}/test-requirements.txt
|
||||||
|
|
||||||
|
[testenv:venv]
|
||||||
|
commands = {posargs}
|
||||||
|
|
||||||
|
[testenv:docs]
|
||||||
|
commands = sphinx-build -W -b html doc/source doc/build/html
|
||||||
|
|
||||||
|
[testenv:pep8]
|
||||||
|
commands =
|
||||||
|
flake8 ara api
|
||||||
|
bandit -r ara api
|
||||||
|
|
||||||
|
[testenv:py35]
|
||||||
|
commands = python manage.py test
|
||||||
|
|
||||||
|
[testenv:runserver]
|
||||||
|
commands =
|
||||||
|
python manage.py migrate
|
||||||
|
python manage.py collectstatic --clear --no-input
|
||||||
|
python manage.py runserver
|
||||||
|
setenv =
|
||||||
|
DJANGO_DEBUG=1
|
||||||
|
|
||||||
|
[testenv:cover]
|
||||||
|
commands =
|
||||||
|
coverage erase
|
||||||
|
coverage run {toxinidir}/manage.py test ara
|
||||||
|
coverage run -a {toxinidir}/manage.py test api
|
||||||
|
coverage html
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
# E123, E125 skipped as they are invalid PEP-8.
|
||||||
|
# E741, short ambiguous variable names
|
||||||
|
# H106 Don’t put vim configuration in source files
|
||||||
|
# H203 Use assertIs(Not)None to check for None
|
||||||
|
max-line-length = 120
|
||||||
|
ignore = E123,E125,E741
|
||||||
|
enable-extensions=H106,H203
|
||||||
|
show-source = True
|
||||||
|
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
Loading…
x
Reference in New Issue
Block a user