Skip to content
This repository was archived by the owner on Nov 11, 2023. It is now read-only.

Commit c6c33b1

Browse files
authored
Merge pull request #24 from darbiadev/release
Release 1.0
2 parents c02c302 + c24d1ea commit c6c33b1

File tree

5 files changed

+65
-93
lines changed

5 files changed

+65
-93
lines changed

docs/source/conf.py

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
"""Sphinx configuration"""
2-
3-
from __future__ import annotations
4-
5-
# Configuration file for the Sphinx documentation builder.
6-
# This file only contains a selection of the most common options. For a full
7-
# list see the documentation:
8-
# https://www.sphinx-doc.org/en/master/usage/configuration.html
1+
"""Sphinx configuration file"""
92

103
import os
114
import sys
125

136
import toml
147

8+
# Configuration file for the Sphinx documentation builder.
9+
#
10+
# For the full list of built-in configuration values, see the documentation:
11+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
12+
1513
sys.path.insert(0, os.path.abspath("../.."))
1614

1715
project_config = toml.load("../../pyproject.toml")
@@ -20,31 +18,22 @@
2018
git_url: str = project_config["project"]["urls"]["repository"]
2119
copyright: str = project_config["tool"]["sphinx"]["copyright"] # noqa: A001
2220
author: str = project_config["tool"]["sphinx"]["author"]
23-
api_dir: str = project_config["tool"]["sphinx"]["api_dir"]
2421

2522
# Add any Sphinx extension module names here, as strings. They can be
2623
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
2724
# ones.
2825
extensions = [
2926
"sphinx.ext.autodoc",
30-
"sphinx.ext.doctest",
3127
"sphinx.ext.linkcode",
32-
"sphinx.ext.autosummary",
33-
"sphinx.ext.coverage",
34-
"sphinx.ext.todo",
3528
"sphinx.ext.intersphinx",
3629
"sphinx.ext.napoleon",
37-
"sphinxcontrib.autoprogram",
30+
"autoapi.extension",
3831
]
3932

40-
apidoc_module_dir: str = f"../../{api_dir}"
41-
4233
autoapi_type: str = "python"
43-
autoapi_dirs: list[str] = [apidoc_module_dir]
44-
45-
autosummary_generate: bool = True
34+
autoapi_dirs: list[str] = ["../../src"]
4635

47-
add_module_names: bool = True
36+
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
4837

4938
# Add any paths that contain templates here, relative to this directory.
5039
templates_path: list[str] = ["_templates"]
@@ -58,7 +47,7 @@
5847

5948
# The theme to use for HTML and HTML Help pages. See the documentation for
6049
# a list of builtin themes.
61-
html_theme: str = "sphinx_rtd_theme"
50+
html_theme: str = "furo"
6251

6352
# Add any paths that contain custom static files (such as style sheets) here,
6453
# relative to this directory. They are copied after the builtin static files,
@@ -105,4 +94,4 @@ def linkcode_resolve(domain, info):
10594
except (OSError, TypeError):
10695
pass
10796

108-
return f"{git_url}/blob/main/{filename}"
97+
return f"{git_url}/blob/main/src/{filename}"

docs/source/index.rst

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
1-
.. darbiadev-onsite documentation master file, created by
2-
sphinx-quickstart on Thu Jul 29 19:22:15 2021.
3-
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
5-
6-
Welcome to darbiadev-onsite's documentation!
7-
============================================
1+
darbiadev-onsite
2+
================
83

94
.. toctree::
105
:maxdepth: 2
116
:caption: Contents:
12-
13-
14-
15-
Indices and tables
16-
==================
17-
18-
* :ref:`genindex`
19-
* :ref:`modindex`
20-
* :ref:`search`

pyproject.toml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "darbiadev-onsite"
3-
version = "0.14.0"
3+
version = "1.0.0"
44
description = "Access OnSite data through FileMaker's JDBC integration"
55
authors = [
66
{ name = "Bradley Reynolds", email = "bradley.reynolds@darbia.dev" },
@@ -9,7 +9,7 @@ license = { text = "MIT" }
99
readme = "README.md"
1010
requires-python = ">=3.9"
1111
dependencies = [
12-
"JayDeBeApi>=1.2.3",
12+
"JayDeBeApi",
1313
]
1414

1515
[project.urls]
@@ -18,19 +18,18 @@ documentation = "https://docs.darbia.dev/darbiadev-onsite/"
1818

1919
[project.optional-dependencies]
2020
dev = [
21-
"pylint>=2.12.2",
22-
"pytest>=6.2.5",
23-
"pytest-cov>=3.0.0",
24-
"black>=21.12b0",
21+
"black",
22+
"isort",
23+
"pylint",
2524
]
2625
tests = [
27-
"pytest>=6.2.5",
26+
"pytest",
2827
]
2928
docs = [
30-
"sphinx>=4.3.2",
31-
"sphinxcontrib-autoprogram>=0.1.7",
32-
"sphinx-rtd-theme>=1.0.0",
33-
"toml>=0.10.2",
29+
"sphinx",
30+
"furo",
31+
"sphinx-autoapi",
32+
"toml",
3433
]
3534

3635
[tool.setuptools.package-data]

src/darbiadev_onsite/__init__.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,44 @@
11
"""Access OnSite data through FileMaker's JDBC integration"""
22

3-
from .lib import OnSiteServices
3+
from __future__ import annotations
4+
5+
from importlib.resources import files
6+
7+
import jaydebeapi
8+
9+
10+
class OnSiteServices: # pylint: disable=too-few-public-methods
11+
"""A class wrapping an ODBC connection to OnSite.
12+
13+
This class wraps an ODBC connection to OnSite.
14+
"""
15+
16+
def __init__(self, connection_url: str, username: str, password: str):
17+
self._connection_url: str = connection_url
18+
self.__username: str = username
19+
self.__password: str = password
20+
21+
def _connect(
22+
self,
23+
):
24+
return jaydebeapi.connect(
25+
"com.filemaker.jdbc.Driver",
26+
self._connection_url,
27+
[self.__username, self.__password],
28+
str(files("darbiadev_onsite").joinpath("vendor/fmjdbc.jar")),
29+
)
30+
31+
def make_query(
32+
self,
33+
sql: str,
34+
parameters: tuple[str | int, ...] | None,
35+
) -> list[dict[str, str | int | float]]:
36+
"""Make a query to the OnSite DB(s)"""
37+
if parameters is None:
38+
parameters = ()
39+
with self._connect() as connection:
40+
cursor = connection.cursor()
41+
cursor.execute(sql, parameters)
42+
43+
columns = [column[0] for column in cursor.description]
44+
return [dict(zip(columns, row)) for row in cursor.fetchall()]

src/darbiadev_onsite/lib.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)