Skip to content

Commit

Permalink
fix: more trying to get makefile to work in github actions; ruff repl…
Browse files Browse the repository at this point in the history
…aces flake8 and "autopep8"
  • Loading branch information
MultifokalHirn committed Nov 15, 2023
1 parent 05ff33d commit 530c321
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 117 deletions.
35 changes: 22 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,29 @@ repos:
- id: check-added-large-files
# - id: check-json
- id: detect-private-key
- repo: https://github.com/pycqa/isort
rev: "5.12.0"
hooks:
- id: isort
name: isort (python)
additional_dependencies: [toml]
- repo: https://github.com/hhatto/autopep8
rev: "v2.0.4"
hooks:
- id: autopep8
- repo: https://github.com/PyCQA/flake8
rev: "6.1.0"
# - repo: https://github.com/pycqa/isort
# rev: "5.12.0"
# hooks:
# - id: isort
# name: isort (python)
# additional_dependencies: [toml]
# - repo: https://github.com/hhatto/autopep8
# rev: "v2.0.4"
# hooks:
# - id: autopep8
# - repo: https://github.com/PyCQA/flake8
# rev: "6.1.0"
# hooks:
# - id: flake8
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.5
hooks:
- id: flake8
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11.6
3.12.0
32 changes: 20 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,32 @@ MAKEFLAGS += --no-builtin-rules

# ENVIRONMENT_VARIABLE_FILE := .env

all: venv

install-pdm: venv
$(VENV)/pip install --upgrade pip setuptools wheel
$(VENV)/pip install pdm
$(VENV)/pdm config python.use_venv false
$(VENV)/pdm use --venv in-project
.PHONY: install-pdm

bootstrap: clean-venv venv install-pdm ## fresh install of venv and dependencies
# all: venv

python-version: ## Show the python version
# Show the python version
@python --version
.PHONY: python-version

# install-pdm: venv
# $(VENV)/python -V
# $(VENV)/pip install --upgrade pip setuptools wheel
# $(VENV)/pip install pdm
# $(VENV)/pdm config python.use_venv false
# $(VENV)/pdm use --venv in-project
# .PHONY: install-pdm

bootstrap: python-version clean-venv venv ## fresh install of venv and dependencies
.PHONY: bootstrap

prod: ## install prod dependencies
# install prod dependencies
$(VENV)/pdm sync --fail-fast --prod
.PHONY: dev

dev: ## install dev dependencies
$(VENV)/pdm sync --fail-fast --dev
dev: ## install all dependencies in lock file
# install all dependencies in lock file
$(VENV)/pdm sync
.PHONY: dev

ci: lint mypy test ## Run all checks (test, lint, typecheck)
Expand Down
10 changes: 6 additions & 4 deletions Makefile.venv
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,14 @@ endif

$(VENV):
$(PY) -m venv $(VENVDIR)
$(VENV)/python -m pip install --upgrade pip setuptools wheel
$(VENV)/python -m pip install --upgrade pip setuptools wheel pdm
$(VENV)/pdm config python.use_venv false
$(VENV)/pdm use --venv in-project

$(VENV)/$(MARKER): $(VENVDEPENDS) | $(VENV)
ifneq ($(strip $(REQUIREMENTS_TXT)),)
$(VENV)/pip install $(foreach path,$(REQUIREMENTS_TXT),-r $(path))
endif
# ifneq ($(strip $(REQUIREMENTS_TXT)),)
# $(VENV)/pip install $(foreach path,$(REQUIREMENTS_TXT),-r $(path))
# endif
ifneq ($(strip $(VENV_LOCAL_PACKAGE)),)
$(VENV)/pip install $(foreach path,$(sort $(VENV_LOCAL_PACKAGE)),-e $(dir $(path)))
endif
Expand Down
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Github Actions](https://github.com/MultifokalHirn/python_template_repo/workflows/Tests/badge.svg)](https://github.com/pdm-project/tox-pdm/actions)
[![Github Actions](https://github.com/MultifokalHirn/python_template_repo/workflows/Tests/badge.svg)](https://github.com/MultifokalHirn/python_template_repo/actions)
![GitHub last commit](https://img.shields.io/github/last-commit/MultifokalHirn/python_template_repo)
![GitHub issues](https://img.shields.io/github/issues/MultifokalHirn/python_template_repo)
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/MultifokalHirn/python_template_repo)
Expand All @@ -11,16 +11,15 @@
<!-- omit in toc -->

# Python Project Template
>
> Check out the [Roadmap](#roadmap) for planned features
This is my personal template for a python project containing everything needed to start developing.


## Features

<!-- ![constr](https://img.shields.io/badge/🏗️-under%20construction-FFD43B) -->


### Python Development

![py3](https://img.shields.io/badge/-python>=3.8.1-3776AB?logo=python&logoColor=FFFFFF&style=flat-square)
Expand Down Expand Up @@ -58,7 +57,6 @@ This is my personal template for a python project containing everything needed t
![visualstudiocode](https://img.shields.io/badge/-.vscode/-000000?logo=visualstudiocode&logoColor=007ACC&style=flat-square)
![templates](https://img.shields.io/badge/Templates-000000?logo=github&logoColor=FFFFFF&style=flat-square)


<!-- - [`Makefile`](./Makefile) for easy setup, testing, linting, etc.
- docker-compose for easy setup of dev environment
- Configuration for
Expand All @@ -69,9 +67,6 @@ This is my personal template for a python project containing everything needed t
- Templates for [Issues](./.github/ISSUE_TEMPLATE.md) and [PRs](./.github/PULL_REQUEST_TEMPLATE.md) on GitHub
- and more... -->




<!-- [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) -->

<!-- - GitHub Actions for
Expand Down
96 changes: 26 additions & 70 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 60 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,62 @@ version_files = [
"pyproject.toml:version",
]

[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
]

# Same as Black.
line-length = 127
indent-width = 4

# Assume Python 3.12
target-version = "py312"

[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
select = ["E4", "E7", "E9", "F"]
ignore = []

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"

[tool.pdm.dev-dependencies]
# pdm add -dG group package
base = [
Expand All @@ -94,13 +150,14 @@ base = [
"tox-pdm"
]
lint = [
"flake8",
# "flake8",
"ruff",
"mypy",
"mypy-extensions",
]
lint-fix = [
"autopep8",
"isort",
# "autopep8",
# "isort",
]
test = [
"pytest",
Expand Down
Loading

0 comments on commit 530c321

Please sign in to comment.