From c89031d76f5db47ef89a9fc1286cf09a513acbd5 Mon Sep 17 00:00:00 2001 From: Aliaksandr Yakutovich Date: Fri, 15 Dec 2023 10:04:32 +0100 Subject: [PATCH] Manage Python project notebook: small fixes (#189) It includes, but is not limited to: * Fix the table of contents. * Replace `--dry-run` with `--dry` --- manage_python_project.ipynb | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/manage_python_project.ipynb b/manage_python_project.ipynb index d05dae52..9e97bd80 100644 --- a/manage_python_project.ipynb +++ b/manage_python_project.ipynb @@ -67,7 +67,7 @@ " - [Version update](#Version-update)\n", " - [Exercise on version update automation](#Exercise-on-version-update-automation)\n", " - [Releasing](#Releasing)\n", - " - [Exercise on releasing automation](#Exercise-on-releasing-automation)" + " - [Exercises on releasing automation](#Exercises-on-releasing-automation)" ] }, { @@ -139,7 +139,7 @@ "3. Clone the package to your local machine: `git clone `.\n", "\n", "
\n", - "In the following, we will always assume that mypackage is the package you are working on (other yours or the one you have forked).\n", + "In the following, we will always assume that mypackage is the package you are working on (either yours or the one you have forked).\n", "
\n" ] }, @@ -330,6 +330,8 @@ "pre-commit run --all-files\n", "```\n", "This command will run all the pre-commit hooks on all the files in the repository.\n", + "However, this command will fail if there is no `.pre-commit-config.yaml` file in the current directory.\n", + "We will discuss the `.pre-commit-config.yaml` file in the next section.\n", "\n", "Usually, one would run pre-commit on the files that are about to be committed.\n", "It turns out that pre-commit can do that for us.\n", @@ -1524,6 +1526,7 @@ "\n", "on: push\n", "\n", + "jobs:\n", " tests:\n", " name: Test Suite\n", " runs-on: ubuntu-latest\n", @@ -1610,11 +1613,11 @@ "To update the version, run the following command:\n", "\n", "```bash\n", - "bumpver update --minor --dry-run\n", + "bumpver update --minor --dry\n", "```\n", - "Since the `--dry-run` flag is used, the version will not be updated, but the proposed changes will be printed to the console.\n", + "Since the `--dry` flag is used, the version will not be updated, but the proposed changes will be printed to the console.\n", "In the example above we expect only the `MINOR` part of the version to be updated, as we have used the `--minor` flag.\n", - "Once you are happy with the changes, remove the `--dry-run` flag and run the command again.\n", + "Once you are happy with the changes, remove the `--dry` flag and run the command again.\n", "\n", "\n", "For more information on the configuration, see [bumpver documentation](https://github.com/mbarkhau/bumpver#readme)." @@ -1706,8 +1709,8 @@ "\n", "Finally, we want to add a release to GitHub.\n", "```yaml\n", - " - uses: softprops/action-gh-release@v0.1.14\n", - " name: Create release\n", + " - name: Create release\n", + " uses: softprops/action-gh-release@v0.1.14\n", " with:\n", " files: |\n", " dist/*\n", @@ -1731,11 +1734,21 @@ "id": "78322de9", "metadata": {}, "source": [ - "## Exercise on releasing automation\n", + "## Exercises on releasing automation\n", + "\n", + "- Configure the release workflow in your package.\n", + "You can use all steps from the example above except from the `Build and publish` step.\n", + "This step should be replaced with the following one:\n", "\n", - "- Configure the release workflow in your package using `test.pypi.org`.\n", + "```yaml\n", + " - name: Build and publish\n", + " run: flit build\n", + "```\n", "- Update the version of your package using `bumpver`.\n", - "- Check that the release workflow is triggered and the package is released on `test.pypi.org`." + "\n", + "**Optional:**\n", + "\n", + "- Only if you are working with your own package, you can try to release it on PyPI." ] } ],