yhttp-dbmanager
A yhttp extension to create and remove database(s) using command line and
API.
Quickstart
Dependencies
Install postgresql brefore use of this project.
apt install postgresql
Prepare
Create and grant the postgresql role with createdb permission to
authenticate the current unix user within postgresql using the peer
authentication.
echo "CREATE USER ${USER} WITH CREATEDB" | sudo -u postgres psql
# Or
echo "ALTER USER ${USER} CREATEDB" | sudo -u postgres psql
Usage
Import and install the extension inside the roolup.py:
# foo/version.py
__version__ = '0.1.'
# foo/rollup.py
from yhttp.core import Application
from yhttp.ext import dbmanager
from .version import __version__
app = Application(__version__, 'foo')
# builtin settings
app.settings.merge('''
db:
url: postgres://:@/ticketing
```)
# install extensions
dbmanager.install(app)
# http handlers
from . import handlers
# foo/__init__.py
from .version import __version__
from .rollup import app
# setup.py
import re
from os.path import join, dirname
from setuptools import setup, find_packages
# reading package version (same way the sqlalchemy does)
with open(join(dirname(__file__), 'foo/version.py')) as v_file:
package_version = re.compile('.*__version__ = \'(.*?)\'', re.S).\
match(v_file.read()).group(1)
dependencies = [
'yhttp >= 7.0.1, < 8'
'yhttp-dbmanager >= 5.0.1, < 6'
]
setup(
name='foo',
version=package_version,
install_requires=dependencies,
packages=find_packages(
where='.',
exclude=['tests']
),
entry_points={
'console_scripts': [
'foo = foo:app.climain'
]
},
)
After installing the extension these command line interfaces will be available as as subcommand of your application command line interface:
foo db --help
Contribution
Dependencies
Install postgresql brefore use of this project.
apt install postgresql
Prepare
Create and grant the postgresql role with createdb permission to
authenticate the current unix user within postgresql using the peer
authentication.
echo "CREATE USER ${USER} WITH CREATEDB" | sudo -u postgres psql
# Or
echo "ALTER USER ${USER} CREATEDB" | sudo -u postgres psql
Virtualenv
Create virtual environment:
make venv
Delete virtual environment:
make venv-delete
Activate the virtual environment:
source ./activate.sh
Install (editable mode)
Install this project as editable mode and all other development dependencies:
make env
Tests
Execute all tests:
make test
Execute specific test(s) using wildcard:
make test F=tests/test_db*
make test F=tests/test_form.py::test_querystringform
refer to pytest documentation for more info about invoking tests.
Execute tests and report coverage result:
make cover
make cover F=tests/test_static.py
make cover-html
Lint
make lint
Distribution
Execute these commands to create Python's standard distribution packages
at dist directory:
make sdist
make wheel
Or
make dist
to create both sdidst and wheel packages.
Clean build directory
Execute:
make clean
to clean-up previous dist/* and build/* directories.
PyPI
WARNING: Do not do this if you'r not responsible as author and or maintainer of this project.
Execute
make clean
make pypi
to upload sdists and wheel packages on PyPI.
Metadata
Release files for yhttp-dbmanager 9.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| yhttp_dbmanager-9.2.0.tar.gz | 11.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yhttp_dbmanager-9.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.0 kB
Release files / yhttp_dbmanager-9.2.0.tar.gz
| Download URL | yhttp_dbmanager-9.2.0.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2be7577b8eaeb2314336bbd0a3263a55eb48846c33a758da2f0352558507adfa
|
|
BLAKE2b-256 checksum How to use checksums |
0be45876760213ebcc93d576714ef80b4f344a33e41780e112e850b868c92ff6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / yhttp_dbmanager-9.2.0-py3-none-any.whl
| Download URL | yhttp_dbmanager-9.2.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eb51bc0dd54fd170d92ca83ee7401faa6bcd0d08d62efa7a9dd285f743ff9729
|
|
BLAKE2b-256 checksum How to use checksums |
4ce29bc3e58ab7f7e9026c4b75102c6e7e941595132aa484406c4afa32b3825b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|