Skip to content

Commit 334f86f

Browse files
committed
initail setup
1 parent a43a253 commit 334f86f

File tree

7 files changed

+132
-1
lines changed

7 files changed

+132
-1
lines changed

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Virtual environment
7+
venv/
8+
.venv/
9+
10+
# Environment variables
11+
.env
12+
.env.*
13+
!.env.example # Keep the example file
14+
15+
# Unit test / coverage reports
16+
.pytest_cache/
17+
.coverage
18+
htmlcov/
19+
20+
# Static analysis cache
21+
.mypy_cache/
22+
.flake8
23+
.isort.cfg
24+
.black.cfg
25+
26+
# Distribution / packaging
27+
/dist/
28+
/build/
29+
*.egg-info/
30+
.installed.cfg
31+
*.egg
32+
/docs/_build/
33+
34+
# IDE-specific files (remove the ones you don't use)
35+
# PyCharm
36+
.idea/
37+
# VS Code
38+
.vscode/
39+
40+
# Operating System files
41+
.DS_Store
42+
Thumbs.db

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# .pre-commit-config.yaml
2+
repos:
3+
- repo: https://github.com/PyCQA/flake8
4+
rev: 7.1.0 # Use the latest version
5+
hooks:
6+
- id: flake8
7+
additional_dependencies: [flake8-bugbear] # optional flake8 plugin
8+
- repo: https://github.com/psf/black
9+
rev: 24.4.2 # Use the latest version
10+
hooks:
11+
- id: black
12+
- repo: https://github.com/pycqa/isort
13+
rev: 5.13.2 # Use the latest version
14+
hooks:
15+
- id: isort
16+
args: ["--profile", "black"]
17+
- repo: https://github.com/pre-commit/mirrors-mypy
18+
rev: v1.11.1 # Use the latest version
19+
hooks:
20+
- id: mypy

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# python-ref
1+
# Python Reference Project
22

33
This project serves as a starter template for building python based projects.

pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[tool.flake8]
2+
# Ignores commonly addressed style issues handled by Black and isort
3+
ignore = ["E203", "E501", "W503"]
4+
max-line-length = 88
5+
6+
[tool.isort]
7+
profile = "black" # Use settings compatible with the Black formatter
8+
9+
[tool.black]
10+
line-length = 88 # Match the line length setting in Flake8
11+
12+
[tool.mypy]
13+
# Excludes the virtual environment directory from mypy checks
14+
exclude = ["venv/*"]
15+
# Additional mypy configuration can go here. For example:
16+
# disallow_untyped_defs = true
17+
18+
[tool.check]
19+
command = "isort src/ && black src/ && flake8 src/ && mypy src/"

requirements.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
autopep8==2.3.2
2+
black==25.9.0
3+
cfgv==3.4.0
4+
click==8.1.8
5+
distlib==0.4.0
6+
exceptiongroup==1.3.0
7+
filelock==3.19.1
8+
flake8==7.3.0
9+
identify==2.6.14
10+
iniconfig==2.1.0
11+
isort==6.0.1
12+
mccabe==0.7.0
13+
mypy==1.18.2
14+
mypy_extensions==1.1.0
15+
nodeenv==1.9.1
16+
packaging==25.0
17+
pathspec==0.12.1
18+
platformdirs==4.4.0
19+
pluggy==1.6.0
20+
pre_commit==4.3.0
21+
pycodestyle==2.14.0
22+
pyflakes==3.4.0
23+
Pygments==2.19.2
24+
pytest==8.4.2
25+
pytokens==0.1.10
26+
PyYAML==6.0.3
27+
tomli==2.2.1
28+
typing_extensions==4.15.0
29+
virtualenv==20.34.0

src/main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# src/main.py
2+
def greet(name):
3+
return f"Hello, {name}!"
4+
5+
6+
if __name__ == "__main__":
7+
print(greet("World"))

test_main.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# test_main.py
2+
from src.main import greet
3+
4+
5+
def test_greet_world():
6+
assert greet("World") == "Hello, World!"
7+
8+
9+
def test_greet_name():
10+
assert greet("Alice") == "Hello, Alice!"
11+
12+
13+
def test_greet_empty_string():
14+
assert greet("") == "Hello, !"

0 commit comments

Comments
 (0)