@@ -72,7 +72,7 @@ In this lecture, we work with pip, because ...
7272- PEP is an evolving design document which provides information regarding new features, processes and new environments.
7373- PEPs typically involve concise technical information, which also acts as standardizations.
7474- Packaging is standardized by [ Packaging PEPs] ( https://peps.python.org/topic/packaging/ ) .
75- - Example of a Packaging PEP:
75+ - Example of a Packaging PEP: [ PEP 427 – The Wheel Binary Package Format 1.0 ] ( https://peps.python.org/pep-0427/ ) .
7676
7777---
7878
@@ -82,6 +82,7 @@ Distribution package
8282
8383- Something you can install.
8484- ` pip install pkg ` .
85+ - Directly acquired from a packaging index.
8586
8687Import package
8788
@@ -104,43 +105,49 @@ Read more about [distribution package vs. import package](https://packaging.pyth
104105
105106---
106107
107- ## Create the source tree 1/2
108+ ## Create the source tree 1/3
108109
109- Four places where naming is relevant :
110+ Source tree of code :
110111
111- - Name of the repository (on GitHub or GitLab).
112- - Name of the folder which has the source code.
113- - Name of the package as seen by PyPI.
114- - Name of the package to be used in the ` import ` statement.
112+ ``` bash
113+ application/
114+ ├── source.py
115+ ├── tests/
116+ ```
115117
116- ** All names are independent of each other. **
118+ ` source.py ` contains the code. It can be multiple files.
117119
118- Example folder structure:
120+ ---
121+
122+ ## Create the source tree 2/3
123+
124+ Once the file structuring is complete, the source tree is:
119125
120126``` bash
121- generic_folder_name/
122- - src/
123- - __init__.py
124- - source-code.py
127+ application/
128+ ├── LICENSE
129+ ├── README.md
130+ ├── pyproject.toml
131+ ├── package_name/
132+ | ├── __init__.py
133+ | ├── source.py
134+ └── tests/
125135```
126136
127- - The file ` __init__.py ` is required to import the ` package_name/ ` as a package. This file is mostly empty
128- - ` source-code.py ` contains the code. It can be multiple files.
137+ - The file ` __init__.py ` is required to import the directory ` package_name/ ` as a package.
129138
130139---
131140
132- ## Create the source tree 2/2
141+ ## Create the source tree 3/3
133142
134- - Once the file structuring is complete, the source tree is :
143+ Four places where naming is relevant :
135144
136- ``` bash
137- generic_folder_name/
138- - pyproject.toml
139- - src/
140- - __init__.py
141- - source-code.py
142- - tests/
143- ```
145+ - Name of the repository (on GitHub or GitLab).
146+ - Name of the folder which has the source code.
147+ - Name of the distribution package.
148+ - Name of the import package.
149+
150+ ** All names are independent of each other, but try to have one name.**
144151
145152---
146153
@@ -192,6 +199,8 @@ Read more in [is setup.py deprecated?](https://packaging.python.org/en/latest/di
192199
193200Source distribution (sdist) vs. built distribution (wheel)
194201
202+ Base command is ` python3 -m build ` .
203+
195204---
196205
197206## Create Build Artifacts 2/3
@@ -310,7 +319,9 @@ List packages by running
310319pip freeze
311320```
312321
313- or
322+ also useful to generate ` requirements.txt ` : ` pip freeze > requirements.txt ` .
323+
324+ Additionally what works is
314325
315326``` bash
316327pipx list
@@ -320,7 +331,7 @@ pipx list
320331
321332## PyPI
322333
323- - [ PyPI] ( https://pypi.org/ ) = ** Python Package Index** is a repository of software developed in the Python community .
334+ - [ PyPI] ( https://pypi.org/ ) = ** Python Package Index** is an online index of Python packages .
324335- PyPI itself is developed on GitHub through another software called [ Warehouse] ( https://github.com/pypa/warehouse ) .
325336- PyPI has an informative [ public dashboard] ( https://p.datadoghq.com/sb/7dc8b3250-85dcf667bd ) to show its activity.
326337- A major advantage is the active maintenance of PyPI and the packages indexed in it.
@@ -356,10 +367,9 @@ pip install --index-url https://test.pypi.org/simple/ <package-name>
356367
357368## Important takeaways
358369
359- Packaging of Python code is
360-
361- - creation of a standardized folder structure to convert raw Python code into a project.
362- - creating and uploading distribution archives.
363- - Uploading distribution archives to a package index.
370+ Packaging of Python code consists of ...
364371
365- We saw the process of packaging and uploading to TestPyPI which is similar to uploading to the PyPI.
372+ - ... creating a standardized folder structure to convert raw Python code into a project.
373+ - ... creating build artifacts.
374+ - ... uploading build artifacts to a package index.
375+ - ... testing if the uploaded package can be installed.
0 commit comments