Skip to content

Commit af0a349

Browse files
committed
Fixes
1 parent 64c7803 commit af0a349

4 files changed

Lines changed: 18 additions & 13 deletions

File tree

.DS_Store

-6 KB
Binary file not shown.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.venv/
2-
.vscode/
32
__pycache__/
43
*.py[cod]
54
*.egg-info/

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
# Python Project Template
2-
1+
## Python Apprentice
32

43
## Questions
54

6-
What is pyproject.toml?
7-
Why does src exist?
8-
Why do we need __init__.py?
9-
What belongs inside .gitignore?
5+
1. What is `pyproject.toml`?
6+
2. Why does the `src` directory exist?
7+
3. Why do we need `__init__.py`?
8+
4. What belongs inside `.gitignore`?
109

1110
## Answers
1211

13-
### pyproject.toml
12+
### `pyproject.toml`
1413

1514
pyproject.toml is a configuration file used by packaging tools, as well as other tools such as linters, type checkers, etc. There are three possible TOML tables in this file.
1615

@@ -19,18 +18,18 @@ The [project] table is the format that most build backends use to specify your p
1918
The [tool] table has tool-specific subtables, e.g., [tool.hatch], [tool.black], [tool.mypy]. We only touch upon this table here because its contents are defined by each tool. Consult the particular tool’s documentation to know what it can contain.
2019

2120

22-
### src
21+
### `src`
2322

2423
The “src layout” deviates from the flat layout by moving the code that is intended to be importable (i.e. import awesome_package, also known as import packages) into a subdirectory. This subdirectory is typically named src/, hence “src layout”.
2524

2625
The src layout helps enforce that an editable installation is only able to import files that were meant to be importable.
2726

2827
The flat layout would add the other project files (eg: README.md, tox.ini) and packaging/tooling configuration files (eg: setup.py, noxfile.py) on the import path. This would make certain imports work in editable installations but not regular installations.
2928

30-
### __init__.py
29+
### `__init__.py`
3130

3231
Python’s special __init__.py file marks a directory as a regular Python package and allows you to import its modules. This file runs automatically the first time you import its containing package. You can use it to initialize package-level variables, define functions or classes, and structure the package’s namespace clearly for users.
3332

34-
### .gitignore
33+
### `.gitignore`
3534

3635
You can create a .gitignore file in your repository's root directory to tell Git which files and directories to ignore when you make a commit. To share the ignore rules with other users who clone the repository, commit the .gitignore file into your repository.

pyproject.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
[build-system]
2+
requires = ["setuptools>=77"]
3+
build-backend = "setuptools.build_meta"
4+
15
[project]
2-
name = "python_apprentice"
6+
name = "python-apprentice"
37
version = "0.1.0"
48
description = "Exercises and projects from my Python apprenticeship program."
59
authors = [
@@ -10,4 +14,7 @@ requires-python = ">=3.11"
1014
dependencies = []
1115

1216
[project.urls]
13-
Repository = "https://github.com/arionvlad/python-apprentice"
17+
Repository = "https://github.com/arionvlad/python-apprentice"
18+
19+
[tool.setuptools.packages.find]
20+
where = ["src"]

0 commit comments

Comments
 (0)