Skip to content

Commit 47d502c

Browse files
Antony BaileyAntony Bailey
authored andcommitted
docs, jekyll, and fix a deprecation in black
1 parent d5833ab commit 47d502c

File tree

8 files changed

+143
-19
lines changed

8 files changed

+143
-19
lines changed

.github/workflows/python-package.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,6 @@ jobs:
3636
black --check .
3737
- name: Test with pytest
3838
run: |
39+
# Make sure run_tests.sh is executable
40+
chmod +x ./run_tests.sh
3941
./run_tests.sh

API.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pySQLY API Documentation
22

3-
This document provides detailed information about the pySQLY API.
3+
This document provides detailed information about the pySQLY API for developers working with the library.
44

55
## Table of Contents
66

@@ -39,7 +39,7 @@ SQLYExecutor(datasource, db_type=None)
3939

4040
#### Methods
4141

42-
##### execute
42+
##### execute_query
4343

4444
```python
4545
execute(query: str) -> Any
@@ -82,7 +82,7 @@ where:
8282

8383
Handles parsing of SQLY query strings into structured dictionaries.
8484

85-
#### Methods
85+
#### SQLYParser Methods
8686

8787
##### parse
8888

@@ -122,7 +122,7 @@ parsed_query = SQLYParser.parse(query)
122122

123123
Utility functions for SQLY operations.
124124

125-
#### Methods
125+
#### SQLYUtils Methods
126126

127127
##### validate_query
128128

@@ -194,7 +194,7 @@ Abstract method that must be implemented by all connectors.
194194

195195
Base implementation of the IDBConnector interface.
196196

197-
#### Methods
197+
#### BaseDBConnector Methods
198198

199199
##### execute_query
200200

@@ -216,7 +216,7 @@ Executes raw SQL with parameters.
216216

217217
High-level connector that manages connections to various database types.
218218

219-
#### Constructor
219+
#### DatabaseConnector Constructor
220220

221221
```python
222222
DatabaseConnector(db_type, connection)
@@ -241,7 +241,7 @@ Executes a SQLY query against a specified database.
241241

242242
Factory class for creating database-specific connectors.
243243

244-
#### Methods
244+
#### DBConnectorFactory Methods
245245

246246
##### create_connector
247247

@@ -325,4 +325,11 @@ optional arguments:
325325
--version show program's version number and exit
326326
```
327327

328-
For more examples, see the [Examples](./EXAMPLES.md) document.
328+
## Related Resources
329+
330+
- [Main README](./README.md) - Overview and getting started
331+
- [Examples](./EXAMPLES.md) - Usage examples and patterns
332+
- [Design Document](./DESIGN.md) - Architecture and design decisions
333+
- [Security Policy](./SECURITY.md) - Security considerations
334+
- [Changelog](./CHANGELOG.md) - Version history and changes
335+
- [Contributing](./CONTRIBUTING.md) - How to contribute to pySQLY

CONTRIBUTING.md

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ Thank you for your interest in contributing to pySQLY! This document provides gu
88
- [Getting Started](#getting-started)
99
- [Development Workflow](#development-workflow)
1010
- [Coding Standards](#coding-standards)
11+
- [Documentation](#documentation)
1112
- [Testing](#testing)
1213
- [Submitting Changes](#submitting-changes)
1314
- [Issue Reporting](#issue-reporting)
15+
- [Versioning](#versioning)
1416

1517
## Code of Conduct
1618

@@ -38,14 +40,12 @@ This project adheres to a [Code of Conduct](CODE_OF_CONDUCT.md) that all contrib
3840
```bash
3941
python -m venv venv
4042
source venv/bin/activate # On Windows, use: venv\Scripts\activate
41-
pip install -e . # Install in development mode
42-
pip install -r requirements.txt
43+
pip install -e ".[dev]" # Install in development mode with development dependencies
4344
```
4445

4546
4. Set up pre-commit hooks:
4647

4748
```bash
48-
pip install pre-commit
4949
pre-commit install
5050
```
5151

@@ -84,11 +84,26 @@ pySQLY follows these coding standards:
8484

8585
These tools are configured in the project and run automatically with pre-commit hooks.
8686

87+
### Running the Linters
88+
89+
```bash
90+
# Format code with Black
91+
black src/ tests/
92+
93+
# Sort imports with isort
94+
isort src/ tests/
95+
96+
# Lint with Ruff
97+
ruff check src/ tests/
98+
```
99+
87100
## Documentation
88101

89102
- Use docstrings for all public modules, functions, classes, and methods
90103
- Follow [Google Style Python Docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html)
91104
- Update documentation when changing functionality
105+
- Add examples for new features
106+
- Keep the [API Documentation](./API.md) up to date with any changes
92107

93108
## Testing
94109

@@ -120,26 +135,47 @@ pytest --cov=pysqly
120135

121136
3. In your PR description:
122137
- Clearly describe the problem and solution
123-
- Include the relevant issue number if applicable
138+
- Include the relevant issue number if applicable (e.g., "Fixes #123")
124139
- Mention if it changes external behavior
140+
- Reference any related PRs or issues
141+
142+
4. Wait for the maintainers to review your PR. They may ask for changes before merging.
125143

126144
## Issue Reporting
127145

128146
- Use the GitHub issue tracker to report bugs or request features
147+
- Before submitting a new issue, check if it already exists
129148
- For bugs, include:
130149
- Steps to reproduce
131150
- Expected behavior
132151
- Actual behavior
133152
- Python and pySQLY versions
134153
- Operating system
135154
- Any relevant error messages or logs
155+
- Minimal code example that reproduces the issue
156+
157+
### Issue Templates
158+
159+
When creating a new issue, choose the appropriate template:
160+
161+
- Bug report: For reporting bugs or unexpected behavior
162+
- Feature request: For suggesting new features or improvements
163+
- Documentation issue: For reporting issues with documentation
136164

137165
## Versioning
138166

139167
We use [Semantic Versioning](https://semver.org/) for version numbers:
140168

141-
- MAJOR version for incompatible API changes
142-
- MINOR version for backward-compatible new features
143-
- PATCH version for backward-compatible bug fixes
169+
- MAJOR version for incompatible API changes (X.0.0)
170+
- MINOR version for backward-compatible new features (0.X.0)
171+
- PATCH version for backward-compatible bug fixes (0.0.X)
172+
173+
## Related Resources
174+
175+
- [README](./README.md) - Project overview
176+
- [Design Document](./DESIGN.md) - Architecture and design decisions
177+
- [Security Policy](./SECURITY.md) - Security guidelines
178+
- [Code of Conduct](./CODE_OF_CONDUCT.md) - Community standards
179+
- [Changelog](./CHANGELOG.md) - Version history
144180

145181
Thank you for contributing to pySQLY!

EXAMPLES.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pySQLY Examples
22

3-
This document provides examples of how to use pySQLY in various scenarios.
3+
This document provides practical examples of how to use pySQLY in various scenarios to simplify your database interactions.
44

55
## Table of Contents
66

@@ -9,6 +9,7 @@ This document provides examples of how to use pySQLY in various scenarios.
99
- [Working with Different Databases](#working-with-different-databases)
1010
- [CLI Examples](#cli-examples)
1111
- [Error Handling](#error-handling)
12+
- [Best Practices](#best-practices)
1213

1314
## Basic Queries
1415

@@ -231,4 +232,50 @@ except SQLYExecutionError as e:
231232
# Handle the error appropriately
232233
```
233234

234-
For more detailed API information, see the [API Documentation](./API.md).
235+
## Best Practices
236+
237+
### Connection Management
238+
239+
For better performance, reuse executor instances when making multiple queries:
240+
241+
```python
242+
# Create once, use many times
243+
executor = SQLYExecutor("database.db", "sqlite")
244+
245+
# Query 1
246+
users = executor.execute(user_query)
247+
248+
# Query 2
249+
products = executor.execute(product_query)
250+
```
251+
252+
### Error Handling Strategy
253+
254+
Implement a comprehensive error handling strategy:
255+
256+
```python
257+
from pysqly import SQLYExecutor, SQLYParseError, SQLYExecutionError, SQLYError
258+
259+
try:
260+
executor = SQLYExecutor("database.db", "sqlite")
261+
results = executor.execute(query)
262+
except SQLYParseError as e:
263+
# Handle parsing errors specifically
264+
logger.error(f"Invalid YAML syntax: {e}")
265+
except SQLYExecutionError as e:
266+
# Handle execution errors specifically
267+
logger.error(f"Database execution failed: {e}")
268+
except SQLYError as e:
269+
# Handle any other pySQLY errors
270+
logger.error(f"pySQLY error: {e}")
271+
except Exception as e:
272+
# Handle unexpected errors
273+
logger.critical(f"Unexpected error: {e}")
274+
```
275+
276+
## Related Resources
277+
278+
- [API Documentation](./API.md) - Detailed library API reference
279+
- [Design Document](./DESIGN.md) - Architecture and design patterns
280+
- [Security Policy](./SECURITY.md) - Security best practices
281+
- [Contributing](./CONTRIBUTING.md) - How to contribute to pySQLY

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ include README.md
33
include CHANGELOG.md
44
include CONTRIBUTING.md
55
include CODE_OF_CONDUCT.md
6+
include SECURITY.md
7+
include DESIGN.md
68
include API.md
79
include EXAMPLES.md
810
include pyproject.toml
911
include requirements.txt
12+
include run_tests.sh
1013

1114
recursive-include tests *.py

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ sqly-cli "select: [username, email]\nfrom: users\nwhere:\n - field: active\n
9595
- [API Documentation](./API.md) - Detailed library API reference
9696
- [Examples](./EXAMPLES.md) - More usage examples and patterns
9797
- [Contributing](./CONTRIBUTING.md) - Guidelines for contributing to pySQLY
98+
- [Code of Conduct](./CODE_OF_CONDUCT.md) - Our community standards
99+
- [Security Policy](./SECURITY.md) - Reporting vulnerabilities and security practices
100+
- [Design Document](./DESIGN.md) - Architecture and design patterns
98101
- [Changelog](./CHANGELOG.md) - Version history and changes
99102

100103
## Project Structure
@@ -141,6 +144,8 @@ pySQLY/
141144
├── EXAMPLES.md # Usage examples
142145
├── CONTRIBUTING.md # Contribution guidelines
143146
├── CODE_OF_CONDUCT.md # Code of conduct
147+
├── SECURITY.md # Security policy
148+
├── DESIGN.md # Architecture design
144149
└── CHANGELOG.md # Version history
145150
```
146151

@@ -162,6 +167,14 @@ where:
162167
163168
See the [Examples](./EXAMPLES.md) document for more complex query patterns.
164169
170+
## Why Choose pySQLY?
171+
172+
- **Simplified Database Access**: Write database queries in a more readable format
173+
- **Database Agnostic**: Switch between database systems without changing your query syntax
174+
- **Reduced SQL Injection Risk**: Parameter binding is handled automatically
175+
- **Improved Productivity**: Less boilerplate code and more intuitive query structure
176+
- **Easy Integration**: Works with your existing Python applications
177+
165178
## License
166179
167180
pySQLY is distributed under the [MIT License](LICENSE).

_config.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,25 @@ remote_theme: pages-themes/architect@v0.2.0
22
plugins:
33
- jekyll-remote-theme
44
- jekyll-seo-tag
5+
- jekyll-sitemap
56

67
# Site settings
78
title: Python Standard Query Language (pySQLY) Documentation
8-
description: A powerful Python library for standardized SQL querying
9+
description: "A powerful Python library for standardized SQL querying with YAML syntax - simplify database interactions across SQLite, MySQL, PostgreSQL, Oracle and MS SQL Server"
10+
author: Standard Query Language
11+
lang: en_US
912
show_downloads: true
1013
google_analytics: # Add your GA tracking ID here if needed
1114

15+
# SEO settings
16+
twitter:
17+
username: pysqly
18+
card: summary
19+
social:
20+
name: pySQLY
21+
links:
22+
- https://github.com/Standard-Query-Language/pySQLY
23+
1224
# Theme customization
1325
colors:
1426
header: "#2E7BCF"
@@ -23,6 +35,8 @@ nav:
2335
url: /
2436
- title: Documentation
2537
url: /docs/
38+
- title: API Reference
39+
url: /api/
2640
- title: Examples
2741
url: /examples/
2842
- title: GitHub

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ multi_line_output = 3
6363

6464
[tool.ruff]
6565
line-length = 88
66+
target-version = "py39"
67+
68+
[tool.ruff.lint]
6669
select = ["E", "F", "I", "N", "B", "W"]
6770
ignore = ["E203"]
68-
target-version = "py39"

0 commit comments

Comments
 (0)