feat: rework default entries
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
from ..entry import Entry
|
||||
|
||||
|
||||
class PythonEntry(Entry):
|
||||
TYPE: str = "python"
|
||||
COMMANDS = {
|
||||
"setup": [
|
||||
["poetry", "env", "use", "3.8"],
|
||||
["poetry", "install"],
|
||||
],
|
||||
"lint": [
|
||||
["poetry", "run", "black", "--check", "--diff", "./"],
|
||||
["poetry", "run", "isort", "--profile", "black", "--check-only", "./"],
|
||||
],
|
||||
"format": [
|
||||
["poetry", "run", "isort", "./"],
|
||||
["poetry", "run", "black", "./"],
|
||||
],
|
||||
"test": [
|
||||
["poetry", "run", "pytest", "-p", "no:warnings"],
|
||||
],
|
||||
}
|
||||
|
||||
def __init__(self, basepath: Path):
|
||||
super().__init__(self.TYPE, self.COMMANDS, basepath)
|
||||
|
||||
@classmethod
|
||||
def detect(cls, basepath: Path) -> Optional["PythonEntry"]:
|
||||
if (basepath / "pyproject.toml").exists():
|
||||
return cls(basepath)
|
||||
Reference in New Issue
Block a user