Skip to content

Commit 743931b

Browse files
chore: refactor into standard python package
1 parent 7358827 commit 743931b

21 files changed

Lines changed: 98 additions & 99 deletions

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
3535
- name: Get version
3636
id: get_version
37-
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT
37+
run: echo "VERSION=$(cat upk/VERSION)" >> $GITHUB_OUTPUT
3838

3939
- name: Create Release
4040
id: create_release

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.2.1] - 2026-03-18
6+
7+
### Refactored
8+
- **Project Structure**: Completely reorganized into a standard Python package format.
9+
- **Packaging**: Switched to `pyproject.toml` and declarative metadata.
10+
- **Infrastructure**: Simplified `setup.py`, `build.sh`, and `pacscript` logic.
11+
512
## [1.2.0] - 2026-03-14
613

714
### Added

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
include README.md
22
include LICENSE
3-
recursive-include backends *.py
4-
include VERSION
3+
recursive-include upk/backends *.py
4+
include upk/VERSION

VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

build.sh

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if [[ $EUID -eq 0 ]]; then
3535
fi
3636

3737
# Read version from VERSION file
38-
VERSION=$(cat VERSION)
38+
VERSION=$(cat upk/VERSION)
3939
print_status "Building UPK version: $VERSION"
4040

4141
# Create temporary directory for packaging
@@ -47,21 +47,14 @@ mkdir -p "$TEMP_DIR"/{DEBIAN,usr/bin,usr/share/doc/upk,usr/lib/python3/dist-pack
4747

4848
# Copy source files to package structure
4949
print_status "Copying source files to package structure..."
50-
cp -r backends "$TEMP_DIR/usr/lib/python3/dist-packages/upk/"
51-
cp config.py "$TEMP_DIR/usr/lib/python3/dist-packages/upk/"
52-
cp display.py "$TEMP_DIR/usr/lib/python3/dist-packages/upk/"
53-
cp search.py "$TEMP_DIR/usr/lib/python3/dist-packages/upk/"
54-
cp utils.py "$TEMP_DIR/usr/lib/python3/dist-packages/upk/"
55-
cp upk.py "$TEMP_DIR/usr/lib/python3/dist-packages/upk/"
56-
cp VERSION "$TEMP_DIR/usr/lib/python3/dist-packages/upk/"
50+
cp -r upk/* "$TEMP_DIR/usr/lib/python3/dist-packages/upk/"
5751

5852
# Create wrapper script
5953
print_status "Creating wrapper script..."
6054
cat > "$TEMP_DIR/usr/bin/upk" << 'EOF'
6155
#!/bin/bash
6256
# UPK wrapper script
63-
cd /usr/lib/python3/dist-packages/upk
64-
exec python3 upk.py "$@"
57+
exec python3 -m upk.upk "$@"
6558
EOF
6659

6760
chmod +x "$TEMP_DIR/usr/bin/upk"
@@ -80,7 +73,7 @@ fi
8073

8174
# Set PYTHONPATH to current directory to ensure backends can be imported
8275
export PYTHONPATH=$PYTHONPATH:.
83-
_UPK_COMPLETE=bash_source python3 upk.py > "$TEMP_DIR/usr/share/bash-completion/completions/upk"
76+
_UPK_COMPLETE=bash_source python3 -m upk.upk > "$TEMP_DIR/usr/share/bash-completion/completions/upk"
8477
print_success "Bash completion script created"
8578

8679
# Create control file from template

pyproject.toml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,44 @@
22
name = "upk"
33
dynamic = ["version"]
44
description = "Ubuntu Package Kit - Universal package manager wrapper"
5-
authors = [{name = "undefinederror (Lorenzo Paci)"}]
5+
authors = [
6+
{ name = "undefinederror (Lorenzo Paci)", email = "github@object.ninja" }
7+
]
8+
readme = "README.md"
69
requires-python = ">=3.10"
10+
keywords = ["package manager", "apt", "snap", "flatpak", "pacstall", "appimage"]
11+
classifiers = [
12+
"Development Status :: 4 - Beta",
13+
"Intended Audience :: Developers",
14+
"License :: OSI Approved :: MIT License",
15+
"Operating System :: POSIX :: Linux",
16+
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3.10",
18+
"Programming Language :: Python :: 3.11",
19+
"Programming Language :: Python :: 3.12",
20+
"Topic :: System :: Installation/Setup",
21+
"Topic :: System :: Software Distribution",
22+
"Topic :: Utilities",
23+
]
724
dependencies = [
825
"click>=8.1.0",
926
"rich>=13.0.0",
1027
]
1128

29+
[project.urls]
30+
"Bug Reports" = "https://github.com/undefinederror/upk/issues"
31+
"Source" = "https://github.com/undefinederror/upk"
32+
1233
[project.scripts]
13-
upk = "upk:cli"
34+
upk = "upk.upk:cli"
1435

1536
[build-system]
1637
requires = ["setuptools>=61.0"]
1738
build-backend = "setuptools.build_meta"
1839

1940
[tool.setuptools.dynamic]
20-
version = {file = "VERSION"}
41+
version = {file = "upk/VERSION"}
42+
43+
[tool.setuptools]
44+
packages = ["upk", "upk.backends"]
45+
include-package-data = true

setup.py

Lines changed: 2 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,6 @@
11
#!/usr/bin/env python3
22
"""Setup script for UPK - Ubuntu Package Kit."""
33

4-
from setuptools import setup, find_packages
5-
from pathlib import Path
4+
from setuptools import setup
65

7-
# Read the README file
8-
this_directory = Path(__file__).parent
9-
long_description = (this_directory / "README.md").read_text()
10-
11-
# Read requirements from pyproject.toml
12-
def get_requirements():
13-
"""Extract dependencies from pyproject.toml."""
14-
import tomllib
15-
pyproject_path = this_directory / "pyproject.toml"
16-
if pyproject_path.exists():
17-
with open(pyproject_path, "rb") as f:
18-
pyproject_data = tomllib.load(f)
19-
return pyproject_data.get("project", {}).get("dependencies", [])
20-
return []
21-
22-
def get_version():
23-
"""Read version from VERSION file."""
24-
version_path = this_directory / "VERSION"
25-
if version_path.exists():
26-
return version_path.read_text().strip()
27-
return "1.1.0"
28-
29-
setup(
30-
name="upk",
31-
version=get_version(),
32-
description="Ubuntu Package Kit - Universal package manager wrapper",
33-
long_description=long_description,
34-
long_description_content_type="text/markdown",
35-
author="undefinederror (Lorenzo Paci)",
36-
author_email="github@object.ninja",
37-
url="https://github.com/undefinederror/upk",
38-
packages=find_packages(),
39-
include_package_data=True,
40-
install_requires=get_requirements(),
41-
entry_points={
42-
"console_scripts": [
43-
"upk=upk:cli",
44-
],
45-
},
46-
classifiers=[
47-
"Development Status :: 4 - Beta",
48-
"Intended Audience :: Developers",
49-
"License :: OSI Approved :: MIT License",
50-
"Operating System :: POSIX :: Linux",
51-
"Programming Language :: Python :: 3",
52-
"Programming Language :: Python :: 3.10",
53-
"Programming Language :: Python :: 3.11",
54-
"Programming Language :: Python :: 3.12",
55-
"Topic :: System :: Installation/Setup",
56-
"Topic :: System :: Software Distribution",
57-
"Topic :: Utilities",
58-
],
59-
python_requires=">=3.10",
60-
keywords="package manager apt snap flatpak pacstall appimage",
61-
project_urls={
62-
"Bug Reports": "https://github.com/yourusername/upk/issues",
63-
"Source": "https://github.com/yourusername/upk",
64-
},
65-
)
6+
setup()

upk/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.2.1

upk/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)