Skip to content

Commit ccc9dae

Browse files
authored
Merge pull request #5 from Naudit/develop-I3-I4
Closes #4 and #3
2 parents 108f84b + a6ebedf commit ccc9dae

File tree

8 files changed

+239
-215
lines changed

8 files changed

+239
-215
lines changed

.github/workflows/publish-to-test-pypi.yml

Lines changed: 24 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,43 @@ jobs:
44
build-n-publish:
55
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
66
runs-on: ubuntu-latest
7+
permissions:
8+
id-token: write
79
steps:
8-
- uses: actions/checkout@master
10+
- name: Checkout code
11+
uses: actions/checkout@master
912
with:
1013
fetch-depth: 0
11-
- name: Set up Python 3.8
12-
uses: actions/setup-python@v1
14+
15+
- name: Set up Python 3.10
16+
uses: actions/setup-python@v5
1317
with:
14-
python-version: 3.8
18+
python-version: "3.10"
19+
1520
- name: Install pypa/build
16-
run: >-
17-
python -m
18-
pip install
19-
build
20-
--user
21+
run: |
22+
pip install build --user
23+
pip install .
2124
- name: Install pypa/pdoc
22-
run: >-
23-
python -m
24-
pip install
25-
pdoc
26-
--user
27-
- name: Install dependencies
2825
run: >-
2926
python -m
3027
pip install
3128
.[dev]
3229
--user
33-
- name: Generate doc
34-
run: >-
35-
python -m
36-
pdoc -o docs -n pysmart_exporter
37-
- name: Build the test wheel and a source tarball
38-
run: >-
39-
python -m
40-
build
41-
--sdist
42-
--wheel
43-
--outdir distTest/
44-
.
30+
- name: Generate documentation with pdoc
31+
run: python -m pdoc -o docs -n pysmart_exporter
32+
33+
- name: Build the binary wheel and source tarball
34+
run: python -m build --sdist --wheel --outdir dist/
35+
4536
- name: Publish distribution 📦 to Test PyPI
46-
uses: pypa/gh-action-pypi-publish@master
37+
uses: pypa/gh-action-pypi-publish@release/v1
4738
with:
48-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
49-
repository_url: https://test.pypi.org/legacy/
50-
packages_dir: distTest/
51-
skip_existing: true
52-
- name: Build the binary wheel and a source tarball
53-
run: >-
54-
python -m
55-
build
56-
--sdist
57-
--wheel
58-
--outdir dist/
59-
.
39+
repository-url: https://test.pypi.org/legacy/
40+
skip-existing: true
41+
6042
- name: Publish distribution 📦 to PyPI
61-
if: startsWith(github.ref, 'refs/tags')
62-
uses: pypa/gh-action-pypi-publish@master
43+
if: startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/master'
44+
uses: pypa/gh-action-pypi-publish@release/v1
6345
with:
6446
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ build/
88
dist/
99
docs
1010
venv
11+
12+
# local version
13+
pysmart_exporter/version.py

pyproject.toml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright (C) 2021 Rafael Leira
2+
#
3+
# This program is distributed in the hope that it will be useful,
4+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
5+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6+
# License for more details.
7+
#
8+
################################################################
9+
10+
11+
[build-system]
12+
requires = ["setuptools>=61.0", "setuptools-scm", "wheel"]
13+
build-backend = "setuptools.build_meta"
14+
15+
[tool.setuptools_scm]
16+
write_to = "pysmart_exporter/version.py"
17+
local_scheme = "no-local-version"
18+
19+
[project]
20+
name = "pySMART-exporter"
21+
description = "A Prometheus PySMART exporter"
22+
readme = "README.md"
23+
keywords = ["prometheus", "SMART", "exporter", "monitoring"]
24+
license = { text = "BSD-3-Clause" }
25+
dependencies = ["prometheus-client", "pySMART >=1.3.0"]
26+
dynamic = ["version"]
27+
authors = [{ name = "Rafael Leira", email = "[email protected]" }]
28+
29+
classifiers = [
30+
"Development Status :: 4 - Beta",
31+
"Intended Audience :: Developers",
32+
"Intended Audience :: System Administrators",
33+
"License :: OSI Approved :: BSD License",
34+
"Operating System :: OS Independent",
35+
"Programming Language :: Python",
36+
"Programming Language :: Python :: 3",
37+
"Topic :: Software Development",
38+
"Topic :: Software Development :: Libraries",
39+
"Topic :: Software Development :: Libraries :: Python Modules",
40+
]
41+
42+
[project.optional-dependencies]
43+
dev = ['pytest', 'pytest-cov', 'mypy', 'types-tabulate', 'types-six', 'pdoc']
44+
45+
[project.urls]
46+
homepage = "https://repo1.naudit.es/theseus/pysmart-exporter"
47+
48+
[project.entry-points."console_scripts"]
49+
pysmart_exporter = "pysmart_exporter.__main__:main"

pysmart_exporter/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@
66
# License for more details.
77
#
88
################################################################
9-
10-
__version__ = '0.3.1'

pysmart_exporter/__main__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
# License for more details.
77
#
88
################################################################
9-
"""The pysmart_exporter main file
10-
"""
9+
"""The pysmart_exporter main file"""
1110

1211
import prometheus_client
1312
from pysmart_exporter.collector import PySMARTCollector
@@ -28,16 +27,14 @@ def main():
2827

2928
if args['listen']:
3029
(ip, port) = args['listen'].split(':')
31-
prometheus_client.start_http_server(port=int(port),
32-
addr=ip, registry=registry)
30+
prometheus_client.start_http_server(port=int(port), addr=ip, registry=registry)
3331
while True:
3432
time.sleep(3600)
3533

3634
if args['textfile_name']:
3735
while True:
3836
collector.collect()
39-
prometheus_client.write_to_textfile(args['textfile_name'],
40-
registry)
37+
prometheus_client.write_to_textfile(args['textfile_name'], registry)
4138
if collector.args['oneshot']:
4239
sys.exit(0)
4340
time.sleep(args.get('interval', 60))

0 commit comments

Comments
 (0)