async-httpd-data-collector 2.0.1__tar.gz → 2.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. async_httpd_data_collector-2.0.1/.github/workflows/publish-pypi.yml → async_httpd_data_collector-2.0.2/.github/workflows/publish.yml +32 -15
  2. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/.github/workflows/test.yml +37 -20
  3. async_httpd_data_collector-2.0.2/.yamlfmt.yml +6 -0
  4. async_httpd_data_collector-2.0.2/.yamllint.yml +7 -0
  5. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/PKG-INFO +1 -1
  6. async_httpd_data_collector-2.0.2/ahttpdc/__init__.py +1 -0
  7. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/ahttpdc/read/database_interface.py +1 -1
  8. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/ahttpdc/read/fetch/fetcher.py +1 -1
  9. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/tests/read/query/test_query.py +1 -1
  10. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/tests/read/test_interface.py +1 -1
  11. async_httpd_data_collector-2.0.1/ahttpdc/__init__.py +0 -1
  12. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/.gitignore +0 -0
  13. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/LICENSE +0 -0
  14. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/README.md +0 -0
  15. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/ahttpdc/read/__init__.py +0 -0
  16. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/ahttpdc/read/daemon.py +0 -0
  17. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/ahttpdc/read/fetch/__init__.py +0 -0
  18. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/ahttpdc/read/query/__init__.py +0 -0
  19. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/ahttpdc/read/query/interface.py +0 -0
  20. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/ahttpdc/read/query/parse/data.py +0 -0
  21. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/ahttpdc/read/store/__init__.py +0 -0
  22. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/ahttpdc/read/store/collector.py +0 -0
  23. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/ahttpdc/read/store/parse/__init__.py +0 -0
  24. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/ahttpdc/read/store/parse/parser.py +0 -0
  25. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/examples/daemon_example.py +0 -0
  26. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/examples/minima_dashboard_example.py +0 -0
  27. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/examples/query_example.py +0 -0
  28. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/pyproject.toml +0 -0
  29. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/requirements.txt +0 -0
  30. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/tests/dev_server.py +0 -0
  31. {async_httpd_data_collector-2.0.1 → async_httpd_data_collector-2.0.2}/tests/read/fetch/test_fetcher.py +0 -0
@@ -1,38 +1,55 @@
1
- name: Publish Python Package
1
+ ---
2
+ # Builds, relases and publishes to PyPi
3
+ # .github/workflows/publish.yml
4
+ name: CD
5
+
6
+ # triggered when testing is finished
2
7
  on:
3
- push:
4
- branches:
5
- - master
6
- tags:
7
- - 'v*'
8
+ workflow_run:
9
+ workflows: ["CI"]
10
+ branches: [master]
11
+ types:
12
+ - completed
13
+
14
+ # add contents: write for the release
15
+ permissions:
16
+ contents: write
17
+
8
18
  jobs:
9
- build-and-publish:
19
+
20
+ build-release-publish:
10
21
  runs-on: ubuntu-latest
22
+
11
23
  steps:
24
+
12
25
  - name: Checkout repository
13
26
  uses: actions/checkout@v2
27
+
14
28
  - name: Set up Python
15
29
  uses: actions/setup-python@v2
16
30
  with:
17
31
  python-version: '3.x'
32
+
18
33
  - name: Install dependencies
19
34
  run: |
20
35
  python -m pip install --upgrade pip
21
36
  pip install build twine
22
37
  pip install -r requirements.txt
38
+
23
39
  - name: Build the application
24
40
  run: |
25
41
  python -m build
26
- - name: Publish to PyPi
27
- if: startsWith(github.ref, 'refs/tags/')
28
- env:
29
- TWINE_USERNAME: __token__
30
- TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
31
- run: |
32
- python -m twine upload dist/*
42
+
33
43
  - name: Release
34
44
  uses: softprops/action-gh-release@v2
35
45
  if: startsWith(github.ref, 'refs/tags/')
36
46
  with:
37
47
  files: |
38
- dist/*
48
+ dist/**
49
+
50
+ - name: Publish to PyPi
51
+ env:
52
+ TWINE_USERNAME: __token__
53
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
54
+ run: |-
55
+ python -m twine upload dist/*
@@ -1,12 +1,20 @@
1
- name: Python CI
2
- # publish on push to master
1
+ ---
2
+ # Workflow sets up the database and tests the project.
3
+ # .github/workflows/test.yml
4
+
5
+ name: CI
6
+
7
+ # trigger on push to the master
3
8
  on:
4
9
  push:
5
10
  branches:
6
11
  - master
12
+
7
13
  jobs:
8
- deploy:
14
+ continuous-integration:
9
15
  runs-on: ubuntu-latest
16
+
17
+ # set up influxdb database and flask server
10
18
  services:
11
19
  influxdb:
12
20
  image: influxdb:2
@@ -16,24 +24,30 @@ jobs:
16
24
  image: python:3.9
17
25
  ports:
18
26
  - 5000:5000
27
+
19
28
  steps:
20
- - name: Check out repository
29
+
30
+ - name: Checkout repository
21
31
  uses: actions/checkout@v2
32
+
33
+ # install InfluxDB CLI to authenticate access to the database
22
34
  - name: Install InfluxDB CLI
23
35
  run: |
24
36
  wget https://download.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-amd64.tar.gz
25
37
  tar xvzf ./influxdb2-client-2.7.5-linux-amd64.tar.gz
26
- sudo cp ./influx /usr/local/bin/
38
+ cp ./influx /usr/local/bin/
39
+
27
40
  - name: Set up InfluxDB
28
41
  id: setup-influx
29
42
  run: |
30
- # passes to test database with no data
43
+
44
+ # default auth data for the test instance
31
45
  INFLUX_USERNAME="test-user"
32
46
  INFLUX_PASSWORD="test-password"
33
47
  INFLUX_ORG="test-org"
34
48
  INFLUX_BUCKET="test-bucket"
35
49
 
36
- # setting up the database
50
+ # setting up the test instance
37
51
  influx setup \
38
52
  --username "$INFLUX_USERNAME" \
39
53
  --password "$INFLUX_PASSWORD" \
@@ -41,13 +55,14 @@ jobs:
41
55
  --bucket "$INFLUX_BUCKET" \
42
56
  --force
43
57
 
44
- # saving information required for connection later
58
+ # save the data required for the token generation and testing
45
59
  echo "::set-output name=org::${INFLUX_ORG}"
46
60
  echo "::set-output name=bucket::${INFLUX_BUCKET}"
47
- - name: Authorization for InfluxDB
61
+
62
+ - name: Generate token for further authentication
48
63
  id: auth
49
64
  run: |
50
- # authenticating the connection
65
+
51
66
  INFLUX_TOKEN=$(influx auth create \
52
67
  --user "$INFLUX_USERNAME" \
53
68
  --org "$INFLUX_ORG" \
@@ -56,31 +71,33 @@ jobs:
56
71
  --skip-verify \
57
72
  --json | jq '.token')
58
73
 
59
- # saving the token for the connection
74
+ # save the token
60
75
  echo "::set-output name=token::${INFLUX_TOKEN}"
76
+
61
77
  - name: Set up Python
62
78
  uses: actions/setup-python@v2
63
79
  with:
64
80
  python-version: '3.11'
81
+
65
82
  - name: Install dependencies
66
83
  run: |
67
84
  python -m pip install --upgrade pip
68
- pip install build
69
- pip install ruff
70
- pip install twine
85
+ pip install ruff build twine
71
86
  pip install -r requirements.txt
72
- - name: Lint with ruff
87
+
88
+ - name: Check formatting
73
89
  run: |
74
- ruff format
75
90
  ruff check
76
- - name: Test with pytest
77
- run: |
78
- # starting the flask server, supplying some sample data
91
+
92
+ - name: Test
93
+ run: |-
94
+
95
+ # run the falsk dev_server
79
96
  export FLASK_APP="tests/dev_server"
80
97
  flask run --host=0.0.0.0 --port=9000 &
81
98
  sleep 5
82
99
 
83
- # setting the connection variables as for the pytest to use
100
+ # exporting data required for testing as env variables
84
101
  export PYTHONPATH="$PYTHONPATH:$(pwd)"
85
102
  export INFLUXDB_HOST="localhost"
86
103
  export INFLUXDB_PORT=8086
@@ -0,0 +1,6 @@
1
+ ---
2
+ formatter:
3
+ type: basic
4
+ trim_trailing_whitespace: true
5
+ retain_line_breaks: true
6
+ include_document_start: true
@@ -0,0 +1,7 @@
1
+ ---
2
+ extends: default
3
+
4
+ rules:
5
+ line-length:
6
+ max: 80
7
+ level: warning
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: async-httpd-data-collector
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: Gateway facilitating asyncronous communication between sensory data-emitting devices, InfluxDB and the user.
5
5
  Project-URL: Repository, https://github.com/straightchlorine/async-httpd-data-collector
6
6
  Project-URL: Issues, https://github.com/straightchlorine/async-httpd-data-collector/issues
@@ -0,0 +1 @@
1
+ __version__ = 'v2.0.2'
@@ -51,7 +51,7 @@ class DatabaseInterface:
51
51
  db_org: str,
52
52
  db_bucket: str,
53
53
  srv_ip: str,
54
- srv_port: int | str = 8000,
54
+ srv_port: int | str = 80,
55
55
  handle: str = '',
56
56
  interval: int = 1,
57
57
  ):
@@ -60,7 +60,7 @@ class AsyncFetcher:
60
60
  print(f'Error fetching data: {response.status}')
61
61
  else:
62
62
  # TODO: Add some verification module to check if the JSON response is
63
- # appropriate for further processing, i.e. it follows:
63
+ # appropriate for further processing.
64
64
 
65
65
  read = await response.json()
66
66
  return read
@@ -111,7 +111,7 @@ class TestAsyncQuery:
111
111
 
112
112
  # wait for some data to flow in
113
113
  self.set_up()
114
- await asyncio.sleep(2)
114
+ await asyncio.sleep(5)
115
115
  self.daemon.disable()
116
116
 
117
117
  result = await self.query.latest()
@@ -80,7 +80,7 @@ class TestInterface:
80
80
  """
81
81
 
82
82
  self.set_up()
83
- await asyncio.sleep(1)
83
+ await asyncio.sleep(5)
84
84
  self.interface.daemon.disable()
85
85
 
86
86
  assert True
@@ -1 +0,0 @@
1
- __version__ = 'v2.0.1'