diff --git a/index.md b/index.md index 8ad72bcf9..24176e3ad 100644 --- a/index.md +++ b/index.md @@ -71,7 +71,7 @@ by the community now! Join our community review process or watch development of :class-card: left-aligned * [What is a Python package?](/tutorials/intro) -* [Make your code installable](/tutorials/1-installable-code) +* [Make your code installable](/tutorials/installable-code) * [Publish your package to (test) PyPi](/tutorials/publish-pypi) * [Publish your package to conda-forge](/tutorials/publish-conda-forge) diff --git a/tutorials/add-license-coc.md b/tutorials/add-license-coc.md index 9ba7a8e7f..af1fc9521 100644 --- a/tutorials/add-license-coc.md +++ b/tutorials/add-license-coc.md @@ -62,7 +62,7 @@ There are several ways to add a LICENSE file: :::{tip} If you completed the past lessons including -1. [Making your code installable](1-installable-code.md) and +1. [Making your code installable](installable-code.md) and 2. [publishing your package to PyPI](publish-pypi.md) then you already have a **LICENSE** file containing text for the MIT license in your Python package. Thus you can skip to the next section of this tutorial which walks you through adding a CODE_OF_CONDUCT. diff --git a/tutorials/add-readme.md b/tutorials/add-readme.md index 9fda85d52..d40056bae 100644 --- a/tutorials/add-readme.md +++ b/tutorials/add-readme.md @@ -3,7 +3,7 @@ In the previous lessons you learned: 1. [What a Python package is](intro.md) -2. [How to make your code installable](1-installable-code) +2. [How to make your code installable](installable-code) 3. [How to publish your package to (test) PyPI](publish-pypi.md) 4. [How to publish your package to conda-forge](publish-conda-forge.md) diff --git a/tutorials/1-installable-code.md b/tutorials/installable-code.md similarity index 97% rename from tutorials/1-installable-code.md rename to tutorials/installable-code.md index f39d4cf61..6c25d42bd 100644 --- a/tutorials/1-installable-code.md +++ b/tutorials/installable-code.md @@ -229,10 +229,9 @@ pyospackage # This is your project directory ``` -## Step 2: Add code to your package +## Step 2: Add module to your package -Within the `pyospackage` subdirectory, add one or more Python modules. -A Python module refers to a `.py` file containing the code that you want your package to access and run. +A Python module refers to a `.py` file containing the code that you want your package to access and run. Within the `pyospackage` subdirectory, add at least one Python modules (.py files). If you don't have code already and are just learning how to create a Python package, then create an empty `add_numbers.py` file. You will populate the `add_numbers.py` file with code provided below. @@ -258,7 +257,7 @@ pyospackage/ ├── add_numbers.py ``` -## Step 3: Add code to your `add_numbers.py` module +## Step 3: Add code to your module If you are following along and making a Python package from scratch then you can add the code below to your `add_numbers.py` module. The function below adds two integers together and returns the result. Notice that the code below has a few features that we will review in future tutorials: @@ -404,14 +403,22 @@ You will learn how to automate defining a package version using git tags in the version and release your package lesson. ::: -### Adjust project classifiers +### OPTIONAL: Adjust project classifiers Hatch by default provides a list of classifiers that define what -Python versions your package supports. While this won't impact your package build, let's remove some of them that you likely don't need. +Python versions your package supports. These classifiers do not +in any way impact your package's build and are primarily +intended to be used when you publish your package to PyPI. -* Remove support for python 3.8 +If you don't plan on publishing to PyPI, you can skip this section. +However, if you wish, you can clean it up a bit. -Also because we are assuming you're creating a pure Python package, you can remove the following classifiers: +To begin: + +* Remove support for Python 3.8 + +Also because you are creating a pure Python package, you can +in this lesson, you can remove the following classifiers: ```toml classifiers = [ diff --git a/tutorials/intro.md b/tutorials/intro.md index 30a5f5f96..c324510c7 100644 --- a/tutorials/intro.md +++ b/tutorials/intro.md @@ -36,7 +36,7 @@ Get to know Hatch :caption: Create and publish a Python Package What is a Python package? -Make your code installable <1-installable-code> +Make your code installable Publish to PyPI Publish to conda-forge ::: @@ -346,5 +346,5 @@ The elements above are also important for future maintenance of your package. In In future lessons you will learn more about the infrastructure around a published Python package that makes it both easier to maintain, easier for others to contribute to and easier for other scientists to use. However, first we want to get you to your initial goal of publishing a Python package. In this next lesson you will learn how to create a basic installable Python package. -Make your code pip installable <1-installable-code> +Make your code pip installable ::: diff --git a/tutorials/publish-conda-forge.md b/tutorials/publish-conda-forge.md index 9bf0bd568..5eedb4efc 100644 --- a/tutorials/publish-conda-forge.md +++ b/tutorials/publish-conda-forge.md @@ -2,7 +2,7 @@ In the previous lessons, you've learned: -1. How to [create the most basic version of a Python package](1-installable-code.md). This entailed making your code installable. +1. How to [create the most basic version of a Python package](installable-code.md). This entailed making your code installable. 2. [How to publish your Python package to PyPI](publish-pypi) 3. How to add a `README` and `LICENSE` file to your package 4. How to setup your `pyproject.toml` file with all of the metadata that PyPI requires and also metadata that will be helpful for users to find your package. @@ -464,7 +464,7 @@ Review the pull request. If all tests are passing, you can merge it. Shortly aft If you have walked through this entire tutorial series you have now: 1. Understand [what a Python package is ](intro.md) -2. Know how to [make your code installable](1-installable-code.md) into Python environments +2. Know how to [make your code installable](installable-code.md) into Python environments 3. Know how to create a pyproject.toml file, a README file, and a License and code of conduct. 4. Know how to [publish your package to PyPI](publish-pypi.md) and 5. Know how to publish your package to conda-forge diff --git a/tutorials/publish-pypi.md b/tutorials/publish-pypi.md index d8421f43f..f7ea2c054 100644 --- a/tutorials/publish-pypi.md +++ b/tutorials/publish-pypi.md @@ -167,7 +167,7 @@ Once you have your development environment setup, you are ready to build your pa You will use Hatch as a **Front end** tool that builds your package's sdist and wheel using the [hatchling](https://hatch.pypa.io/latest/) build back-end. -The hatchling build back-end is used because you declared it in your pyproject.toml file in the [previous lesson](1-installable-code). +The hatchling build back-end is used because you declared it in your pyproject.toml file in the [previous lesson](installable-code). To build your package run `hatch build`: diff --git a/tutorials/pyproject-toml.md b/tutorials/pyproject-toml.md index 434191090..06b61d6c3 100644 --- a/tutorials/pyproject-toml.md +++ b/tutorials/pyproject-toml.md @@ -1,6 +1,6 @@ # Make your Python package PyPI ready - pyproject.toml -In [the installable code lesson](1-installable-code), you learned how to add the bare minimum information to a `pyproject.toml` file to make it installable. You then learned how to [publish a bare minimum version of your package to PyPI](publish-pypi.md). +In [the installable code lesson](installable-code), you learned how to add the bare minimum information to a `pyproject.toml` file to make it installable. You then learned how to [publish a bare minimum version of your package to PyPI](publish-pypi.md). Following that you learned how to add a: * [README.md](add-readme) @@ -156,7 +156,7 @@ The documentation for the hatchling back-end is [here](https://hatch.pypa.io/lat ### Step 1: Add Author, maintainer and project description -After completing the [installable code tutorial](1-installable-code), you should have a pyproject.toml file with a project name and a version in the `[project]` table. +After completing the [installable code tutorial](installable-code), you should have a pyproject.toml file with a project name and a version in the `[project]` table. ```toml [project]