Skip to content

Commit c0d7f7d

Browse files
committed
Prepare project for PyPi release
1 parent 7905002 commit c0d7f7d

File tree

11 files changed

+110
-9
lines changed

11 files changed

+110
-9
lines changed

.github/workflows/main-build.yml

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

4545
# Run the unified build script (no arguments needed)
4646
- name: Run build script
47-
run: pyinstaller --onefile --name ssh-tunnel-manager main.py
47+
run: pyinstaller --onefile --name ssh-tunnel-manager --icon=ssh_tunnel_manager/icon.ico ssh_tunnel_manager/main.py
4848

4949
# Upload the artifacts prepared by build.py
5050
- name: Upload Artifacts
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish Python Package to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
name: Build and publish Python package to PyPI
11+
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
14+
contents: read
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.x'
24+
25+
- name: Install build dependencies
26+
run: python -m pip install --upgrade pip build twine
27+
28+
- name: Build package
29+
run: python -m build
30+
31+
- name: Publish package to PyPI
32+
uses: pypa/gh-action-pypi-publish@release/v1
33+
# user: __token__
34+
# password: ${{ secrets.PYPI_API_TOKEN }}

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"configurations": [
44
{
55
"name": "SSH Tunnel Manager",
6-
"type": "python",
6+
"type": "debugpy",
77
"request": "launch",
8-
"program": "${workspaceFolder}/main.py",
8+
"module": "ssh_tunnel_manager.main",
99
"console": "integratedTerminal",
1010
"justMyCode": true,
1111
"env": {

pyproject.toml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
[build-system]
2+
requires = ["setuptools>=42", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "ssh-tunnel-manager"
7+
version = "0.1.1"
8+
description = "A manager for SSH tunnels with a GUI."
9+
readme = "README.md"
10+
requires-python = ">=3.8"
11+
license = {file = "LICENSE"}
12+
authors = [
13+
{name = "NtWriteCode", email = "[email protected]"},
14+
]
15+
keywords = ["ssh", "tunnel", "network", "gui"]
16+
classifiers = [
17+
"Development Status :: 4 - Beta",
18+
"Intended Audience :: Developers",
19+
"Intended Audience :: System Administrators",
20+
"License :: OSI Approved :: MIT License",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.8",
23+
"Programming Language :: Python :: 3.9",
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
"Programming Language :: Python :: 3.12",
27+
"Topic :: System :: Networking",
28+
"Topic :: Utilities",
29+
"Framework :: Pytest",
30+
"Environment :: X11 Applications :: Qt",
31+
"Topic :: Software Development :: User Interfaces",
32+
]
33+
34+
dependencies = [
35+
"PyQt6>=6.0.0",
36+
"typing-extensions>=4.0.0",
37+
]
38+
39+
[project.urls]
40+
"Homepage" = "https://github.com/NtWriteCode/ssh-tunnel-manager"
41+
"Bug Tracker" = "https://github.com/NtWriteCode/ssh-tunnel-manager/issues"
42+
43+
[project.scripts]
44+
ssh-tunnel-manager = "ssh_tunnel_manager.main:main"
45+
46+
[tool.setuptools.packages.find]
47+
where = ["."]
48+
include = ["ssh_tunnel_manager*"]
49+
exclude = ["tests*"]
50+
51+
# If you have data files like your icon.png that need to be included:
52+
[tool.setuptools.package-data]
53+
"ssh_tunnel_manager" = ["icon.ico"] # Example, adjust as needed

requirements.dev.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build
2+
twine
3+
pyinstaller

ssh_tunnel_manager/__init__.py

Whitespace-only changes.
File renamed without changes.

gui.py renamed to ssh_tunnel_manager/gui.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33
import os
44
from typing import Optional, Dict, Any
5+
import importlib.resources # Added for icon loading
56

67
from PyQt6.QtWidgets import (
78
QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout,
@@ -12,13 +13,21 @@
1213
from PyQt6.QtCore import Qt, QProcess, QProcessEnvironment, QTimer
1314
from PyQt6.QtGui import QIcon, QCloseEvent
1415

15-
import config
16-
import utils
16+
from . import config
17+
from . import utils
1718

1819
# Find the directory of the script to locate the icon
1920
# This might need adjustment based on how the app is packaged
20-
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
21-
ICON_PATH = os.path.join(SCRIPT_DIR, 'icon.png') # Assuming icon.png is in the same dir
21+
# SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
22+
# ICON_PATH = os.path.join(SCRIPT_DIR, 'icon.png') # Assuming icon.png is in the same dir
23+
ICON_PATH = None
24+
try:
25+
with importlib.resources.path("ssh_tunnel_manager", "icon.ico") as icon_path_obj:
26+
ICON_PATH = str(icon_path_obj)
27+
except FileNotFoundError:
28+
print("Warning: icon.ico not found in package.")
29+
# You could try to load a default icon or skip setting it
30+
# For now, ICON_PATH will remain None if not found
2231

2332
class MainWindow(QMainWindow):
2433
def __init__(self):
@@ -32,8 +41,10 @@ def __init__(self):
3241
self.setGeometry(100, 100, 700, 550) # Adjusted initial size
3342

3443
# Set window icon (optional, requires icon.png)
35-
if os.path.exists(ICON_PATH):
44+
if ICON_PATH and os.path.exists(ICON_PATH):
3645
self.setWindowIcon(QIcon(ICON_PATH))
46+
else:
47+
print("GUI: Icon not loaded or path does not exist.")
3748

3849
self.central_widget = QWidget()
3950
self.setCentralWidget(self.central_widget)

ssh_tunnel_manager/icon.ico

156 KB
Binary file not shown.

main.py renamed to ssh_tunnel_manager/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Main application entry point
22
import sys
33
from PyQt6.QtWidgets import QApplication
4-
from gui import MainWindow
4+
from .gui import MainWindow
55

66
def main():
77
app = QApplication(sys.argv)

0 commit comments

Comments
 (0)