Skip to content

Commit ca565a9

Browse files
committed
Configure Python development tooling
1 parent 675e9e8 commit ca565a9

8 files changed

Lines changed: 55 additions & 12 deletions

File tree

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["ms-python.python", "ms-python.vscode-pylance", "charliermarsh.ruff"]
3+
}

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"python.pythonPath": "${workspaceFolder}/.venv/bin/python",
3+
"python.analysis.extraPaths": ["${workspaceFolder}/src"],
4+
"python.testing.pytestEnabled": true,
5+
"python.testing.unittestEnabled": false,
6+
"python.testing.pytestArgs": ["tests"],
7+
"[python]": {
8+
"editor.defaultFormatter": "charliermarsh.ruff",
9+
"editor.formatOnSave": true,
10+
"editor.codeActionsOnSave": {
11+
"source.fixAll.ruff": "explicit",
12+
"source.organizeImports.ruff": "explicit"
13+
}
14+
}
15+
}

pyproject.toml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,31 @@ dependencies = []
1616
[project.urls]
1717
Repository = "https://github.com/arionvlad/python-apprentice"
1818

19+
[project.optional-dependencies]
20+
dev = [
21+
"mypy",
22+
"pytest",
23+
"ruff",
24+
]
25+
1926
[tool.setuptools.packages.find]
20-
where = ["src"]
27+
where = ["src"]
28+
29+
[tool.ruff]
30+
line-length = 88
31+
target-version = "py311"
32+
33+
[tool.ruff.lint]
34+
select = ["E", "F", "I", "UP"]
35+
36+
[tool.ruff.format]
37+
quote-style = "double"
38+
39+
[tool.mypy]
40+
python_version = "3.11"
41+
strict = true
42+
files = ["src", "tests"]
43+
44+
[tool.pytest.ini_options]
45+
testpaths = ["tests"]
46+
pythonpath = ["src"]

src/python_apprentice/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22

33
from __future__ import annotations
44

5-
6-
def greet(name: str) -> str:
7-
return f"Hello, {name}!"
8-
9-
5+
from .greetings import greet
106
from .main import main
117

128
__all__ = ["greet", "main"]

src/python_apprentice/greetings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# greetings.py
2+
def greet(name: str) -> str:
3+
return f"Hello, {name}!"

src/python_apprentice/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from . import greet
5+
from .greetings import greet
66

77

88
def main() -> None:

tests/test_greeting.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from python_apprentice.greetings import greet
2+
3+
4+
def test_greet_returns_personalized_message() -> None:
5+
assert greet("Vlad") == "Hello, Vlad!"

tests/test_my_package.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)