Skip to content

Commit b286290

Browse files
authored
Publish on PyPI (#68)
* Add flit config * Publish to PyPI on GH release
1 parent 50e64e2 commit b286290

File tree

7 files changed

+65
-7
lines changed

7 files changed

+65
-7
lines changed

.github/workflows/pypi.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: PyPI publish
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
8+
jobs:
9+
pypi-publish:
10+
name: Upload release to PyPI
11+
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.x'
20+
cache: pip
21+
22+
# build the package with flit
23+
- name: Build package
24+
run: pip install build && mv dool dool.py && python -m build
25+
26+
# publish with https://docs.pypi.org/trusted-publishers/
27+
- name: Publish package to PyPI
28+
uses: pypa/gh-action-pypi-publish@release/v1
29+
env:
30+
name: pypi
31+
url: https://pypi.org/p/dool

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
*.pyc
1+
*.pyc
2+
/dist

dool

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/usr/bin/env python3
22

3+
"""
4+
Dool is a command line tool to monitor many aspects of your system: CPU,
5+
Memory, Network, Load Average, etc. It also includes a robust plug-in
6+
architecture to allow monitoring other system metrics.
7+
"""
8+
39
### This program is free software; you can redistribute it and/or
410
### modify it under the terms of the GNU General Public License
511
### as published by the Free Software Foundation; either version 2
@@ -36,7 +42,7 @@ import signal
3642

3743
from collections.abc import Sequence
3844

39-
VERSION = '1.3.2'
45+
__version__ = '1.3.2'
4046

4147
theme = { 'default': '' }
4248

@@ -380,7 +386,7 @@ class Options:
380386
return ret
381387

382388
def version(self):
383-
print('Dool %s' % VERSION)
389+
print('Dool', __version__)
384390
print('Written by Scott Baker <scott@perturb.org>')
385391
print('Forked from Dstat written by Dag Wieers <dag@wieers.com>')
386392
print('Homepage at https://github.com/scottchiefbaker/dool/')
@@ -2649,7 +2655,7 @@ def main():
26492655
if op.output:
26502656
if not os.path.exists(op.output):
26512657
outputfile = open(op.output, 'w')
2652-
outputfile.write('"dool %s CSV output"\n' % VERSION)
2658+
outputfile.write('"dool %s CSV output"\n' % __version__)
26532659
header = ('"Author:","Scott Baker"','','','','"URL:"','"https://github.com/scottchiefbaker/dool/"\n')
26542660
outputfile.write(char['sep'].join(header))
26552661
else:

install.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import glob
1212
import os
1313
import shutil
14-
import pathlib
1514

1615
base_dir = os.path.dirname(__file__)
1716
base_dir = base_dir or "."

packaging/rpm/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ white="\033[1;37m"
55
reset="\033[0m"
66

77
# Extract the version number from the dool script
8-
export VERSION=`perl -nE 'if (/VERSION = .*?([\.\d]+)/) { print $1; } ' ../../dool`
8+
export VERSION=`perl -nE 'if (/__version__ = .*?([\.\d]+)/) { print $1; } ' ../../dool`
99

1010
if [[ -z $VERSION ]]
1111
then

packaging/rpm/dool.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Summary: Pluggable real-time performance monitoring tool
66
Name: dool
7-
Version: 1.1.0
7+
Version: replaced_by_build.sh
88
Release: 1
99
License: GPL
1010
Group: System Environment/Base

pyproject.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[build-system]
2+
requires = ["flit_core >=3.4,<4"]
3+
build-backend = "flit_core.buildapi"
4+
5+
[project]
6+
name = "dool"
7+
requires-python = "~=3.5"
8+
authors = [{name = "Scott Baker", email = "scott@perturb.org"}]
9+
readme = "README.md"
10+
license = {file = "LICENSE"}
11+
classifiers = ["License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)"]
12+
dynamic = ["version", "description"]
13+
14+
[project.urls]
15+
Home = "https://github.com/scottchiefbaker/dool"
16+
17+
[project.scripts]
18+
dool = "dool:__main"
19+
20+
[tool.flit.sdist]
21+
exclude = [".github/*", ".gitignore", "docs/*", "examples/*", "install.py", "packaging/*", "Makefile"]

0 commit comments

Comments
 (0)