Skip to content

Commit dea37e1

Browse files
Merge pull request #3 from da5nsy/main
more edits!
2 parents d788811 + 783066b commit dea37e1

File tree

4 files changed

+29
-25
lines changed

4 files changed

+29
-25
lines changed

episodes/4_project_metadata.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ It has two main keys:
3838
requires = ["hatchling"]
3939
build-backend = "hatchling.build"
4040
```
41-
Some other build tools to read are
42-
- [pdm.backend](https://backend.pdm-project.org) e.g. [fastapi](https://github.com/fastapi/fastapi/blob/master/pyproject.toml)
43-
- [mesonpy](https://mesonbuild.com/meson-python/) e.g. [numpy](https://github.com/numpy/numpy/blob/main/pyproject.toml)
44-
- [setuptools.build_meta]() e.g. [parselmouth](https://github.com/prefix-dev/parselmouth/blob/main/pyproject.toml)
41+
Some other build tools to read are:
42+
43+
- [pdm.backend](https://backend.pdm-project.org) e.g. [fastapi](https://github.com/fastapi/fastapi/blob/cd40c5b40ffd8ba0c6a6a6c96bbf34ec1cf9c525/pyproject.toml#L2)
44+
- [mesonpy](https://mesonbuild.com/meson-python/) e.g. [numpy](https://github.com/numpy/numpy/blob/1d053b3482b178ed057474402ae94c80701796e0/pyproject.toml#L2)
45+
- [setuptools.build_meta](https://setuptools.pypa.io/en/latest/build_meta.html) e.g. [parselmouth](https://github.com/prefix-dev/parselmouth/blob/eb3eda68672ba95871719866403318690e1b37be/pyproject.toml#L3)
4546

4647
## Editable Installation
4748

48-
Projects may be installed in editable mode, which allows you to make changes to the source code and have them reflected immediately in the environment without reinstallation. For example, the `greet_me` package can be added as an editable dependency.
49+
Projects may be installed in editable mode, which allows you to make changes to the source code and have them reflected immediately in the environment without reinstallation. For example, the `greet_me` package we are creating is listed as editable by default.
4950

5051
```toml
5152
[tool.pixi.pypi-dependencies]
@@ -58,8 +59,9 @@ greet_me = { path = ".", editable = true }
5859
requires-python = ">=3.11, <3.12"
5960
```
6061
Additional sections in `pyproject.toml` may include:
61-
`[tool.pixi.workspace]`: Defines project-wide settings, including package sources and target platforms for resolution.
62-
`[tool.pixi.pypi-dependencies]` : Declares the dependencies to be installed from PyPI (or equivalent sources). These are the external libraries required by the project.
62+
63+
- `[tool.pixi.workspace]`: Defines project-wide settings, including package sources and target platforms for resolution.
64+
- `[tool.pixi.pypi-dependencies]` : Declares the dependencies to be installed from PyPI (or equivalent sources). These are the external libraries required by the project.
6365

6466
You can specify a range or multiple supported Python versions using the syntax below.
6567
```toml
@@ -69,11 +71,11 @@ Final `pyproject.toml` should look like this below, for reference.
6971

7072
```toml
7173
[project]
72-
authors = [{name = "Priyanka O"}]
74+
authors = [{name = "Priyanka Demo", email = "demo@users.noreply.github.com"}]
7375
dependencies = []
7476
name = "greet_me"
7577
requires-python = ">= 3.11"
76-
version = "0.1.2"
78+
version = "0.1.0"
7779
description = "greet_me Pixi-managed package"
7880
readme = "README.md"
7981

@@ -93,13 +95,14 @@ greet_me = { path = ".", editable = true }
9395
start = "python -c 'from greet_me import happy; print(happy.greet_happy())'"
9496
```
9597

96-
For insipiration, also check [here](https://github.com/prefix-dev/parselmouth/blob/main/pyproject.toml)
98+
For insipiration, also check [here](https://github.com/prefix-dev/parselmouth/blob/main/pyproject.toml).
9799

98100
## Lockfiles
99101
A **lockfile** contains the complete set of dependencies, including specific versions, required to reproduce the project environment. It is automatically generated based on the dependencies listed in the `.toml` file, ensuring that builds remain consistent and reproducible.
100102

101-
103+
## Readme
102104
Please add and update the README.md file, in case you havent done so. You can easily generate a README text on [readme.so](https://readme.so/) and copy its content to your READMe file.
105+
103106
::::::::::::::::::::::::::::::::::::: keypoints
104107
- Every project must include a `pyproject.toml` file
105108
- The `[build-system]` section is required and must define both `requires` and `build-backend`.

episodes/5_project_publishing.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ The two key tools we need are:
3030

3131
**Twine** – for securely uploading those distributions to **PyPI** or **TestPyPI**.
3232

33-
**Note**: Before proceeding, rename or remove the `pixi.tom`l file, as we will focus on `pyproject.toml`. You may experiment with `pixi.toml` later by removing or renaming `pyproject.toml`.
34-
3533
## Step 1: Create your build
3634

3735
The `build` tool reads your `pyproject.toml` file and generates the package distribution files.
@@ -44,7 +42,7 @@ pixi add --pypi build
4442
✔ Added build >=1.3.0, <2
4543
Added these as pypi-dependencies.
4644
```
47-
Empty the depenencies under `[project]` and move/edit them to `[tool.pixi.pypi-dependencies]` section, like shown below :
45+
Empty the depenencies under `[project]` and move/edit them to `[tool.pixi.pypi-dependencies]` section, like shown below:
4846

4947
```toml
5048
[project]
@@ -54,6 +52,7 @@ dependencies = []
5452
requests = ">=2.32.5,<3"
5553
build = ">=1.3.0,<2"
5654
```
55+
Then run the `build` command:
5756

5857
```bash
5958
pixi run python -m build
@@ -75,13 +74,13 @@ Successfully built greet_me-0.1.0.tar.gz and greet_me-0.1.0-py3-none-any.whl
7574
```
7675
7776
This command creates a `dist` directory containing two files:
77+
7878
- A wheel file (`greet_me-0.1.0-py3-none-any.whl`).
7979
- A source archive (`greet_me-0.1.0.tar.gz`).
8080

8181
<img width="306" height="533" alt="image" src="https://github.com/user-attachments/assets/503697e4-b93b-45e9-9904-229bd892b47a" />
8282

83-
84-
## Step 2 : Create an account on TestPyPI
83+
## Step 2 : Create an account on TestPyPI
8584
8685
- Visit [TestPyPI](https://test.pypi.org/account/register/) and create an account.
8786
- Generate an **API token** from your account settings.
@@ -92,7 +91,7 @@ This command creates a `dist` directory containing two files:
9291

9392
## Step 3: Upload your build
9493
The **Twine** tool is used to securely upload your package distributions.
95-
Install `twine` and modify the `pyroject.toml` file simmilar to what you did for `build` tool above.
94+
Install `twine` and modify the `pyroject.toml` file as you did for `build` tool above.
9695

9796
```bash
9897
pixi add --pypi twine
@@ -116,17 +115,17 @@ Now upload the package to TestPyI
116115
Uploading distributions to https://test.pypi.org/legacy/
117116
WARNING This environment is not supported for trusted publishing
118117
Enter your API token:
119-
Uploading greet_me1-0.1.7-py3-none-any.whl
118+
Uploading greet_me-0.1.0-py3-none-any.whl
120119
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 kB • 00:00 • ?
121-
Uploading greet_me1-0.1.7.tar.gz
120+
Uploading greet_me-0.1.0.tar.gz
122121
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.2/12.2 kB • 00:00 • ?
123122
124123
View at:
125-
https://test.pypi.org/project/greet-me1/0.1.7/
124+
https://test.pypi.org/project/greet-me/0.1.0/
126125
```
127126

128127
After a successful upload, your package will be available at a URL such as: E.g. :
129-
`[https://test.pypi.org/project/po-greet-me/0.1.1/](https://test.pypi.org/project/greet-me1/0.1.7/)`
128+
[https://test.pypi.org/project/greet-me/0.1.0/](https://test.pypi.org/project/greet-me/0.1.0/).
130129

131130
<img width="1743" height="973" alt="image" src="https://github.com/user-attachments/assets/d41cc3d8-1d9a-4a4e-bdaa-a600fe9d2b1a" />
132131

@@ -139,14 +138,14 @@ In that case you may end up in an error like this :
139138
twine upload --repository testpypi dist/*
140139
Uploading distributions to https://test.pypi.org/legacy/
141140
Enter your API token:
142-
Uploading greet_me-0.1.1-py3-none-any.whl
141+
Uploading greet_me-0.1.0-py3-none-any.whl
143142
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.6/2.6 kB • 00:00 • ?
144143
WARNING Error during upload. Retry with the --verbose option for more details.
145144
ERROR HTTPError: 403 Forbidden from https://test.pypi.org/legacy/
146145
Forbidden
147146
```
148147

149-
This isnt always helpful and you should try this command as tipped in the error message above to know more.
148+
This isn't always helpful and you should try this command as tipped in the error message above to know more.
150149

151150
```bash
152151
pixi run twine upload --repository testpypi dist/* --verbose
@@ -218,10 +217,10 @@ pixi run twine upload --repository testpypi dist/*
218217

219218
## Step 4: Test your package
220219

221-
Create a new Repository with a readme file and install your package from TestPyPI via this command :
220+
Create a new repository with a readme file, open a new codespace, and install your package from TestPyPI via this command:
222221

223222
```bash
224-
pip install -i https://test.pypi.org/simple/ greet-me1==0.1.7
223+
pip install -i https://test.pypi.org/simple/ greet-me1==0.1.0
225224
```
226225

227226
```output

episodes/6_extra.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Yay! happy day! 😀
4242
```
4343

4444
This command will:
45+
4546
- Ensure that the required environment is installed (creating or updating it if necessary).
4647
- Run the start task exactly as defined in your configuration file.
4748

learners/acknowledgements.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ title: 'Acknowledgements'
1414
* [Danny Garside](https://orcid.org/0000-0002-4579-003X) was consulted for help with reviewing the course materials, suggesting corrections through pull requests, and facilitating the demo run of the course by organizing the session and leading a post-meeting reflection.
1515

1616
**Resources**
17+
1718
* I would like to thank the PyOpenSci team for their excellent course delivered during the [PyOpenSci Fall Festival 2024](https://github.com/pyOpenSci/ff-2024-create-python-package), which provided valuable inspiration and insights.
1819

1920

0 commit comments

Comments
 (0)