Skip to content

Commit 5872369

Browse files
authored
Support py>=39,<py313 (#108)
* Add GitHub actions and workflows * Add hardcoded version (temporarily) * Disable linters and some linting rules * Linting * Add secrets variables * Add environment to github action * Improve Makefile * Fix actions versions * Enable tests on GitHub Actions for py39-py312 * Replace setup.py by pyproject.toml, update Makefile, move dev deps to environment-dev.yaml * Fix json data * Test package version on GA
1 parent 9d0c805 commit 5872369

File tree

14 files changed

+573
-56
lines changed

14 files changed

+573
-56
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-python@v5
15+
- uses: pre-commit/[email protected]
16+
17+
test:
18+
name: test py${{ matrix.python-version }} on ${{ matrix.os }}
19+
runs-on: ${{ matrix.os }}
20+
defaults:
21+
run:
22+
shell: bash -el {0}
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
27+
python-version: ["3.9", "3.10", "3.11", "3.12"]
28+
#environment: mailjet
29+
env:
30+
MJ_APIKEY_PUBLIC: ${{ secrets.MJ_APIKEY_PUBLIC }}
31+
MJ_APIKEY_PRIVATE: ${{ secrets.MJ_APIKEY_PRIVATE }}
32+
steps:
33+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
34+
- uses: conda-incubator/setup-miniconda@v3
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
channels: defaults
38+
show-channel-urls: true
39+
environment-file: environment.yaml
40+
41+
- name: Install the package
42+
run: |
43+
pip install -e .
44+
conda info
45+
- name: Test package imports
46+
run: python -c "import mailjet_rest; print('mailjet_rest version is', mailjet_rest.utils.version.get_version())"

.pre-commit-config.yaml

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# Apply to all files without commiting:
2+
# pre-commit run --all-files
3+
# Update this file:
4+
# pre-commit autoupdate
5+
exclude: ^(.*/versioneer\.py|.*/_version\.py|.*/.*\.svg)
6+
7+
ci:
8+
autofix_commit_msg: |
9+
[pre-commit.ci] auto fixes from pre-commit.com hooks
10+
11+
for more information, see https://pre-commit.ci
12+
autofix_prs: true
13+
autoupdate_branch: ''
14+
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
15+
autoupdate_schedule: weekly
16+
skip: []
17+
submodules: false
18+
19+
repos:
20+
- repo: https://github.com/pre-commit/pre-commit-hooks
21+
rev: v4.6.0
22+
hooks:
23+
- id: check-ast
24+
- id: check-builtin-literals
25+
- id: fix-byte-order-marker
26+
- id: check-case-conflict
27+
- id: check-docstring-first
28+
- id: check-vcs-permalinks
29+
# Fail if staged files are above a certain size.
30+
# To add a large file, use 'git lfs track <file>; git add <file> to track large files with
31+
# git-lfs rather than commiting them directly to the git history
32+
- id: check-added-large-files
33+
args: [ "--maxkb=500" ]
34+
- id: fix-byte-order-marker
35+
- id: check-case-conflict
36+
# Fails if there are any ">>>>>" lines in files due to merge conflicts.
37+
- id: check-merge-conflict
38+
# ensure syntaxes are valid
39+
- id: check-toml
40+
- id: debug-statements
41+
- id: detect-private-key
42+
# Makes sure files end in a newline and only a newline;
43+
- id: end-of-file-fixer
44+
- id: mixed-line-ending
45+
# Trims trailing whitespace. Allow a single space on the end of .md lines for hard line breaks.
46+
- id: trailing-whitespace
47+
args: [ --markdown-linebreak-ext=md ]
48+
# Sort requirements in requirements.txt files.
49+
- id: requirements-txt-fixer
50+
# Prevent committing directly to trunk
51+
- id: no-commit-to-branch
52+
args: [ "--branch=master" ]
53+
# Detects the presence of private keys
54+
- id: detect-private-key
55+
56+
- repo: https://github.com/jorisroovers/gitlint
57+
rev: v0.19.1
58+
hooks:
59+
- id: gitlint
60+
61+
- repo: https://github.com/codespell-project/codespell
62+
rev: v2.3.0
63+
hooks:
64+
- id: codespell
65+
args: [--write]
66+
67+
- repo: https://github.com/python-jsonschema/check-jsonschema
68+
rev: 0.29.2
69+
hooks:
70+
- id: check-github-workflows
71+
72+
- repo: https://github.com/akaihola/darker
73+
rev: v2.1.1
74+
hooks:
75+
- id: darker
76+
77+
- repo: https://github.com/PyCQA/autoflake
78+
rev: v2.3.1
79+
hooks:
80+
- id: autoflake
81+
args:
82+
- --in-place
83+
- --remove-all-unused-imports
84+
- --remove-unused-variable
85+
- --ignore-init-module-imports
86+
87+
- repo: https://github.com/pre-commit/mirrors-autopep8
88+
rev: v2.0.4
89+
hooks:
90+
- id: autopep8
91+
exclude: ^docs/
92+
93+
# - repo: https://github.com/pycqa/flake8
94+
# rev: 7.1.1
95+
# hooks:
96+
# - id: flake8
97+
# additional_dependencies:
98+
# - radon
99+
# - flake8-docstrings
100+
# - Flake8-pyproject
101+
# exclude: ^docs/
102+
103+
104+
- repo: https://github.com/PyCQA/pylint
105+
rev: v3.3.1
106+
hooks:
107+
- id: pylint
108+
args:
109+
- --exit-zero
110+
111+
# - repo: https://github.com/google/yapf
112+
# rev: v0.31.0
113+
# hooks:
114+
# - id: yapf
115+
# name: "yapf"
116+
# additional_dependencies: [toml]
117+
118+
# - repo: https://github.com/RobertCraigie/pyright-python
119+
# rev: v1.1.383
120+
# hooks:
121+
# - id: pyright
122+
123+
# - repo: https://github.com/adrienverge/yamllint.git
124+
# rev: v1.29.0
125+
# hooks:
126+
# - id: yamllint
127+
# args: [--strict]
128+
129+
# - repo: https://github.com/mattseymour/pre-commit-pytype
130+
# rev: '2020.10.8'
131+
# hooks:
132+
# - id: pytype
133+
134+
- repo: https://github.com/asottile/pyupgrade
135+
rev: v3.17.0
136+
hooks:
137+
- id: pyupgrade
138+
args: [--py38-plus, --keep-runtime-typing]
139+
140+
- repo: https://github.com/charliermarsh/ruff-pre-commit
141+
# Ruff version.
142+
rev: v0.6.8
143+
hooks:
144+
# Run the linter.
145+
- id: ruff
146+
args: [--fix, --exit-non-zero-on-fix]
147+
# Run the formatter.
148+
- id: ruff-format
149+
150+
- repo: https://github.com/dosisod/refurb
151+
rev: v2.0.0
152+
hooks:
153+
- id: refurb
154+
155+
# - repo: https://github.com/pre-commit/mirrors-mypy
156+
# rev: v1.11.2
157+
# hooks:
158+
# - id: mypy
159+
# args:
160+
# [
161+
# --config-file=./pyproject.toml,
162+
# ]
163+
164+
# - repo: https://github.com/executablebooks/mdformat
165+
# rev: 0.7.17
166+
# hooks:
167+
# - id: mdformat
168+
# additional_dependencies:
169+
# # gfm = GitHub Flavored Markdown
170+
# - mdformat-gfm
171+
# - mdformat-black
172+
173+
# - repo: https://github.com/PyCQA/bandit
174+
# rev: 1.7.10
175+
# hooks:
176+
# - id: bandit
177+
# args: ["-r", "."]
178+
# # ignore all tests, not just tests data
179+
# exclude: ^tests/

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
**Merged pull requests:**
2020

2121
- Update README.md [\#44](https://github.com/mailjet/mailjet-apiv3-python/pull/44) ([Hyask](https://github.com/Hyask))
22-
- new readme version with standartized content [\#42](https://github.com/mailjet/mailjet-apiv3-python/pull/42) ([adamyanliev](https://github.com/adamyanliev))
22+
- new readme version with standardized content [\#42](https://github.com/mailjet/mailjet-apiv3-python/pull/42) ([adamyanliev](https://github.com/adamyanliev))
2323
- fix page [\#41](https://github.com/mailjet/mailjet-apiv3-python/pull/41) ([adamyanliev](https://github.com/adamyanliev))
2424
- Fix unit tests for new API address [\#37](https://github.com/mailjet/mailjet-apiv3-python/pull/37) ([todorDim](https://github.com/todorDim))
2525
- Fix URL slicing, update version in unit test [\#36](https://github.com/mailjet/mailjet-apiv3-python/pull/36) ([todorDim](https://github.com/todorDim))

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
21+
THE SOFTWARE.

0 commit comments

Comments
 (0)