File tree Expand file tree Collapse file tree 6 files changed +44
-27
lines changed
Expand file tree Collapse file tree 6 files changed +44
-27
lines changed Original file line number Diff line number Diff line change 1- name : Pypi Release
1+ name : PyPI Release, Test, and Deploy
2+
23on :
3- workflow_run :
4- workflows : [ "CI Tests" ]
5- branches : [ master ]
6- types :
7- - completed
8- # Allows you to run this workflow manually from the Actions tab
4+ release :
5+ types : [published]
6+
97jobs :
8+ ci-tests :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - name : Checkout code
12+ uses : actions/checkout@v2
13+ with :
14+ fetch-depth : 0
15+ - name : Set up Python
16+ 17+ with :
18+ python-version : ' 3.x'
19+ - name : Install dependencies
20+ run : |
21+ python -m pip install --upgrade pip
22+ pip install -r requirements.txt
23+ - name : Run tox
24+ run : python -m tox
25+
1026 build-and-release :
11- if : ${{ github.event.workflow_run.conclusion == 'success' }}
27+ needs : ci-tests
1228 runs-on : ubuntu-latest
1329 steps :
1430 - uses : actions/checkout@v2
31+ with :
32+ fetch-depth : 0
15331634 with :
1735 python-version : ' 3.x'
18- - name : " Install dependencies"
36+ - name : Install dependencies
1937 run : |
20- python3 -m pip install setuptools wheel twine
38+ python -m pip install --upgrade pip
39+ pip install -r requirements.txt
2140 - name : " Build and uploads to PyPI"
2241 run : |
2342 python3 setup.py sdist bdist_wheel
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -322,6 +322,10 @@ LOGGING = {
322322
323323## Release Notes
324324
325+ - 4.1.3
326+ - Enhanced LogzioSender to dynamically set the user-agent header using the package version.
327+ - Adjusted GitHub Actions to trigger on new releases.
328+ - Streamlined versioning in deployments by automating Git tag extraction for PACKAGE_VERSION.
325329- 4.1.2
326330 - Fix DeprecationWarning
327331 - Adjusted tests to logging:3.12
Original file line number Diff line number Diff line change 33import json
44import sys
55from datetime import datetime
6+ from importlib .metadata import version
67from threading import Thread , enumerate
78from time import sleep
89
1415 import Queue as queue
1516else :
1617 import queue as queue
17-
18+ PACKAGE_NAME = "logzio-python-handler"
19+ PACKAGE_VERSION = version (PACKAGE_NAME )
20+ SHIPPER_HEADER = {"user-agent" : f"{ PACKAGE_NAME } -version-{ PACKAGE_VERSION } -logs" }
1821MAX_BULK_SIZE_IN_BYTES = 1 * 1024 * 1024 # 1 MB
1922
2023
@@ -108,7 +111,7 @@ def _flush_queue(self):
108111 self .number_of_retries = self .number_of_retries
109112
110113 should_backup_to_disk = True
111- headers = {"Content-type" : "text/plain" }
114+ headers = {"Content-type" : "text/plain" , ** SHIPPER_HEADER }
112115
113116 for current_try in range (self .number_of_retries ):
114117 should_retry = False
Original file line number Diff line number Diff line change @@ -2,3 +2,7 @@ requests>=2.27.0
22protobuf >= 3.20.2
33setuptools >= 68.0.0 # not directly required, pinned to avoid a vulnerability
44future >= 0.18.3 # used in tests
5+ tox >= 4.15.0
6+ wheel
7+ twine >= 5.0.0
8+ setuptools_scm
Original file line number Diff line number Diff line change 44
55setup (
66 name = "logzio-python-handler" ,
7- version = '4.1.2' ,
7+ use_scm_version = True ,
88 description = "Logging handler to send logs to your Logz.io account with bulk SSL" ,
99 keywords = "logging handler logz.io bulk https" ,
1010 author = "roiravhon" ,
2323 test_requires = [
2424 "future"
2525 ],
26+ setup_requires = ['setuptools_scm' ],
2627 include_package_data = True ,
2728 classifiers = [
2829 'Development Status :: 5 - Production/Stable' ,
You can’t perform that action at this time.
0 commit comments