Skip to content

Commit 63bdad9

Browse files
authored
chore: improve GitHub integration, add CI config, code QL (#78)
1 parent b9a915a commit 63bdad9

12 files changed

+319
-18
lines changed

.circleci/config.yml

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
version: 2.1
2+
3+
commands:
4+
client-test:
5+
description: "Run tests"
6+
parameters:
7+
python-image:
8+
type: string
9+
steps:
10+
- restore_cache:
11+
name: Restoring Pip Cache
12+
keys:
13+
- &cache-key pip-cache-v11-<< parameters.python-image >>-{{ checksum "setup.py" }}
14+
- pip-cache-v11-<< parameters.python-image >>-
15+
- run:
16+
name: "Running tests"
17+
command: |
18+
python --version
19+
mkdir test-reports || true
20+
pip install . --user
21+
pip install .\[dataframe\] --user
22+
pip install pytest pytest-cov --user
23+
pytest tests --junitxml=test-reports/junit.xml --cov=./ --cov-report xml:coverage.xml
24+
- save_cache:
25+
name: Saving Pip Cache
26+
key: *cache-key
27+
paths:
28+
- ".venv"
29+
- "~/.cache/pip"
30+
- "/usr/local/lib/site-python"
31+
when: always
32+
jobs:
33+
tests-python:
34+
parameters:
35+
python-image:
36+
type: string
37+
default: &default-python "cimg/python:3.7"
38+
docker:
39+
- image: << parameters.python-image >>
40+
environment:
41+
PIPENV_VENV_IN_PROJECT: true
42+
steps:
43+
- checkout
44+
- client-test:
45+
python-image: << parameters.python-image >>
46+
- store_test_results:
47+
path: test-reports
48+
- run:
49+
name: Collecting coverage reports
50+
command: |
51+
curl -Os https://uploader.codecov.io/latest/linux/codecov
52+
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
53+
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
54+
curl -s https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import
55+
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
56+
shasum -a 256 -c codecov.SHA256SUM
57+
chmod +x ./codecov
58+
./codecov
59+
check-code-style:
60+
docker:
61+
- image: *default-python
62+
environment:
63+
PIPENV_VENV_IN_PROJECT: true
64+
steps:
65+
- checkout
66+
- run:
67+
name: Checks style consistency across sources.
68+
command: |
69+
pip install flake8 --user
70+
flake8 influxdb_client_3/
71+
check-twine:
72+
docker:
73+
- image: *default-python
74+
environment:
75+
PIPENV_VENV_IN_PROJECT: true
76+
steps:
77+
- checkout
78+
- run:
79+
name: Checks that the description will render correctly on PyPI.
80+
command: |
81+
pip install --upgrade pip
82+
pip install twine --user
83+
python setup.py sdist bdist_wheel
84+
twine check dist/*
85+
check-docstyle:
86+
docker:
87+
- image: *default-python
88+
environment:
89+
PIPENV_VENV_IN_PROJECT: true
90+
steps:
91+
- checkout
92+
- run:
93+
name: Checks compliance with Python docstring convention.
94+
command: |
95+
pip install pydocstyle --user
96+
pydocstyle --count influxdb_client_3
97+
98+
workflows:
99+
version: 2
100+
build:
101+
when:
102+
not:
103+
equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
104+
jobs:
105+
# - check-code-style
106+
# - check-docstyle
107+
- check-twine
108+
- tests-python:
109+
name: test-3.8
110+
python-image: "cimg/python:3.8"
111+
- tests-python:
112+
name: test-3.9
113+
python-image: "cimg/python:3.9"
114+
- tests-python:
115+
name: test-3.10
116+
python-image: "cimg/python:3.10"
117+
- tests-python:
118+
name: test-3.11
119+
python-image: "cimg/python:3.11"
120+
- tests-python:
121+
name: test-3.12
122+
python-image: "cimg/python:3.12"
123+
124+
nightly:
125+
when:
126+
equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
127+
jobs:
128+
- tests-python

.github/ISSUE_TEMPLATE/BUG_REPORT.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Bug Report
2+
description: Create a bug report to help us improve
3+
labels: ["bug"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for taking time to fill out this bug report! We reserve this repository issues for bugs with reproducible problems.
9+
Please redirect any questions about the client usage to our [Community Slack](https://app.slack.com/huddle/TH8RGQX5Z/C02UDUPLQKA) or [Community Page](https://community.influxdata.com/) we have a lot of talented community members there who could help answer your question more quickly.
10+
11+
* Please add a :+1: or comment on a similar existing bug report instead of opening a new one.
12+
* Please check whether the bug can be reproduced with the latest release.
13+
- type: textarea
14+
id: specifications
15+
attributes:
16+
label: Specifications
17+
description: Describe the steps to reproduce the bug.
18+
value: |
19+
* Client Version:
20+
* InfluxDB Version:
21+
* Platform:
22+
validations:
23+
required: true
24+
- type: textarea
25+
id: reproduce
26+
attributes:
27+
label: Code sample to reproduce problem
28+
description: Provide a code sample that reproduces the problem
29+
value: |
30+
```python
31+
```
32+
validations:
33+
required: true
34+
- type: textarea
35+
id: expected-behavior
36+
attributes:
37+
label: Expected behavior
38+
description: Describe what you expected to happen when you performed the above steps.
39+
validations:
40+
required: true
41+
- type: textarea
42+
id: actual-behavior
43+
attributes:
44+
label: Actual behavior
45+
description: Describe what actually happened when you performed the above steps.
46+
validations:
47+
required: true
48+
- type: textarea
49+
id: additional-info
50+
attributes:
51+
label: Additional info
52+
description: Include gist of relevant config, logs, etc.
53+
validations:
54+
required: false
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Feature request
2+
description: Create a feature request to make client more awesome
3+
labels: ["feature request"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for taking time to share with us this feature request! Please describe why you would like this feature to be added to the client, how you plan to use it to make your life better.
9+
- type: textarea
10+
id: use-case
11+
attributes:
12+
label: Use Case
13+
description: Describe how you plan to use this feature.
14+
validations:
15+
required: true
16+
- type: textarea
17+
id: expected-behavior
18+
attributes:
19+
label: Expected behavior
20+
description: Describe what you expected to happen when you performed the above steps.
21+
validations:
22+
required: true
23+
- type: textarea
24+
id: actual-behavior
25+
attributes:
26+
label: Actual behavior
27+
description: Describe what actually happened when you performed the above steps.
28+
validations:
29+
required: true
30+
- type: textarea
31+
id: additional-info
32+
attributes:
33+
label: Additional info
34+
description: Include gist of relevant config, logs, etc.
35+
validations:
36+
required: false
37+

.github/ISSUE_TEMPLATE/SUPPORT.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Support request
2+
description: Open a support request
3+
labels: ["support"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
WOAHH, hold up. This isn't the best place for support questions.
9+
You can get a faster response on slack or forums:
10+
11+
Please redirect any QUESTIONS about Client usage to
12+
- InfluxData Slack Channel: https://app.slack.com/huddle/TH8RGQX5Z/C02UDUPLQKA
13+
- InfluxData Community Site: https://community.influxdata.com
14+
15+
- type: textarea
16+
attributes:
17+
label: "Please direct all support questions to slack or the forums. Thank you."

.github/PULL_REQUEST_TEMPLATE.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Closes #
2+
3+
## Proposed Changes
4+
5+
_Briefly describe your proposed changes:_
6+
7+
## Checklist
8+
9+
<!-- Checkboxes below this note can be erased if not applicable to your Pull Request. -->
10+
11+
- [ ] CHANGELOG.md updated
12+
- [ ] Rebased/mergeable
13+
- [ ] A test has been added if appropriate
14+
- [ ] Tests pass
15+
- [ ] Commit messages are [conventional](https://www.conventionalcommits.org/en/v1.0.0/)
16+
- [ ] Sign [CLA](https://www.influxdata.com/legal/cla/) (if not already signed)

.github/dependabot.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
open-pull-requests-limit: 10

.github/workflows/codeql-analysis.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
CodeQL-Build:
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
security-events: write
15+
actions: read
16+
contents: read
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
22+
- name: Initialize CodeQL
23+
uses: github/codeql-action/init@v2
24+
with:
25+
languages: python
26+
27+
- name: Autobuild
28+
uses: github/codeql-action/autobuild@v2
29+
30+
- name: Perform CodeQL Analysis
31+
uses: github/codeql-action/analyze@v2

.github/workflows/semantic.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: "Semantic PR and Commit Messages"
3+
4+
on:
5+
pull_request:
6+
types: [opened, reopened, synchronize, edited]
7+
branches:
8+
- main
9+
10+
jobs:
11+
semantic:
12+
uses: influxdata/validate-semantic-github-messages/.github/workflows/semantic.yml@main
13+
with:
14+
CHECK_PR_TITLE_OR_ONE_COMMIT: true

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ dist
66
build
77
pyinflux3*.egg-info
88
.DS_store
9-
__pycache__
9+
__pycache__
10+
.idea
11+
*.egg-info/

README.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@
99
<a href="https://pypi.org/project/influxdb3-python/">
1010
<img src="https://img.shields.io/pypi/dm/influxdb3-python.svg" alt="PyPI downloads">
1111
</a>
12-
<a href="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/pylint.yml">
13-
<img src="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/pylint.yml/badge.svg" alt="Lint Code Base">
12+
<a href="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/codeql-analysis.yml">
13+
<img src="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/codeql-analysis.yml/badge.svg?branch=main" alt="CodeQL analysis">
1414
</a>
15-
<a href="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/python-publish.yml">
16-
<img src="https://github.com/InfluxCommunity/influxdb3-python/actions/workflows/python-publish.yml/badge.svg" alt="Lint Code Base">
15+
<a href="https://dl.circleci.com/status-badge/redirect/gh/InfluxCommunity/influxdb3-python/tree/main">
16+
<img src="https://dl.circleci.com/status-badge/img/gh/InfluxCommunity/influxdb3-python/tree/main.svg?style=svg" alt="CircleCI">
17+
</a>
18+
<a href="https://codecov.io/gh/InfluxCommunity/influxdb3-python">
19+
<img src="https://codecov.io/gh/InfluxCommunity/influxdb3-python/branch/main/graph/badge.svg" alt="Code Cov"/>
1720
</a>
1821
<a href="https://influxcommunity.slack.com">
1922
<img src="https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social" alt="Community Slack">

setup.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@ def get_version():
4747
packages=find_packages(exclude=['tests', 'tests.*', 'examples', 'examples.*']),
4848
extras_require={'pandas': ['pandas'], 'polars': ['polars'], 'dataframe': ['pandas', 'polars']},
4949
install_requires=requires,
50-
python_requires='>=3.7',
50+
python_requires='>=3.8',
5151
classifiers=[
5252
'Development Status :: 4 - Beta',
5353
'Intended Audience :: Developers',
5454
'License :: OSI Approved :: MIT License',
55-
'Programming Language :: Python :: 3.7',
5655
'Programming Language :: Python :: 3.8',
5756
'Programming Language :: Python :: 3.9',
5857
'Programming Language :: Python :: 3.10',
58+
'Programming Language :: Python :: 3.11',
59+
'Programming Language :: Python :: 3.12',
5960
]
60-
)
61+
)

tests/test_influxdb_client_3.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,5 @@ def test_init(self):
2525
self.assertEqual(self.client._write_api, self.mock_write_api.return_value)
2626
self.assertEqual(self.client._flight_client, self.mock_flight_client.return_value)
2727

28-
@patch('influxdb_client_3._WriteApi.write')
29-
def test_write(self, mock_write):
30-
record = "test_record"
31-
self.client.write(record=record)
32-
mock_write.assert_called_once_with(bucket=self.client._database, record=record)
33-
34-
# Add more tests for other methods
35-
36-
3728
if __name__ == '__main__':
38-
unittest.main()
29+
unittest.main()

0 commit comments

Comments
 (0)