Skip to content

Commit

Permalink
Merge branch 'main' into pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
  • Loading branch information
lwasser authored Jun 4, 2024
2 parents 76f1d7d + bc4776e commit f61863a
Show file tree
Hide file tree
Showing 25 changed files with 1,496 additions and 9 deletions.
19 changes: 19 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,15 @@
"review"
]
},
{
"login": "zackw",
"name": "Zack Weinberg",
"avatar_url": "https://avatars.githubusercontent.com/u/325899?v=4",
"profile": "https://www.owlfolio.org/",
"contributions": [
"review"
]
},
{
"login": "flpm",
"name": "Felipe Moreno",
Expand All @@ -613,6 +622,16 @@
"review",
"code"
]
},
{
"login": "sn3hay",
"name": "Sneha Yadav",
"avatar_url": "https://avatars.githubusercontent.com/u/156010030?v=4",
"profile": "https://github.com/sn3hay",
"contributions": [
"code",
"review"
]
}
],
"contributorsPerLine": 7,
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ __pycache__
*notes-from-review.md
*.idea*
# Grammar / syntax checkers
.vale.ini
styles/
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ repos:
- id: codespell
additional_dependencies:
- tomli
exclude: >
(?x)^(
.*vale-styles.*
)$
- repo: https://github.com/errata-ai/vale
rev: v3.4.2
hooks:
- id: vale

ci:
autofix_prs: false
Expand Down
32 changes: 32 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Configuration file for using Vale in the python-package-guide repository
#
# To disable checks on parts of a MarkDown or HTML file, delimit the section
# using these HTML comments:
# to disabled Vale checks after this line: <!-- vale off -->
# to enable Vale checks after this line: <!-- vale on -->
#
# To disable checks based on MarkDown scope, see IgnoredScopes.
# To disable checks on certain HTML elements, see IgnoredClasses.
#
# More information about the configuration can be found here:
# https://vale.sh/docs/topics/config


# Path to the styles directory, where style rules are defined
StylesPath = vale-styles

# Path to a dictionary folders inside the StylesPath config subdirectory. This
# folder can contain two files, accept.txt and reject.txt, with one word per
# line. These words will be used to check for spelling mistakes in addition to
# the internal dictionary, if the 'Vale' ruleset is enabled (see below)
# See https://vale.sh/docs/topics/vocab/#folder-structure for more details
Vocab = sample


# Checks are defined in sections by file type, like the one below for
# MarkDown. In each section you can enable groups of style rules, defined in folders
# inside the StylesPath directory.
# Use 'Vale' to enable the internal style rules and checks.

[*.md]
BasedOnStyles = package-guide-test
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# <img src="https://www.pyopensci.org/images/logo.png" width=100 /> pyOpenSci scientific Python Packaging Guide
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-59-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-61-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

![GitHub release (latest by date)](https://img.shields.io/github/v/release/pyopensci/python-package-guide?color=purple&display_name=tag&style=plastic)
Expand Down Expand Up @@ -149,7 +149,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/chenghlee"><img src="https://avatars.githubusercontent.com/u/3485949?v=4?s=100" width="100px;" alt="Cheng H. Lee"/><br /><sub><b>Cheng H. Lee</b></sub></a><br /><a href="https://github.com/pyOpenSci/python-package-guide/commits?author=chenghlee" title="Code">💻</a> <a href="https://github.com/pyOpenSci/python-package-guide/pulls?q=is%3Apr+reviewed-by%3Achenghlee" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Vaunty"><img src="https://avatars.githubusercontent.com/u/68826427?v=4?s=100" width="100px;" alt="Vaunty"/><br /><sub><b>Vaunty</b></sub></a><br /><a href="https://github.com/pyOpenSci/python-package-guide/commits?author=Vaunty" title="Code">💻</a> <a href="https://github.com/pyOpenSci/python-package-guide/pulls?q=is%3Apr+reviewed-by%3AVaunty" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.owlfolio.org/"><img src="https://avatars.githubusercontent.com/u/325899?v=4?s=100" width="100px;" alt="Zack Weinberg"/><br /><sub><b>Zack Weinberg</b></sub></a><br /><a href="https://github.com/pyOpenSci/python-package-guide/pulls?q=is%3Apr+reviewed-by%3Azackw" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://flpm.dev"><img src="https://avatars.githubusercontent.com/u/17676929?v=4?s=100" width="100px;" alt="Felipe Moreno"/><br /><sub><b>Felipe Moreno</b></sub></a><br /><a href="https://github.com/pyOpenSci/python-package-guide/pulls?q=is%3Apr+reviewed-by%3Aflpm" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/pyOpenSci/python-package-guide/commits?author=flpm" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sn3hay"><img src="https://avatars.githubusercontent.com/u/156010030?v=4?s=100" width="100px;" alt="Sneha Yadav"/><br /><sub><b>Sneha Yadav</b></sub></a><br /><a href="https://github.com/pyOpenSci/python-package-guide/commits?author=sn3hay" title="Code">💻</a> <a href="https://github.com/pyOpenSci/python-package-guide/pulls?q=is%3Apr+reviewed-by%3Asn3hay" title="Reviewed Pull Requests">👀</a></td>
</tr>
</tbody>
</table>
Expand Down
1 change: 1 addition & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"styles/write-good/README.md",
"styles/*",
".pytest_cache/README.md",
"vale-styles/*",
]

# For sitemap generation
Expand Down
2 changes: 1 addition & 1 deletion index.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ The first round of our community-developed, how to create a Python package tutor

* [What is a Python package?](/tutorials/intro)
* [Make your code installable](/tutorials/installable-code)
* [Publish your package to (test) PyPi](/tutorials/publish-pypi)
* [Publish your package to (test) PyPI](/tutorials/publish-pypi)
* [Publish your package to conda-forge](/tutorials/publish-conda-forge)

:::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ exist in the `defaults` Anaconda channel.

:::{figure-md} pypi-conda-channels

<img src="../images/python-pypi-conda-channels.png" alt="Graphic with the title Python package repositories. Below it says Anything hosted on PyPI can be installed using pip install. Packaging hosted on a conda channel can be installed using conda install. Below that there are two rows. the top row says conda channels. next to it are three boxes one with conda-forge, community maintained; bioconda and then default - managed by the anaconda team. Below that there is a row that says PyPI servers. PyPI - anyone can publish to pypi. and test pypi. a testbed server for you to practice. " width="700px">
<img src="../images/python-pypi-conda-channels.png" alt="Graphic with the title Python package repositories. Below it says Anything hosted on PyPI can be installed using pip install. Packaging hosted on a conda channel can be installed using conda install. Below that there are two rows. the top row says conda channels. next to it are three boxes one with conda-forge, community maintained; bioconda and then default - managed by the anaconda team. Below that there is a row that says PyPI servers. PyPI - anyone can publish to PyPI. and test PyPI. a testbed server for you to practice. " width="700px">

Conda channels represent various repositories that you can install packages from. Because conda-forge is community maintained, anyone can submit a recipe there. PyPI is also a community maintained repository. Anyone can submit a package to PyPI and test PyPI. Unlike conda-forge there are no manual checks of packages submitted to PyPI.
:::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ represent on your PyPI landing page. These classifiers also allow users to sort
```

:::{figure-md} build-workflow
<img src="../images/python-package-development-process.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">
<img src="../images/python-package-development-process.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">

You need to build your Python package in order to publish it to PyPI (or Conda). The build process organizes your code and metadata into a distribution format that can be uploaded to PyPI and subsequently downloaded and installed by users. NOTE: you need to publish a sdist to PyPI in order for conda-forge to properly build your package automatically.
:::

:::{figure-md}

<img src="../images/python-build-package/pypi-metadata-keywords-license.png" alt="This screenshot shows the metadata on pypi for the xclim package. on it you can see the name of the license, the author and maintainer names keywords associated with the package and the base python version it requires which is 3.8." width="400px">
<img src="../images/python-build-package/pypi-metadata-keywords-license.png" alt="This screenshot shows the metadata on PyPI for the xclim package. on it you can see the name of the license, the author and maintainer names keywords associated with the package and the base python version it requires which is 3.8." width="400px">

PyPI screenshot showing metadata for the xclim package.
:::
Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ dependencies = [
"sphinxext-opengraph",
"sphinx-inline-tabs",
# for project cards
"matplotlib"
"matplotlib",
]

[project.optional-dependencies]
dev = [
# for checking style rules
"vale"
]

[tool.hatch.build.targets.wheel]
Expand Down
2 changes: 1 addition & 1 deletion tutorials/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ Then you can create a conda-forge recipe using the [Grayskull](https://github.co
[You will learn more about the conda-forge publication process here.](publish-conda-forge.md)

:::{figure-md} publish-package-pypi-conda-overview
<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">
<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">

In the image above, you can see the steps associated with publishing
your package on PyPI and conda-forge. Note that the distribution files that PyPI requires are the [sdist](#python-source-distribution) and [wheel](#python-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 repository. You will learn more about this process in the [conda-forge lesson](/tutorials/publish-conda-forge).
Expand Down
2 changes: 1 addition & 1 deletion tutorials/publish-pypi.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ will remember them.
## Install your package from TestPyPI

Once your package upload is complete, you can install it from
TestPYPI. You can find the installation instructions on the TestPyPI
TestPyPI. You can find the installation instructions on the TestPyPI
landing page for your newly uploaded package.

:::{figure-md} testpypi-landing-page
Expand Down
Empty file.
Empty file.
22 changes: 22 additions & 0 deletions vale-styles/package-guide-test/PyPI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
extends: substitution
message: Consider using '%s' instead of '%s'
level: warning
ignorecase: false
action:
name: replace
# swap maps tokens in form of bad: good
swap:
# lower case defined as regex to prevent false positives in URLs or other identifiers
- (?:\spypi[\.,]?\s): PyPI
- (?:\stestpypi[\.,;:]?\s): TestPyPI
- (?:\stest-pypi[\.,;:]?\s): TestPyPI
# other tests are defined with strings
- pyPi: PyPI
- pyPI: PyPI
- PYPI: PyPI
- PyPi: PyPI
- Pypi: PyPI
- testPyPI: TestPyPI
- testPYPI: TestPyPI
- TestPypi: TestPyPI
- TestPYPI: TestPyPI
Loading

0 comments on commit f61863a

Please sign in to comment.