Skip to content

Commit ec499ad

Browse files
Merge branch 'main' into fix/typo-readme-test-python-version
2 parents 0c0cc62 + 08a8fe3 commit ec499ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+5231
-1910
lines changed

.github/workflows/coverage.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Python Coverage
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
timeout-minutes: 3
10+
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.x'
19+
20+
- name: Run database server in docker
21+
run: |
22+
docker compose create
23+
docker compose start
24+
echo "wait mysql server"
25+
26+
while :
27+
do
28+
if mysql -h 127.0.0.1 --user=root --execute "SELECT version();" 2>&1 >/dev/null && mysql -h 127.0.0.1 --port=3307 --user=root --execute "SELECT version();" 2>&1 >/dev/null; then
29+
break
30+
fi
31+
sleep 1
32+
done
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install .
38+
pip install pytest coverage smokeshow
39+
40+
- name: Run coverage
41+
run: |
42+
coverage run -m pytest -k "not test_no_trailing_rotate_event and not test_end_log_pos and not test_query_event_latin1"
43+
coverage html
44+
45+
- run: smokeshow upload htmlcov
46+
env:
47+
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 60

.github/workflows/lint.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Lint
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v3
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.x' # This will install the latest version of Python 3
17+
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install ruff black
22+
23+
- name: Run lint script
24+
run: bash scripts/lint.sh

.github/workflows/pytest.yml

+27-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: PyTest
2-
on: [push, pull_request]
3-
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
env:
7+
PYTEST_SKIP_OPTION: "not test_no_trailing_rotate_event and not test_end_log_pos"
48
jobs:
59
test:
610
strategy:
@@ -13,14 +17,14 @@ jobs:
1317
- {name: 'Pypy 3.9', python: 'pypy-3.9'}
1418
name: ${{ matrix.name }}
1519
runs-on: ubuntu-latest
16-
timeout-minutes: 2
20+
timeout-minutes: 3
1721

1822
steps:
1923
- name: Check out code
20-
uses: actions/checkout@v2
24+
uses: actions/checkout@v4
2125

2226
- name: Setup Python
23-
uses: actions/setup-python@v2
27+
uses: actions/setup-python@v4
2428
with:
2529
python-version: ${{ matrix.python }}
2630

@@ -29,22 +33,34 @@ jobs:
2933
docker compose create
3034
docker compose start
3135
echo "wait mysql server"
32-
36+
3337
while :
3438
do
35-
if mysql -h 127.0.0.1 --user=root --execute "SELECT version();" 2>&1 >/dev/null && mysql -h 127.0.0.1 --port=3307 --user=root --execute "SELECT version();" 2>&1 >/dev/null; then
39+
if mysql -h 127.0.0.1 --user=root --execute "SELECT version();" 2>&1 >/dev/null && mysql -h 127.0.0.1 --port=3307 --user=root --execute "SELECT version();" 2>&1 >/dev/null; then
3640
break
3741
fi
3842
sleep 1
3943
done
40-
44+
4145
echo "run pytest"
4246
4347
- name: Install dependencies
4448
run: |
4549
pip install .
4650
pip install pytest
4751
48-
- name: Run test suite
49-
run: |
50-
pytest -k "not test_no_trailing_rotate_event and not test_end_log_pos"
52+
- name: Run tests for mysql-5
53+
working-directory: pymysqlreplication/tests
54+
run: pytest -k "$PYTEST_SKIP_OPTION" --db=mysql-5
55+
56+
- name: Run tests for mysql-5-ctl
57+
working-directory: pymysqlreplication/tests
58+
run: pytest -k "$PYTEST_SKIP_OPTION" --db=mysql-5-ctl
59+
60+
- name: Run tests for mysql-8
61+
working-directory: pymysqlreplication/tests
62+
run: pytest -k "$PYTEST_SKIP_OPTION" --db=mysql-8
63+
64+
- name: Run tests for mariadb-10
65+
working-directory: pymysqlreplication/tests
66+
run: pytest -k "$PYTEST_SKIP_OPTION" -m mariadb --db=mariadb-10

.mariadb/my.cnf

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ loose_file_key_management_filename = /opt/key_file/no_encryption_key.key
2020
# file_key_management_encryption_algorithm=aes_ctr
2121

2222
# Set encrypt_binlog
23-
encrypt_binlog=ON
23+
encrypt_binlog=ON

.mariadb/no_encryption_key.key

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1;dda0ccb18a28b0b4c2448b5f0217a134
1+
1;dda0ccb18a28b0b4c2448b5f0217a134

.mysql/dev.mysql.com.gpg.key

-1
Original file line numberDiff line numberDiff line change
@@ -435,4 +435,3 @@ Pw1yjWJT1IhUBBgRAgAMBQJOdz3tBQkT+wG4ABIHZUdQRwABAQkQjHGNO1By4fUU
435435
mwCbBYr2+bBEn/L2BOcnw9Z/QFWuhRMAoKVgCFm5fadQ3Afi+UQlAcOphrnJ
436436
=tUml
437437
-----END PGP PUBLIC KEY BLOCK-----
438-

.pre-commit-config.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
10+
- repo: https://github.com/astral-sh/ruff-pre-commit
11+
rev: v0.0.286
12+
hooks:
13+
- id: ruff
14+
args: [ --fix, --exit-non-zero-on-fix ]
15+
16+
- repo: https://github.com/psf/black
17+
rev: 23.7.0
18+
hooks:
19+
- id: black

.readthedocs.yaml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Read the Docs configuration file for Sphinx projects
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the OS, Python version and other tools you might need
8+
build:
9+
os: ubuntu-22.04
10+
tools:
11+
python: "3.11"
12+
# You can also specify other tool versions:
13+
# nodejs: "20"
14+
# rust: "1.70"
15+
# golang: "1.20"
16+
17+
# Build documentation in the "docs/" directory with Sphinx
18+
sphinx:
19+
configuration: docs/conf.py
20+
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
21+
# builder: "dirhtml"
22+
# Fail on all warnings to avoid broken references
23+
# fail_on_warning: true
24+
25+
# Optionally build your docs in additional formats such as PDF and ePub
26+
# formats:
27+
# - pdf
28+
# - epub
29+
30+
# Optional but recommended, declare the Python requirements required
31+
# to build your documentation
32+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
33+
# python:
34+
# install:
35+
# - requirements: docs/requirements.txt

CHANGELOG

+39-4
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
* PyMYSQL 0.7
8585
* Add more contributors
8686

87-
0.10 30/11/2016
87+
0.10 30/11/2016
8888
* row-events: TIME is now encoded as python.timedelta
8989
* Allow users to define ctl_connection_settings and the option to fail when table information is unavailable (#176)
9090
* Decode gtid from network packet
@@ -128,7 +128,7 @@
128128

129129
0.19 29/04/2019
130130
* Fix Insert NULL in a boolean column returns no rows #288
131-
* Added empty string support for enum
131+
* Added empty string support for enum
132132
* Fix column order
133133
* Fix float problem about time fieldtype
134134

@@ -168,7 +168,7 @@
168168
* Add support for MariaDB GTID
169169

170170
0.29 08/04/2022
171-
* Skip db name parsing if mts_accessed_dbs == 254
171+
* Skip db name parsing if mts_accessed_dbs == 254
172172

173173
0.30 28/04/2022
174174
* Fix decoding large json arrays
@@ -195,4 +195,39 @@
195195
* Fix release error
196196

197197
0.43.0 23/07/2023
198-
* Bump PyMySQL to 1.1.0 to solve : LookupError: unknown encoding: utf8mb3
198+
* Bump PyMySQL to 1.1.0 to solve : LookupError: unknown encoding: utf8mb3
199+
200+
0.44.0 12/09/2023
201+
* Add MariadbAnnotateRowsEvent
202+
* Add RandEvent
203+
* Add MariadbStartEncryptionEvent
204+
* Add RowsQueryLogEvent
205+
* Add MariadbBinLogCheckPointEvent
206+
* Add PreviousGtidsEvent
207+
* Add UserVarEvent
208+
* Fix Bug increase history list length and snapshot : Mysql 8.0 version connection was being created along with the opening of a transaction. This led to a problem with looking at the snapshot before creating the table
209+
* Fix Avoid UnicodeDecodeError for non-utf8 QueryEvents
210+
* Enhance Data Integrity with Binlog Event Checksum Verification
211+
* Fix Bug table map event read null_bitmask packet
212+
* Fix Timestamp conversion to return UTC instead of local timezone
213+
* Optimize Handler_read_rnd by removing ORDER BY clause
214+
215+
0.45.0 02/10/2023
216+
* Fix Json object, Array parse Error
217+
218+
1.0.0 02/10/2023
219+
* remove column schema
220+
* Mysql 8.0.14 version support Table map Event optional metaData extraction
221+
* Sync Column from optional metaData
222+
* Fix parsing of incorrect bytes in 'extradata' for 'rows event'
223+
* Fix remove duplicate Affected columns output
224+
* Enhance Code Quality with Ruff, Black, and Pre-commit
225+
* Enhance Testing with MySQL8 & Update GitHub Actions
226+
* Add Logging when fake rotate event occured
227+
* update logo
228+
229+
1.0.1 05/10/2023
230+
* add util module
231+
232+
1.0.2 05/10/2023
233+
* Delete charset_list.csv and add directly in CHARSET.py

CONTRIBUTING.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Contributing to python-mysql-replication
2+
3+
Firstly, thank you for considering to contribute to `python-mysql-replication`. We appreciate your effort, and to ensure that your contributions align with the project's coding standards, we employ the use of `pre-commit` hooks. This guide will walk you through setting them up.
4+
5+
## Setting up pre-commit
6+
7+
1. **Install pre-commit**
8+
9+
Before you can use `pre-commit`, you need to install it. You can do so using `pip`:
10+
11+
```bash
12+
pip install pre-commit
13+
```
14+
15+
2. **Install the pre-commit hooks**
16+
17+
Navigate to the root directory of your cloned `python-mysql-replication` repository and run:
18+
19+
```bash
20+
pre-commit install
21+
```
22+
23+
This will install the `pre-commit` hooks to your local repository.
24+
25+
3. **Make sure to stage your changes**
26+
27+
`pre-commit` will only check the files that are staged in git. So make sure to `git add` any new changes you made before running `pre-commit`.
28+
29+
4. **Run pre-commit manually (Optional)**
30+
31+
Before committing, you can manually run:
32+
33+
```bash
34+
pre-commit run --all-files
35+
```
36+
37+
This will run the hooks on all the files. If there's any issue, the hooks will let you know.
38+
39+
## If you encounter issues
40+
41+
If you run into any problems with the hooks, you can always skip them using:
42+
43+
```bash
44+
git commit -m "Your commit message" --no-verify
45+
```
46+
47+
However, please note that skipping hooks might lead to CI failures if we use these checks in our CI pipeline. It's always recommended to adhere to the checks to ensure a smooth contribution process.
48+
49+
---
50+
51+
That's it! With these steps, you should be well on your way to contributing to `python-mysql-replication`. We look forward to your contributions!

0 commit comments

Comments
 (0)