MCPcopy
hub / github.com/ycd/manage-fastapi / ProjectContext

Class ProjectContext

manage_fastapi/context.py:23–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22
23class ProjectContext(BaseModel):
24 name: str
25 folder_name: str
26 packaging: PackageManager
27
28 username: Optional[str] = None
29 email: Optional[EmailStr] = None
30
31 python: PythonVersion
32 fastapi: str = FASTAPI_VERSION
33
34 license: Optional[License]
35 year: int
36
37 pre_commit: bool
38 docker: bool
39
40 database: Optional[Database]
41
42 @root_validator(pre=True)
43 def validate_project(cls, values: dict):
44 try:
45 values["username"] = subprocess.check_output(
46 ["git", "config", "--get", "user.name"]
47 )
48 values["email"] = subprocess.check_output(
49 ["git", "config", "--get", "user.email"]
50 )
51 except subprocess.CalledProcessError:
52 ...
53 values["folder_name"] = values["name"].lower().replace(" ", "-").strip()
54 values["year"] = datetime.today().year
55 return values
56
57 class Config:
58 use_enum_values = True

Callers 1

startprojectFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected