Skip to content

Commit f16bfd4

Browse files
Merge pull request #1 from da5nsy/main
edits
2 parents 31440c4 + 3086d17 commit f16bfd4

File tree

6 files changed

+28
-27
lines changed

6 files changed

+28
-27
lines changed

episodes/1_intoduction_python_packaging.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,10 @@ Software development is a creative pursuit, and it is satisfying to write code t
3333

3434
By packaging code, you address several important challenges, including ensuring reproducibility, achieving cross-platform compatibility, and supporting multiple environments. Distributing code as a package offers many advantages over merely sharing source files, for example via GitHub:
3535

36-
Dependency management: A package can explicitly declare its dependencies. Tools such as pip (or uv) can then automatically install them for the user.
37-
38-
Versioning: You may version your package and distribute multiple versions, thereby supporting backwards compatibility.
39-
40-
Standardisation: Packaging is the established method of distributing code via recognised repositories such as PyPI.
41-
42-
Metadata: Packages include project-specific metadata, which is essential for end users.
36+
- Dependency management: A package can explicitly declare its dependencies. Tools such as pip (or uv) can then automatically install them for the user.
37+
- Versioning: You may version your package and distribute multiple versions, thereby supporting backwards compatibility.
38+
- Standardisation: Packaging is the established method of distributing code via recognised repositories such as PyPI.
39+
- Metadata: Packages include project-specific metadata, which is essential for end users.
4340

4441
## Python Package Structure Hierarchy
4542

@@ -67,7 +64,7 @@ Metadata: Packages include project-specific metadata, which is essential for end
6764
Any .py files (modules) or directories with __init__.py (packages) can be packaged.
6865

6966

70-
## What Is __init__.Py File in Python?
67+
## What Is __init__.py File in Python?
7168
The __init__.py file is a Python file that is executed when a package is imported.
7269
It serves two main purposes:
7370

@@ -78,7 +75,7 @@ It serves two main purposes:
7875

7976
## What is PyPI
8077

81-
PyPI is the repository where all released Python packages are made available for end users. You may explore it here: [PyPI](https://pypi.org/).
78+
[PyPI](https://pypi.org/) is the repository where all released Python packages are made available for end users.
8279
There is also [TestPyPI](https://test.pypi.org/), a repository which allows us to experiment with distribution tools and procedures without affecting the live PyPI. In this course, we will publish our package to TestPyPI.
8380

8481
## What is a Build ?

episodes/2_why_pixi.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ Pixi is a fast, modern and reproducible package management tool. It has lots of
2626

2727
Key features include:
2828

29-
- **Support for both PyPI and Conda packages** : enabling flexibility in sourcing dependencies.
30-
- **Performance** :lightweight and modern, designed for speed.
31-
- **Multi-language dependency management** : e.g. Python with Rust, or Python with C/C++.
32-
- **Integration with `uv`** : leveraging a high-performance package installer.
29+
- **Support for both PyPI and Conda packages**: enabling flexibility in sourcing dependencies.
30+
- **Performance**: lightweight and modern, designed for speed.
31+
- **Multi-language dependency management**: e.g. Python with Rust, or Python with C/C++.
32+
- **Integration with `uv`**: leveraging a high-performance package installer.
3333
- **Reproducibility**: guaranteed through the use of `pixi.lock`.
3434
- **Configuration via TOML files**: supports both `pixi.toml` and `pyproject.toml`.
3535

@@ -44,9 +44,10 @@ Pixi allows you to define dependencies for specific operating systems (e.g. Wind
4444

4545
## pyproject.toml
4646
For this demo, we will mainly focus on `pyproject.toml` file.
47-
We make this choice due to following specifications and recomendations : [PEP 621](https://peps.python.org/pep-0621/), [PEP 517](https://peps.python.org/pep-0517/), and [PEP 660](https://peps.python.org/pep-0660/)
47+
We make this choice due to following specifications and recomendations : [PEP 621](https://peps.python.org/pep-0621/), [PEP 517](https://peps.python.org/pep-0517/), and [PEP 660](https://peps.python.org/pep-0660/).
48+
49+
You can also read at these links:
4850

49-
You can also read at these links :
5051
- https://pixi.sh/v0.40.1/reference/pixi_manifest/#pypi-dependencies
5152
- https://pixi.sh/v0.40.1/advanced/pyproject_toml/
5253

episodes/3_project_structure.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ greet_me = { path = ".", editable = true }
7575
[tool.pixi.tasks]
7676
```
7777

78-
To add libraries via Pixi:
78+
To add libraries via Pixi use the `pixi add` command. Add the `requests` library:
7979
```bash
8080
pixi add requests
8181
```
@@ -111,13 +111,15 @@ Added these as pypi-dependencies.
111111
Check the `pyproject.toml` file. These get added under the `[project]` section
112112
```toml
113113
[project]
114+
authors = [{name = "Priyanka Demo", email = "demo@users.noreply.github.com"}]
114115
dependencies = ["requests>=2.32.5,<3"]
115116
name = "greet_me"
116117
```
117-
Please note : this wont create a problem when uploading the build but can create problems, when installing the builds.
118+
Please note: this won't create a problem when uploading the build but can create problems when installing the builds.
118119
So best to keep it empty for now and move this to `[tool.pixi.pypi-dependencies]` section , for all projects which need to come from via PyPI namely **build** and **twine** which are used to create and upload build respectively.
119120
```toml
120121
[project]
122+
authors = [{name = "Priyanka Demo", email = "demo@users.noreply.github.com"}]
121123
dependencies = []
122124
name = "greet_me"
123125
...
@@ -173,9 +175,11 @@ def greet_sad():
173175
The overall project structure should then resemble:
174176
```
175177
greet_me/
178+
├── .pixi
179+
├── .gitattributes
180+
├── .gitignore
176181
├── LICENSE
177182
├── pyproject.toml
178-
├── README.md
179183
├── pixi.lock # auto-generated, do not edit
180184
└── src/greet_me/
181185
├── __init__.py
@@ -187,7 +191,7 @@ greet_me/
187191

188192
## Running a Task
189193

190-
Task is a command alias that you can execute easily via the CLI (e.g., pixi run <task-name>).
194+
`task` is a command alias that you can execute easily via the CLI (e.g., pixi run task-name).
191195

192196
Run the following command to add a task and observe the changes in `pyproject.toml` file:
193197
```bash
@@ -215,6 +219,6 @@ You can read more about tasks [here](https://pixi.sh/dev/workspace/advanced_task
215219
- Follow the appropriate folder structure.
216220
- Always include the `__init__.py` file in packages.
217221
- Sequence of Pixi commands: **init****add****run****lock****install****update**.
218-
- Define / check `[project]`, `[dependencies]` and `[tasks]` in your `pyproject.toml` file .
222+
- Define / check `[project]`, `[dependencies]` and `[tasks]` in your `pyproject.toml` file.
219223

220224
::::::::::::::::::::::::::::::::::::::::::::::::

episodes/4_project_metadata.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Please note, for projects managed with Pixi, either `pyproject.toml` or `pixi.to
2727

2828
This section of a `pyproject.toml` file informs packaging tools such as `pip` which software is required to build your project. It specifies the **build backend** responsible for producing distributable packages such as wheels (`.whl`) or source distributions (`.sdist`).
2929

30-
This section was introduced by **[PEP 518]**(https://peps.python.org/pep-0518/) and is essential for modern Python packaging.
30+
This section was introduced by **[PEP 518](https://peps.python.org/pep-0518/)** and is essential for modern Python packaging.
3131
It has two main keys:
3232

3333
1. `requires`: A list of packages required to build the project. These are downloaded and installed into a temporary, isolated environment prior to the build process. The build backend itself must also be listed here.

index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ It is a roughly 2 hour course.
1818
- Structure a Python project following modern best practices.
1919
- Define clear and complete project metadata in pyproject.toml / pixi.toml.
2020
- Manage dependencies and lockfiles using Pixi to ensure consistent environments.
21-
- Build source and wheel distributions of a Python package..
21+
- Build source and wheel distributions of a Python package.
2222
- Publish a package to Test Python Package Index (TestPyPI) using Twine.
2323
- Install a package from TestPyPI using pip.
2424

learners/setup.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ Your Codespace environment will be **Linux-based**, so we will be using standard
2828

2929
:::::::::::::::::::::::::::::::::::::::::::::::::::
3030

31-
## Create a repository
31+
### Create a repository
3232

33-
- Log into [GitHub](https://github.com) and create a new repository for this lesson called `greet_me` and add a Licence File when creating the repository.
33+
- Log into [GitHub](https://github.com) and create a new repository for this lesson called `greet_me` and add a Licence File when creating the repository. In this case it doesn't matter which licence (this is just a practice repo) - we just need something to initialise the repo, and a licence to satisfy the TestPyPI requirements.
3434

3535
- From the repository page, open the **Code** dropdown menu, select the **Codespaces** tab, and click **Create codespace on main**.
3636

3737
<img width="416" height="353" alt="image" src="https://github.com/user-attachments/assets/15167dca-b8c3-4701-87ac-3d6cb2b1022b" />
3838

39+
If you get an error (e.g. "Oh no, it looks like you are offline!") try a different browser or incognito mode.
40+
3941
- Once your Codespace has been created, open the terminal inside it and run the following commands.
40-
41-
:::::::::::::::: spoiler
4242

4343
### Install Pixi
4444

@@ -71,5 +71,4 @@ pixi --version
7171
```output
7272
pixi 0.57.0
7373
```
74-
::::::::::::::::::::::::
7574

0 commit comments

Comments
 (0)