Skip to content

Commit

Permalink
Switch to hatchling build system (#154)
Browse files Browse the repository at this point in the history
* Switch to hatchling build system

* Restructure some documentation things and fix some packaging issues
  • Loading branch information
facelessuser authored Jul 19, 2022
1 parent dcffc49 commit d6e4742
Show file tree
Hide file tree
Showing 27 changed files with 187 additions and 191 deletions.
33 changes: 19 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ jobs:
max-parallel: 4
matrix:
platform: [ubuntu-latest] #, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9, '3.10']
include:
- python-version: 3.6
tox-env: py36
continue-on-error: False
- python-version: 3.7
tox-env: py37
continue-on-error: False
Expand All @@ -30,7 +27,10 @@ jobs:
continue-on-error: False
- python-version: 3.9
tox-env: py39
continue-on-error: True
continue-on-error: False
- python-version: '3.10'
tox-env: py310
continue-on-error: False
# exclude:
# - platform: windows-latest
# python-version: 3.9
Expand All @@ -44,17 +44,17 @@ jobs:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
if: "!endsWith(matrix.python-version, '-dev')"
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up development Python ${{ matrix.python-version }}
if: endsWith(matrix.python-version, '-dev')
uses: deadsnakes/action@v1.0.0
uses: deadsnakes/action@v2.1.1
with:
python-version: ${{ matrix.python-version }}
- name: Python (Install Dependencies)
run: |
python -m pip install --upgrade pip setuptools tox coverage codecov
python -m pip install --upgrade pip setuptools tox coverage codecov build
# # Windows
# - name: Windows (Setup MSYS2)
Expand Down Expand Up @@ -120,31 +120,36 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools tox
python -m pip install --upgrade pip setuptools tox build
- name: Lint
run: |
python -m tox
documents:
strategy:
max-parallel: 4
matrix:
python-version: [3.9]

env:
TOXENV: documents

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools tox
python -m pip install --upgrade pip setuptools tox build
- name: Install Aspell
run: |
sudo apt-get install aspell aspell-en
Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,24 @@ on:
jobs:

documents:
strategy:
max-parallel: 4
matrix:
python-version: [3.9]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade pip setuptools build
python -m pip install -r requirements/docs.txt
- name: Deploy documents
run: |
Expand All @@ -32,23 +37,19 @@ jobs:
git push gh-token gh-pages
pypi:
strategy:
matrix:
distribution: [bdist_wheel, sdist]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Package
run: |
pip install --upgrade setuptools wheel
python setup.py ${{ matrix.distribution }}
pip install --upgrade build
python -m build -s -w
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.4.1
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 - 2021 Isaac Muse
Copyright (c) 2017 - 2022 Isaac Muse

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
17 changes: 0 additions & 17 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Extension documentation is found here: https://facelessuser.github.io/pyspelling

PySpelling is released under the MIT license.

Copyright (c) 2017 - 2021 Isaac Muse <[email protected]>
Copyright (c) 2017 - 2022 Isaac Muse <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
Expand Down
3 changes: 2 additions & 1 deletion docs/src/dictionary/en-custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ GitHub
GitLab
Gitter
Hashable
Hatchling
Homebrew
JSDoc
MERCHANTABILITY
Expand Down Expand Up @@ -48,7 +49,6 @@ backticks
blockish
bool
boolean
symlink
builtin
builtins
chainable
Expand Down Expand Up @@ -98,6 +98,7 @@ subclassing
sublicense
substring
subtypes
symlink
syntaxes
trigraphs
tuple
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions docs/src/markdown/.snippets/refs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--8<--
links.md
abbr.md
--8<--
4 changes: 0 additions & 4 deletions docs/src/markdown/_snippets/refs.txt

This file was deleted.

6 changes: 6 additions & 0 deletions docs/src/markdown/about/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 2.8.0

- **NEW**: Officially drop support for Python 3.6 and add support for Python 3.10.
- **NEW**: Switch build system to Hatchling.
- **FIX**: Fix typo in Aspell accepted parameters.

## 2.7.3

- **FIX**: Fix context reporting in the XML, HTML, and other filters derived from XML the filter.
Expand Down
9 changes: 3 additions & 6 deletions docs/src/markdown/about/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
## Become a Sponsor :octicons-heart-fill-16:{: .heart-throb}

Open source projects take time and money. Help support the project by becoming a sponsor. You can add your support at
any tier you feel comfortable with. No amount is too little.
any tier you feel comfortable with. No amount is too little. We also accept one time contributions via PayPal.

:octicons-mark-github-16: [GitHub Sponsors ](https://github.com/sponsors/facelessuser)

If you'd like to do a one time contribution, you can do so via PayPal.

:fontawesome-brands-paypal: [PayPal](https://www.paypal.me/facelessuser)
[:octicons-mark-github-16: GitHub Sponsors](https://github.com/sponsors/facelessuser){: .md-button .md-button--primary }
[:fontawesome-brands-paypal: PayPal](https://www.paypal.me/facelessuser){ .md-button}

## Bug Reports

Expand Down
2 changes: 0 additions & 2 deletions docs/src/markdown/about/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,3 @@ HTML is output for each file in `.tox/pyXX/tmp`. You can use these to see areas
testing.

You can checkout `tox.ini` to see how this is accomplished.

--8<-- "links.txt"
22 changes: 1 addition & 21 deletions docs/src/markdown/about/license.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
# License

MIT License

Copyright (c) 2017 - 2021 Isaac Muse <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--8<-- "LICENSE.md"
2 changes: 0 additions & 2 deletions docs/src/markdown/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,5 +455,3 @@ The above options would be equivalent to doing this from the command line:
```shell-session
$ aspell --add-extra-dicts my-dictionary.dic --add-extra-dicts my-other-dictionary.dic
```

--8<-- "refs.txt"
4 changes: 0 additions & 4 deletions docs/src/markdown/filters/html.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,3 @@ Category | Description
`html-content` | Text captured from HTML blocks.
`html-attribute` | Text captured from HTML attributes.
`html-comment` | Text captured from HTML comments.

--8<--
refs.txt
--8<--
4 changes: 0 additions & 4 deletions docs/src/markdown/filters/xml.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,3 @@ Category | Description
`xml-content` | Text captured from XML tags.
`xml-attribute` | Text captured from XML attributes.
`xml-comment` | Text captured from XML comments.

--8<--
refs.txt
--8<--
2 changes: 0 additions & 2 deletions docs/src/markdown/flow_control/wildcard.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,3 @@ Options | Type | Default | Description
`allow` | [string] | `#!py3 ["*"]` | The chunk of text is allowed to be evaluated by the next filter.
`skip` | [string] | `#!py3 []` | The chunk of text should skip the next filter.
`halt` | [string] | `#!py3 []` | Halts the progress of the text chunk down the pipeline and sends it directly to the spell checker.

--8<-- "refs.txt"
2 changes: 0 additions & 2 deletions docs/src/markdown/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,5 +295,3 @@ jobs:
In *this* project, we actually use `tox` to make running our tests locally and in CI easier. If you would like to use
`tox` as well, you can check out how this project does it by taking a look at the source.

--8<-- "refs.txt"
50 changes: 50 additions & 0 deletions hatch_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""Dynamically define some metadata."""
import os

from hatchling.metadata.plugin.interface import MetadataHookInterface


def get_version_dev_status(root):
"""Get version_info without importing the entire module."""

import importlib.util

path = os.path.join(root, "pyspelling", "__meta__.py")
spec = importlib.util.spec_from_file_location("__meta__", path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module.__version_info__._get_dev_status()


def get_requirements(root):
"""Load list of dependencies."""

install_requires = []
with open(os.path.join(root, "requirements", "project.txt")) as f:
for line in f:
if not line.startswith("#"):
install_requires.append(line.strip())
return install_requires


class CustomMetadataHook(MetadataHookInterface):
"""Our metadata hook."""

def update(self, metadata):
"""See https://ofek.dev/hatch/latest/plugins/metadata-hook/ for more information."""

metadata["dependencies"] = get_requirements(self.root)
metadata["classifiers"] = [
f"Development Status :: {get_version_dev_status(self.root)}",
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules'
]
Loading

0 comments on commit d6e4742

Please sign in to comment.