Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy and Release
name: Publish

on:
push:
Expand Down Expand Up @@ -29,30 +29,24 @@ jobs:
with:
python-version: "3.x"

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "latest"

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install build twine
pip install -r requirements.txt
make setup
uv pip install twine

- name: Build the package
run: python -m build --no-isolation
run: uv build --link-mode copy

- name: List dist directory
run: ls -l dist/

- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: dist/*.tar.gz,dist/*.whl
tag: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
draft: false
prerelease: false

- name: Check distribution's long description rendering on PyPI
run: twine check dist/*
run: uv run twine check dist/*

- name: Publish package
if: github.repository == 'xMohnad/MangaDM'
uses: pypa/gh-action-pypi-publish@release/v1
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

96 changes: 96 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
lib := mangadm
src := src/
run := uv run
sync := uv sync
build := uv build
python := $(run) python
ptpython := $(run) ptpython
ruff := $(run) ruff
lint := $(ruff) check --select I
fmt := $(ruff) format
basedpyright := $(run) basedpyright
spell := $(run) codespell

##############################################################################
# Local "interactive testing" of the code.
.PHONY: run
run: # Run the code with debug enabled
$(python) -m $(lib) -h


##############################################################################
# Setup/update packages the system requires.
.PHONY: setup
setup: # Set up the repository for development
uv venv --allow-existing
$(sync)

.PHONY: update
update: # Update all dependencies
$(sync) --upgrade

.PHONY: resetup
resetup: realclean # Recreate the virtual environment from scratch
make setup

##############################################################################
# Checking/testing/linting/etc.
.PHONY: lint
lint: # Check the code for linting issues
$(lint) $(src)

.PHONY: codestyle
codestyle: # Is the code formatted correctly?
$(fmt) --check $(src)

.PHONY: typecheck
typecheck: # Perform static type checks with basedpyright
$(basedpyright) $(src)

.PHONY: spellcheck
spellcheck: # Spell check the code
$(spell) *.md $(src)

.PHONY: checkall
checkall: spellcheck codestyle lint stricttypecheck # Check all the things

##############################################################################
# Package
.PHONY: package
package: # Package the library
$(build)

.PHONY: spackage
spackage: # Create a source package for the library
$(build) --sdist

##############################################################################
# Utility.
.PHONY: repl
repl: # Start a ptPython REPL in the venv.
$(run) $(ptpython)

.PHONY: delint
delint: # Fix linting issues.
$(lint) --fix $(src)

.PHONY: pep8ify
pep8ify: # Reformat the code to be as PEP8 as possible.
$(fmt) $(src)

.PHONY: tidy
tidy: delint pep8ify # Tidy up the code, fixing lint and format issues.

.PHONY: clean
clean: # Clean the package building files
rm -rf dist/ build/ $(src)*.egg-info .pytest_cache
find . -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
find . -name "*.pyc" -delete

.PHONY: realclean
realclean: clean # Clean the venv and build directories
rm -rf .venv

.PHONY: help
help: # Display this help
@grep -Eh "^[a-z]+:.+# " $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.+# "}; {printf "%-20s %s\n", $$1, $$2}'
Loading