Skip to content

Commit 8fd99c2

Browse files
committed
Modernize SDK: Refactor structure, add tests, and update packaging
- Switch to pyproject.toml for packaging - Refactor monolithic __init__.py into client, models, and exceptions modules - Add unit tests and pytest configuration - specialized exceptions - Add GitHub Actions CI workflow - Update README and add CONTRIBUTING guide - Drop Python 2 support
1 parent b541676 commit 8fd99c2

File tree

13 files changed

+744
-589
lines changed

13 files changed

+744
-589
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
name: CI
3+
4+
on:
5+
push:
6+
branches: [ "master", "main" ]
7+
pull_request:
8+
branches: [ "master", "main" ]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install ruff pytest
29+
pip install -e .
30+
31+
- name: Lint with Ruff
32+
run: |
33+
# stop the build if there are Python syntax errors or undefined names
34+
ruff check .
35+
# check formatting
36+
ruff format --check .
37+
38+
- name: Test with pytest
39+
run: |
40+
pytest

.gitignore

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# Byte-compiled / optimized / DLL files
23
__pycache__/
34
*.py[cod]
@@ -8,7 +9,6 @@ __pycache__/
89

910
# Distribution / packaging
1011
.Python
11-
env/
1212
build/
1313
develop-eggs/
1414
dist/
@@ -21,9 +21,11 @@ parts/
2121
sdist/
2222
var/
2323
wheels/
24+
share/python-wheels/
2425
*.egg-info/
2526
.installed.cfg
2627
*.egg
28+
MANIFEST
2729

2830
# PyInstaller
2931
# Usually these files are written by a python script from a template
@@ -38,13 +40,17 @@ pip-delete-this-directory.txt
3840
# Unit test / coverage reports
3941
htmlcov/
4042
.tox/
43+
.nox/
4144
.coverage
4245
.coverage.*
4346
.cache
4447
nosetests.xml
4548
coverage.xml
4649
*.cover
50+
*.py,cover
4751
.hypothesis/
52+
.pytest_cache/
53+
cover/
4854

4955
# Translations
5056
*.mo
@@ -53,6 +59,8 @@ coverage.xml
5359
# Django stuff:
5460
*.log
5561
local_settings.py
62+
db.sqlite3
63+
db.sqlite3-journal
5664

5765
# Flask stuff:
5866
instance/
@@ -67,28 +75,53 @@ docs/_build/
6775
# PyBuilder
6876
target/
6977

70-
# PyCharm
71-
.idea/
72-
7378
# Jupyter Notebook
7479
.ipynb_checkpoints
7580

81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
7685
# pyenv
7786
.python-version
7887

79-
# celery beat schedule file
88+
# pipenv
89+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
90+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
91+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
92+
# install all needed dependencies.
93+
#Pipfile.lock
94+
95+
# poetry
96+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
97+
# This is especially recommended for binary packages to ensure reproducible builds.
98+
#poetry.lock
99+
100+
# pdm
101+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
102+
#pdm.lock
103+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
104+
# in version control.
105+
#.pdm.toml
106+
107+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and others
108+
__pypackages__/
109+
110+
# Celery stuff
80111
celerybeat-schedule
112+
celerybeat.pid
81113

82114
# SageMath parsed files
83115
*.sage.py
84116

85-
# dotenv
117+
# Environments
86118
.env
87-
88-
# virtualenv
89119
.venv
120+
env/
90121
venv/
91122
ENV/
123+
env.bak/
124+
venv.bak/
92125

93126
# Spyder project settings
94127
.spyderproject
@@ -102,3 +135,20 @@ ENV/
102135

103136
# mypy
104137
.mypy_cache/
138+
.dmypy.json
139+
dmypy.json
140+
141+
# Pyre type checker
142+
.pyre/
143+
144+
# pytype static type analyzer
145+
.pytype/
146+
147+
# Cython debug symbols
148+
cython_debug/
149+
150+
# PyCharm
151+
.idea/
152+
153+
# VS Code
154+
.vscode/

.travis.yml

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

CONTRIBUTING.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
# Contributing to TapPay Python SDK
3+
4+
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
5+
6+
- Reporting a bug
7+
- Discussing the current state of the code
8+
- Submitting a fix
9+
- Proposing new features
10+
11+
## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests
12+
13+
Pull requests are the best way to propose changes to the codebase.
14+
15+
1. Fork the repo and create your branch from `master`.
16+
2. If you've added code that should be tested, add tests.
17+
3. If you've changed APIs, update the documentation.
18+
4. Ensure the test suite passes.
19+
5. Make sure your code lints and formats correctly.
20+
21+
## Development Setup
22+
23+
1. Clone the repository.
24+
2. Install dependencies: `pip install -e .` and `pip install ruff pytest`.
25+
3. Run tests: `pytest`.
26+
4. Run linter: `ruff check .`
27+
5. Run formatter: `ruff format .`
28+
29+
## License
30+
31+
By contributing, you agree that your contributions will be licensed under its MIT License.

0 commit comments

Comments
 (0)