Skip to content

Commit 8e2c04b

Browse files
committed
Add project boilerplate
0 parents  commit 8e2c04b

File tree

8 files changed

+389
-0
lines changed

8 files changed

+389
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/.idea
2+
/.venv*
3+
/dist
4+
*.egg-info
5+
*.pyc
6+
__pycache__
7+
/.coverage
8+
/coverage.xml

.proselintrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"checks": {
3+
"annotations.misc": false,
4+
"typography.symbols": false
5+
}
6+
}

CHANGES.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#########
2+
Changelog
3+
#########
4+
5+
6+
in progress
7+
===========
8+
9+
10+
2023-03-22 0.1.0
11+
================
12+
- First release

DEVELOP.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.. highlight: console
2+
3+
#######################
4+
Development information
5+
#######################
6+
7+
8+
The test suite demonstrates the use of the "relaxed" variants of SQLAlchemy's
9+
builtin PostgreSQL support by connecting to databases which are protocol
10+
compatible with PostgreSQL.
11+
12+
Currently, `CrateDB`_ is used. The easiest way to provide an instance to the
13+
test suite, is::
14+
15+
docker run --rm -it --publish=4200:4200 --publish=5432:5432 crate/crate:nightly
16+
17+
18+
For installing the package inside a development sandbox (virtualenv), run::
19+
20+
git clone https://github.com/daq-tools/sqlalchemy-postgresql-relaxed
21+
cd sqlalchemy-postgresql-relaxed
22+
python3 -m venv .venv
23+
source .venv/bin/activate
24+
pip install --editable=.[develop,test]
25+
26+
To run all validation steps (linter, software tests), invoke::
27+
28+
poe check
29+
30+
31+
32+
.. _CrateDB: https://github.com/crate/crate

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright 2023 SQLAlchemy community contributors.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7+
of the Software, and to permit persons to whom the Software is furnished to do
8+
so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include CHANGES.rst LICENSE README.rst
2+
recursive-include doc *.rst

README.rst

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
.. image:: https://github.com/daq-tools/sqlalchemy-postgresql-relaxed/workflows/Tests/badge.svg
2+
:target: https://github.com/daq-tools/sqlalchemy-postgresql-relaxed/actions?workflow=Tests
3+
4+
.. image:: https://codecov.io/gh/daq-tools/sqlalchemy-postgresql-relaxed/branch/main/graph/badge.svg
5+
:target: https://codecov.io/gh/daq-tools/sqlalchemy-postgresql-relaxed
6+
:alt: Test suite code coverage
7+
8+
.. image:: https://pepy.tech/badge/sqlalchemy-postgresql-relaxed/month
9+
:target: https://pepy.tech/project/sqlalchemy-postgresql-relaxed
10+
11+
.. image:: https://img.shields.io/pypi/v/sqlalchemy-postgresql-relaxed.svg
12+
:target: https://pypi.org/project/sqlalchemy-postgresql-relaxed/
13+
14+
.. image:: https://img.shields.io/pypi/status/sqlalchemy-postgresql-relaxed.svg
15+
:target: https://pypi.org/project/sqlalchemy-postgresql-relaxed/
16+
17+
.. image:: https://img.shields.io/pypi/pyversions/sqlalchemy-postgresql-relaxed.svg
18+
:target: https://pypi.org/project/sqlalchemy-postgresql-relaxed/
19+
20+
.. image:: https://img.shields.io/pypi/l/sqlalchemy-postgresql-relaxed.svg
21+
:target: https://github.com/daq-tools/sqlalchemy-postgresql-relaxed/blob/main/LICENSE
22+
23+
|
24+
25+
##########################################
26+
Relaxed PostgreSQL dialects for SQLAlchemy
27+
##########################################
28+
29+
30+
*****
31+
About
32+
*****
33+
34+
The vanilla dialects for connecting to PostgreSQL with SQLAlchemy will employ
35+
a few behaviors that strictly expect a PostgreSQL server on the other end.
36+
However, some operations may croak on databases which only offer
37+
wire-compatibility with PostgreSQL.
38+
39+
The dialects provided by ``sqlalchemy-postgresql-relaxed`` are building upon
40+
the vanilla SQLAlchemy dialects, but will disable a few PostgreSQL specifics.
41+
42+
- ``postgresql+psycopg``: Accept non-conforming server version responses.
43+
- ``postgresql+psycopg``: Don't issue ``SHOW STANDARD_CONFORMING_STRINGS`` inquiry.
44+
- ``postgresql+asyncpg``: Don't strictly expect JSON and JSONB codecs.
45+
46+
47+
*****
48+
Usage
49+
*****
50+
51+
The corresponding dialect identifiers are:
52+
53+
- ``postgresql+psycopg_relaxed``
54+
- ``postgresql+asyncpg_relaxed``
55+
56+
They can be used within SQLAlchemy database URL identifiers as usual.
57+
58+
.. code-block:: python
59+
60+
# psycopg synchronous
61+
create_engine(
62+
url="postgresql+psycopg_relaxed://crate@localhost/acme",
63+
isolation_level="AUTOCOMMIT",
64+
use_native_hstore=False)
65+
66+
# psycopg asynchronous
67+
create_async_engine(
68+
url="postgresql+psycopg_relaxed://crate@localhost/acme",
69+
isolation_level="AUTOCOMMIT",
70+
use_native_hstore=False)
71+
72+
# asyncpg
73+
create_async_engine(
74+
url="postgresql+asyncpg_relaxed://crate@localhost/acme",
75+
isolation_level="AUTOCOMMIT")
76+
77+
78+
*****
79+
Setup
80+
*****
81+
::
82+
83+
pip install --upgrade sqlalchemy-postgresql-relaxed
84+
85+
To install the latest development version from the repository, invoke::
86+
87+
pip install --upgrade git+https://github.com/daq-tools/sqlalchemy-postgresql-relaxed
88+
89+
90+
*******************
91+
Project information
92+
*******************
93+
94+
Contributions
95+
=============
96+
97+
Every kind of contribution, feedback, or patch, is much welcome. `Create an
98+
issue`_ or submit a patch if you think we should include a new feature, or to
99+
report or fix a bug.
100+
101+
Development
102+
===========
103+
104+
In order to setup a development environment on your workstation, please head over
105+
to the `development sandbox`_ documentation. When you see the software tests succeed,
106+
you should be ready to start hacking.
107+
108+
Resources
109+
=========
110+
111+
- `Source code repository <https://github.com/daq-tools/sqlalchemy-postgresql-relaxed>`_
112+
- `Documentation <https://github.com/daq-tools/sqlalchemy-postgresql-relaxed/blob/main/README.rst>`_
113+
- `Python Package Index (PyPI) <https://pypi.org/project/sqlalchemy-postgresql-relaxed/>`_
114+
115+
License and warranty
116+
====================
117+
118+
The project is licensed under the terms of the MIT license, see `LICENSE`_.
119+
120+
121+
.. _Create an issue: https://github.com/daq-tools/sqlalchemy-postgresql-relaxed/issues/new
122+
.. _development sandbox: https://github.com/daq-tools/sqlalchemy-postgresql-relaxed/blob/main/DEVELOP.rst
123+
.. _LICENSE: https://github.com/daq-tools/sqlalchemy-postgresql-relaxed/blob/main/LICENSE

pyproject.toml

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# ==================
2+
# Project definition
3+
# ==================
4+
5+
# Derived from https://peps.python.org/pep-0621/
6+
7+
[project]
8+
name = "sqlalchemy-postgresql-relaxed"
9+
version = "0.0.0"
10+
description = "Relaxed PostgreSQL dialects for SQLAlchemy"
11+
readme = "README.rst"
12+
keywords = [
13+
"dialect",
14+
"postgresql",
15+
"sqlalchemy",
16+
]
17+
license = {text = "MIT"}
18+
authors = [
19+
{name = "Andreas Motl", email = "andreas.motl@panodata.org"},
20+
]
21+
requires-python = ">=3.7"
22+
classifiers = [
23+
"Development Status :: 4 - Beta",
24+
"Environment :: Console",
25+
"Intended Audience :: Customer Service",
26+
"Intended Audience :: Developers",
27+
"Intended Audience :: Education",
28+
"Intended Audience :: Information Technology",
29+
"Intended Audience :: Manufacturing",
30+
"Intended Audience :: Science/Research",
31+
"Intended Audience :: System Administrators",
32+
"Intended Audience :: Telecommunications Industry",
33+
"License :: OSI Approved :: MIT License",
34+
"Operating System :: MacOS :: MacOS X",
35+
"Operating System :: Microsoft :: Windows",
36+
"Operating System :: POSIX :: Linux",
37+
"Operating System :: Unix",
38+
"Programming Language :: Python",
39+
"Programming Language :: Python :: 3.7",
40+
"Programming Language :: Python :: 3.8",
41+
"Programming Language :: Python :: 3.9",
42+
"Programming Language :: Python :: 3.10",
43+
"Programming Language :: Python :: 3.11",
44+
"Topic :: Communications",
45+
"Topic :: Database",
46+
"Topic :: Documentation",
47+
"Topic :: Education",
48+
"Topic :: Office/Business",
49+
"Topic :: Scientific/Engineering",
50+
"Topic :: Software Development :: Code Generators",
51+
"Topic :: Software Development :: Libraries",
52+
"Topic :: Software Development :: Testing",
53+
"Topic :: System :: Archiving",
54+
"Topic :: System :: Systems Administration",
55+
"Topic :: Text Processing",
56+
"Topic :: Utilities",
57+
]
58+
dependencies = [
59+
"asyncpg",
60+
"psycopg[binary]",
61+
"sqlalchemy>=2",
62+
]
63+
[project.optional-dependencies]
64+
develop = [
65+
"black<24",
66+
"isort<6",
67+
"poethepoet<0.19",
68+
"proselint==0.13",
69+
"pyproject-fmt<0.10",
70+
"ruff==0.0.253",
71+
"validate-pyproject<0.13",
72+
]
73+
release = [
74+
"build<1",
75+
'minibump<1; python_version >= "3.10"',
76+
"twine<5",
77+
]
78+
test = [
79+
"pytest<8",
80+
"pytest-asyncio<1",
81+
"pytest-cov<5",
82+
]
83+
[project.urls]
84+
changelog = "https://github.com/daq-tools/sqlalchemy-postgresql-relaxed/blob/main/CHANGES.rst"
85+
documentation = "https://github.com/daq-tools/sqlalchemy-postgresql-relaxed"
86+
homepage = "https://github.com/daq-tools/sqlalchemy-postgresql-relaxed"
87+
repository = "https://github.com/daq-tools/sqlalchemy-postgresql-relaxed"
88+
89+
[tool.setuptools.packages]
90+
find = {}
91+
92+
[tool.black]
93+
line-length = 120
94+
95+
[tool.isort]
96+
profile = "black"
97+
line_length = 120
98+
multi_line_output = 3
99+
100+
[tool.pytest.ini_options]
101+
minversion = "2.0"
102+
addopts = "-rsfEX -p pytester --strict-markers --verbosity=3 --cov --cov-report=term-missing --cov-report=xml"
103+
log_level = "DEBUG"
104+
testpaths = ["testing"]
105+
xfail_strict = true
106+
markers = [
107+
]
108+
109+
[tool.coverage.run]
110+
omit = [
111+
"tests/*",
112+
]
113+
114+
[tool.coverage.report]
115+
fail_under = 0
116+
show_missing = true
117+
118+
[tool.ruff]
119+
line-length = 120
120+
121+
select = [
122+
# Bandit
123+
"S",
124+
# Bugbear
125+
"B",
126+
# Builtins
127+
"A",
128+
# comprehensions
129+
"C4",
130+
# eradicate
131+
"ERA",
132+
# flake8-2020
133+
"YTT",
134+
# isort
135+
"I",
136+
# pandas-vet
137+
"PD",
138+
# print
139+
"T20",
140+
# Pycodestyle
141+
"E",
142+
"W",
143+
# Pyflakes
144+
"F",
145+
# return
146+
"RET",
147+
]
148+
149+
[tool.ruff.per-file-ignores]
150+
"tests/*" = ["S101"] # Use of `assert` detected
151+
152+
153+
# ===================
154+
# Tasks configuration
155+
# ===================
156+
157+
[tool.poe.tasks]
158+
159+
check = [
160+
"lint",
161+
"test",
162+
]
163+
164+
format = [
165+
{ cmd = "black ." },
166+
{ cmd = "isort ." },
167+
# Configure Ruff not to auto-fix (remove!) unused variables (F841) and `print` statements (T201).
168+
{ cmd = "ruff --fix --ignore=ERA --ignore=F401 --ignore=F841 --ignore=T20 ." },
169+
{ cmd = "pyproject-fmt pyproject.toml" },
170+
]
171+
172+
lint = [
173+
{ cmd = "ruff check ." },
174+
{ cmd = "black --check ." },
175+
{ cmd = "isort --check ." },
176+
{ cmd = "validate-pyproject pyproject.toml" },
177+
{ cmd = "proselint *.rst doc/**.rst" },
178+
# { cmd = "mypy" },
179+
]
180+
181+
release = [
182+
{ cmd = "minibump bump --relax minor" },
183+
{ cmd = "python -m build" },
184+
{ cmd = "twine upload --skip-existing --verbose dist/*.tar.gz dist/*.whl" },
185+
]
186+
187+
test = { cmd = "pytest" }

0 commit comments

Comments
 (0)