Skip to content

Commit

Permalink
🔀 Merge pull request #30 from davep/revamp
Browse files Browse the repository at this point in the history
Repo revamp
  • Loading branch information
davep authored Nov 27, 2024
2 parents 6fa173b + e69313c commit 0fe67fc
Show file tree
Hide file tree
Showing 18 changed files with 252 additions and 916 deletions.
19 changes: 8 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.12.0
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.4
hooks:
- id: isort
name: isort (python)
language_version: '3.10'
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
language_version: python3.10
# Run the linter.
- id: ruff
args: [ --fix, --select, I ]
# Run the formatter.
- id: ruff-format
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12.4
7 changes: 7 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# PISpy ChangeLog

## 0.9.0

**Released: 2024-11-27**

- Updated for newer versions of Textual.
- Internal tweaks.

## 0.8.0

**Released: 2024-06-16**
Expand Down
100 changes: 44 additions & 56 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,104 +1,92 @@
###############################################################################
# Common make values.
lib := pispy
run := pipenv run
app := pispy
src := src/
run := rye run
python := $(run) python
lint := $(run) pylint
lint := rye lint -- --select I
fmt := rye fmt
mypy := $(run) mypy
twine := $(run) twine
build := $(python) -m build
black := $(run) black

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

.PHONY: debug
debug:
TEXTUAL=devtools make

.PHONY: console
console:
$(run) textual console
run: # Run the code in a testing context
$(python) -m $(app)

##############################################################################
# Setup/update packages the system requires.
.PHONY: setup
setup: # Install all dependencies
pipenv sync --dev
setup: # Set up the repository for development
rye sync
$(run) pre-commit install

.PHONY: resetup
resetup: # Recreate the virtual environment from scratch
rm -rf $(shell pipenv --venv)
pipenv sync --dev

.PHONY: depsoutdated
depsoutdated: # Show a list of outdated dependencies
pipenv update --outdated

.PHONY: depsupdate
depsupdate: # Update all dependencies
pipenv update --dev

.PHONY: depsshow
depsshow: # Show the dependency graph
pipenv graph
rm -rf .venv
make setup

##############################################################################
# Checking/testing/linting/etc.
.PHONY: lint
lint: # Run Pylint over the library
$(lint) $(lib)
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 mypy
$(mypy) --scripts-are-modules $(lib)
$(mypy) --scripts-are-modules $(src)

.PHONY: stricttypecheck
stricttypecheck: # Perform a strict static type checks with mypy
$(mypy) --scripts-are-modules --strict $(lib)
$(mypy) --scripts-are-modules --strict $(src)

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

##############################################################################
# Package/publish.
.PHONY: package
package: # Package the library
$(build) -w
rye build

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

.PHONY: packagecheck
packagecheck: package spackage # Check the packaging.
$(twine) check dist/*
rye build --sdist

.PHONY: testdist
testdist: packagecheck # Perform a test distribution
$(twine) upload --skip-existing --repository testpypi dist/*
testdist: package # Perform a test distribution
rye publish --yes --skip-existing --repository testpypi --repository-url https://test.pypi.org/legacy/

.PHONY: dist
dist: packagecheck # Upload to pypi
$(twine) upload --skip-existing dist/*
dist: package # Upload to pypi
rye publish --yes --skip-existing

##############################################################################
# Utility.
.PHONY: ugly
ugly: # Reformat the code with black.
$(black) $(lib)

.PHONY: repl
repl: # Start a Python REPL
repl: # Start a Python REPL in the venv.
$(python)

.PHONY: updatedeps
updatedeps: # Update all dependencies
rye sync --update-all

.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 build directories
rm -rf build dist $(lib).egg-info
rm -rf dist

.PHONY: help
help: # Display this help
Expand Down
21 changes: 0 additions & 21 deletions Pipfile

This file was deleted.

Loading

0 comments on commit 0fe67fc

Please sign in to comment.