From 05da45f2715468ec4394777f97c16c9af4c74888 Mon Sep 17 00:00:00 2001 From: Jens Kleineheismann Date: Mon, 9 Sep 2024 11:56:38 +0200 Subject: [PATCH] Modernize the meta files of the project --- INSTALL.rst | 31 ++++++++++++++++++------------- Makefile | 20 -------------------- README.rst | 4 +++- requirements.txt | 6 ++++++ setup.py | 33 +++------------------------------ tox.ini | 29 ++++++++++++++++++++++++----- 6 files changed, 54 insertions(+), 69 deletions(-) delete mode 100644 Makefile create mode 100644 requirements.txt diff --git a/INSTALL.rst b/INSTALL.rst index f20a374..008ec8a 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -1,12 +1,11 @@ REQUIREMENTS ============ -- Python 3 -- Python package virtualenv (in most cases this is distributed or installed together with python) -- Django (will be installed automatically) -- Several additional django related python packages (will be installed automatically) +- Python >= 3 +- Django and some other python packages, that will be installed throughout + the installation process For production use you surly want a real web server that supports WSGI -(e.g. Apache httpd with mod_wsgi) and a real Database like PostgreSQL. +(e.g. Apache httpd with mod_wsgi) and a real Database like PostgreSQL (psycopg2). QUICK INSTALLATION FOR THE IMPATIENT @@ -24,14 +23,11 @@ INSTALLATION It is strongly recommended to create a separated python environment for this django project. But it is not exactly necessary. -The creation of a separated python environment is very easy with the -virtualenv tool (a python package). - If you decide to not use virtualenv, proceed with step 2. - Create the python environment in a directory called ./env/python: - ``virtualenv --prompt="(dav)" ./env/python`` + ``python -m venv --prompt="(dav)" ./env/python`` - If you use a posix compatible shell (like bash, the linux default shell), you have to activate the environment for the current shell session @@ -50,16 +46,25 @@ If you have left the session or deactivated the environment and want to reactivate the environment (e.g. to execute a python command) use the previous ``source ...`` command. -2. Install files ----------------- +2. Install requirements +----------------------- + +- ``python -m pip install -r requirements.txt`` + +3. Install project code in development mode +------------------------------------------- + +- ``python -m pip install -e .`` + +4. Setup django project directory +--------------------------------- -- ``python setup.py develop`` - ``django-dav-events-admin setup ./env/django`` The django project directory ('./env/django' within the previous example) will be called *project root* for now on. -3. Enable modules +5. Enable modules ----------------- Our web application consist of several modules, that care about single aspects of the whole picture. diff --git a/Makefile b/Makefile deleted file mode 100644 index d2b8c8b..0000000 --- a/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -PYTHON := python - -DEPLOY_DIR ?= /var/www/wsgi/django-dav-events - -.PHONY: default help test deploy - -default: help - -help: - @echo "The make stuff is used by our CI/CD buildbot." - -test: - tox - -deploy: - git -C "$(DEPLOY_DIR)/src/django-dav-events" pull - "$(DEPLOY_DIR)/python/bin/python" "$(DEPLOY_DIR)/django/manage.py" migrate --noinput - "$(DEPLOY_DIR)/python/bin/python" "$(DEPLOY_DIR)/django/manage.py" collectstatic --noinput - touch "$(DEPLOY_DIR)/django/main/wsgi.py" - diff --git a/README.rst b/README.rst index b1d97bc..12cb170 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,8 @@ ABOUT ===== -This is the DAV Events django project. +django-dav-events is a django based web app to drive the +"Touren- & Kurseportal" of +"Sektion Karlsruhe im Deutschen Alpenverein (DAV) e.V." REQUIREMENTS diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d457057 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +babel +django<3.3 +django-bootstrap3 +django-countries +django-datetime-widget2 +setuptools diff --git a/setup.py b/setup.py index dd31e5a..a5a38e8 100644 --- a/setup.py +++ b/setup.py @@ -6,17 +6,7 @@ from setuptools import setup, find_packages from setuptools import Command -class MyCommand(Command): - user_options = [] - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - -class SetupPythonEnvironment(MyCommand): +class SetupPythonEnvironment(Command): description = 'create a (virtual) python environment' def run(self): @@ -54,7 +44,7 @@ class SetupPythonEnvironment(MyCommand): print('- All others: source %s/bin/activate' % path) -class QuickSetup(MyCommand): +class QuickSetup(Command): description = 'create a typical installation for developing' def run(self): @@ -94,7 +84,7 @@ class QuickSetup(MyCommand): setup( name='django-dav-events', - version='2.1.2', + version='2.2.1', description='A django based web application project to organize DAV Events.', url='https://dev.heinzelwerk.de/git/DAV-KA/django-dav-events', author='Jens Kleineheismann', @@ -105,26 +95,9 @@ setup( }, packages=find_packages(), include_package_data=True, - test_suite='tests.test_suite', entry_points={ 'console_scripts': [ 'django-dav-admin = dav_base.console_scripts.admin:main', ], }, - install_requires=[ - 'babel', - #'django >= 1.11, < 2.0', - 'django >= 1.11, < 3.3', - # 'django-extensions', - 'django-bootstrap3', - 'django-countries', - 'django-datetime-widget2', - 'pytz', - 'selenium', - 'setuptools', - 'coverage', - ], - extras_require={ - 'production': ['psycopg2'], - }, ) diff --git a/tox.ini b/tox.ini index a04e348..510b9e5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,29 @@ [tox] -envlist = py311, py312 +envlist = fresh, coverage [testenv] -recreate = false setenv = PYTHONPATH = . -commands = python --version - python -m coverage run tests - coverage report --skip-covered +deps = -r{toxinidir}/requirements.txt + selenium +commands_pre = python --version + python -m django --version +commands = python tests + +[testenv:fast] +description = Only run the testsuite + +[testenv:fresh] +description = Run tests in freshly created environment (with coverage) +recreate = true +deps = {[testenv]deps} + coverage +commands_pre = {[testenv]commands_pre} + python -m coverage --version +commands = python -m coverage run tests + +[testenv:coverage] +description = Report test coverage +deps = {[testenv:fresh]deps} +commands = python -m coverage report --skip-covered +