Skip to content

Commit 6057b53

Browse files
committed
Fix: rest of the review comments addressed
1 parent 899d986 commit 6057b53

File tree

3 files changed

+43
-38
lines changed

3 files changed

+43
-38
lines changed
4.58 KB
Loading

package-structure-code/python-package-distribution-files-sdist-wheel.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ or is more complex in its build, the two distributions will be very different.
145145
Also note that we are not discussing conda build workflows in this section.
146146
[You can learn more about conda builds here.](https://conda.io/projects/conda-build/en/latest/user-guide/tutorials/index.html)
147147
```
148+
148149
(python-source-distribution)=
149150
## Source Distribution (sdist)
150151

tutorials/intro.md

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ You might also hear people use the term "library" the same way.
5353

5454
## What is a Python package?
5555

56-
5756
At a high level, you can think about a Python package as a toolbox
5857
that you can use to perform various tasks.
5958

@@ -87,6 +86,27 @@ Installing a package into an environment makes it easier
8786
to manage and reuse your code across different projects.
8887
Structuring your code as a package is the first step you need to take so you can share the tools in the toolbox you've created and let others build with it.
8988

89+
## Why create a Python package?
90+
91+
There are numerous reasons why you might create a Python package:
92+
93+
- **Use your code across multiple projects:** At its most basic level, creating a package allows you to install your code into a Python environment. This allows you to then import functions and classes into any workflows both locally and in the cloud..
94+
- **Share your code:** Sharing your code with others is often a common reason to create a package. If you publish a package on a public repository such as PyPI or conda, immediately your package can be installed on any machine using pip or conda with a single command.
95+
- **Build community around your code:** Packages make it easier for multiple people to work on the same project (particularly when published on Github). A version platform such as git (the version control system used by GitHub), further makes it easier to track changes to the codebase over time. Tools such as issues and pull requests make it easier for outside users to contribute bug fixes and to establish review processes for accepting changes to the code base..
96+
- **Organize your code:** Packages can be used to organize large code projects, dividing them into smaller, more manageable components. This structure can help with both maintaining the codebase and with making it easier to understand.
97+
98+
### What to consider before you create a package
99+
100+
Creating a Python package that others use takes considerable
101+
time and effort. Before you begin, think about your goals including:
102+
103+
- Who you think will use your package
104+
- How people might use your package and on what data (if data are relevant)
105+
- Whether you have time to add things such as documentation and tests
106+
- How long you might be able to maintain it: remember that once people begin using your package they will depend on your maintainer team to update it, fix bugs and answer questions.
107+
108+
Before creating a package that is user-facing, it's important to consider all of the above!
109+
90110
## The elements of a Python package
91111

92112
:::{figure-md} package-components
@@ -106,7 +126,7 @@ The core elements of Python package include:
106126
- Contributor Documentation in the form of a **CONTRIBUTING.md** file is useful to help people to contribute to your package.
107127
- Development documentation helps both maintainers and contributors understand how to maintain a package's infrastructure.
108128
- **Tests:** that makes sure your code works as it should and makes it easier for you and others to contribute to, modify and update the code in the future
109-
- **License:** An open source license, or license that is [OSI approved](https://opensource.org/licenses/) refers to an licence that allows others to both use your package. It also provides legal direction regarding how elements of the package can and can't be reused.
129+
- **License:** An open source license, or license that is [OSI approved](https://opensource.org/licenses/) refers to an license that allows others to both use your package. It also provides legal direction regarding how elements of the package can and can't be reused.
110130
- **Infrastructure** that automates updates, publication workflows and runs test suites. Infrastructure includes a suite of things such as platforms like GitHub and GitLab, tools to run tests and tools locally such as nox and tox and continuous integration that automates package maintenance steps.
111131

112132
:::{admonition} What pyOpenSci looks for in a package
@@ -264,27 +284,36 @@ allows you to access it from any code run with that specific Python environment
264284
<img src="../images/tutorials/environment-package-install.png" alt="Diagram showing the steps associated with creating a package and then installing it. The first arrow says your package and the second says pip install package. The second arrow leads to a box that represents a python environment that already has some packages installed such as pandas and NumPy. Your package will also get installed into that same environment when you pip install it." width="700px">
265285

266286
You don't have to publish to PyPI in order to make your code installable.
267-
WIth the correct file structure and project metadata you can make your code
287+
With the correct file structure and project metadata you can make your code
268288
installable locally on your computer and use it for projects that you are working
269289
on without having to ever publish to PyPI. Publishing to PyPI is useful when you
270290
want to make your code public-facing and share it with others.
271291
:::
272292

273-
### Publishing a package
293+
### Publishing a package to PyPI / Conda-Forge
294+
295+
If you want to make your package directly installable without having
296+
to download the code to your computer locally then you need to
297+
publish it in a repository such as **PyPI** or **conda-forge**.
298+
299+
:::{todo}
300+
The links below won't work until those lessons (which are written) are published.
301+
:::
274302

275-
If you want to make your package installable using `pip` you need to
276-
publish it in a repository such as PyPI or conda-forge. If you package is a
277-
pure python package, then publishing to both PyPI and conda-forge only takes just a few steps.
303+
In this tutorial, you will learn [how to publish to PyPI.](6-publish-pypi.md)
278304

279-
In these tutorials, you will learn [how to publish to PyPI using twine.](6-publish-pypi.md)
305+
:::{todo}
306+
This lesson is also not published - yet but will be reviewed soon.
307+
:::
280308

281309
Then you can create a conda-forge recipe using the [grayskull](https://github.com/conda/grayskull) tool. This recipe can then be submitted to conda-forge. [You will learn more about the conda-forge publication process here.](7-publish-conda-forge.md)
282310

283311

284312
:::{figure-md} build-workflow-tutorial
285-
<img src="../images/tutorials/publish-package-pypi-conda.png" alt="Graphic showing the high level packaging workflow. On the left you see a graphic with code, metadata and tests in it. those items all go into your package. Documentation and data are below that box because they aren't normally published in your packaging wheel distribution. an arrow to the right takes you to a build distribution files box. that box leads you to either publishing to testPyPI or the real pypi. from PyPI you can then connect to conda forge for an automated build that sends distributions from PyPI to conda-forge." width="700px">
313+
<img src="../images/tutorials/publish-package-pypi-conda.png" alt="Graphic showing the high level packaging workflow. On the left you see a graphic with code, metadata and tests in it. Those items all go into your package. Documentation and data are below that box because they aren't normally published in your packaging wheel distribution. an arrow to the right takes you to a build distribution files box. that box leads you to either publishing to testPyPI or the real PyPI. From PyPI you can then connect to conda forge for an automated build that sends distributions from PyPI to conda-forge." width="700px">
286314

287-
Once you are ready to make your code public, you can publish it on PyPI. Once the code is on PyPI it's a simple set of steps to publish to conda forge. You create a recipe using the grayskull package and then you open a pr in the conda-forge recipe repo. You will learn more about this process in the [conda-forge lesson](#).
315+
In the above image you can see the steps associated with publishing
316+
your package on PyPI and conda forge. Note that the distribution files that PyPI requires are the [sdist](#sdist) and [wheel](#wheel) files. Once you are ready to make your code publicly installable, you can publish it on PyPI. Once your code is on PyPI it is straight forward to then publish to conda forge. You create a recipe using the grayskull package and then you open a pr in the conda-forge recipe repo. You will learn more about this process in the [conda-forge lesson](#).
288317
:::
289318

290319
## Yay, your package has users! Now what?
@@ -293,12 +322,9 @@ As the community using your package grows, you may also find yourself managing u
293322

294323
To support your community, you'll want to add things like:
295324

296-
* development guide
297-
* code of conduct
298-
* contributing guide
299-
300-
301-
325+
* [a development guide that documents your maintainer workflow process ](/documentation/repository-files/development-guide.md)
326+
* [a code of conduct to defines community interaction standards and expectations](/documentation/repository-files/code-of-conduct-file.md)
327+
* [a contributing guide that helps users understand expectations associated with making contributions to your project](/documentation/repository-files/contributing-file.md)
302328

303329
:::{admonition} Support for contributors and maintainers
304330

@@ -307,28 +333,6 @@ If you intend for others to use and contribute to your code, consider who will m
307333
The elements above are also important for future maintenance of your package. In the case that you are no long able to maintain it or simply want extra help, development and contributing documentation will help you onboard new maintainers.
308334
:::
309335

310-
<!--
311-
Are the sections below useful??
312-
313-
*********
314-
## Why create a package?
315-
316-
There are numerous reasons why you might create a Python package:
317-
318-
- **Use your code across multiple projects:** At its most basic level, creating a package allows you to install your code into a Python environment. This allows you to then import functions and classes into any workflows both locally and in the cloud..
319-
- **Share your code:** Sharing your code with others is often a common reason to create a package.If you publish a package on a public repository such as PyPI or conda, immediately your package can be installed on any machine using pip or conda with a single command.
320-
- **Build community around your code:** Packages make it easier for multiple people to work on the same project (particularly when published on Github). A version platform such as git (the version control system used by GitHub), further makes it easier to track changes to the codebase over time. Tools such as issues and pull requests make it easier for outside users to contribute bug fixes and to establish review processes for accepting changes to the code base..
321-
- **Organize your code:** Packages can be used to organize large code projects, dividing them into smaller, more manageable components. This structure can help with both maintaining the codebase and with making it easier to understand.
322-
323-
## What to consider before you create a package
324-
325-
Creating a Python package that others use takes considerable time and effort.
326-
Before you begin, think about your goals including:
327-
328-
- Who you think will use your package
329-
- Whether you have time to add things such as documentation and tests
330-
- How long you might be able to maintain it -->
331-
332336
*****
333337

334338
## What's next?

0 commit comments

Comments
 (0)