Skip to content

Commit

Permalink
Retemplate + ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Apr 18, 2024
1 parent 2e3ac8d commit 0690144
Show file tree
Hide file tree
Showing 58 changed files with 890 additions and 1,182 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ version: 2
jobs:
twine-check:
docker:
- image: circleci/python:3.8
- image: circleci/python:3.12
steps:
- checkout
- run: python setup.py sdist
- run: python -m pip install -U --user --force-reinstall twine
- run: python -m pip install -U --user build
- run: python -m build . --sdist
- run: python -m pip install -U --user twine
- run: python -m twine check dist/*

workflows:
version: 2
twine-check:
Expand Down
8 changes: 8 additions & 0 deletions .codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
codecov:
token: a0dfd87f-8eb9-4a41-9e4e-a06919f216cd
comment: off
coverage:
status:
project:
default:
threshold: 0.2%
33 changes: 15 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ name: CI
on:
push:
branches:
- 'main'
- '*.*'
- '!*backport*'
- "main"
- "*.*"
- "!*backport*"
tags:
- 'v*'
- '!*dev*'
- '!*pre*'
- '!*post*'
- "v*"
- "!*dev*"
- "!*pre*"
- "!*post*"
pull_request:
workflow_dispatch:
schedule:
# ┌───────── minute (0 - 59)
# │ ┌───────── hour (0 - 23)
# │ │ ┌───────── day of the month (1 - 31)
# │ │ │ ┌───────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT)
- cron: '0 7 * * *' # Every day at 07:00 UTC
# ┌───────── minute (0 - 59)
# │ ┌───────── hour (0 - 23)
# │ │ ┌───────── day of the month (1 - 31)
# │ │ │ ┌───────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT)
- cron: "0 7 * * *" # Every day at 07:00 UTC

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -57,17 +57,15 @@ jobs:
- pandoc
- graphviz
envs: |
- linux: py311-sphinx6
- macos: py310-sphinx5
- windows: py39-sphinx5
- macos: py311-sphinx6
- windows: py310-sphinx56
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

docs:
needs: [test]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
default_python: '3.9'
submodules: false
pytest: false
envs: |
Expand All @@ -77,7 +75,6 @@ jobs:
needs: [test]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
default_python: '3.9'
submodules: false
coverage: codecov
libraries: |
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -U --user --force-reinstall pep517 setuptools_scm twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m pep517.build --binary --source --out-dir wheelhouse .
python -m twine upload --skip-existing wheelhouse/*
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -U --user --force-reinstall pep517 setuptools_scm twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m pep517.build --binary --source --out-dir wheelhouse .
python -m twine upload --skip-existing wheelhouse/*
75 changes: 37 additions & 38 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
ci:
autofix_prs: false
autoupdate_schedule: "quarterly"
repos:
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
- repo: https://github.com/myint/docformatter
rev: v1.7.5
hooks:
- id: autoflake
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
- id: docformatter
args: ["--in-place", "--pre-summary-newline", "--make-summary-multi"]
- repo: https://github.com/myint/autoflake
rev: v2.3.1
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 24.4.0
- id: autoflake
args:
[
"--in-place",
"--remove-all-unused-imports",
"--remove-unused-variable",
]
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|docs/conf.py)$"
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.4.0"
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
- id: ruff
args: ["--fix", "--unsafe-fixes"]
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: trailing-whitespace
- id: mixed-line-ending
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.3.7'
hooks:
- id: ruff
args: ['--fix']
- repo: https://github.com/awebdeveloper/pre-commit-stylelint
rev: '0.0.2'
- id: check-ast
- id: check-case-conflict
- id: trailing-whitespace
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
- id: mixed-line-ending
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
- id: end-of-file-fixer
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
- id: check-yaml
- id: debug-statements
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: stylelint
additional_dependencies: ['stylelint@14.9.1', 'stylelint-config-standard@26.0.0']
- repo: https://github.com/pre-commit/mirrors-prettier
- id: codespell
additional_dependencies:
- tomli
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [css, scss, javascript]
- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.34.1
hooks:
- id: djlint-jinja
types_or: ["html"]
- id: prettier
8 changes: 4 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ sphinx:
configuration: docs/conf.py
fail_on_warning: false
python:
install:
- method: pip
extra_requirements:
install:
- method: pip
extra_requirements:
- all
- docs
path: .
path: .
2 changes: 1 addition & 1 deletion .rtd-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: rtd_ablog
channels:
- conda-forge
dependencies:
- python=3.10
- python=3.12
- pip
- graphviz
- make
Expand Down
2 changes: 1 addition & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "stylelint-config-standard"
"extends": "stylelint-config-standard"
}
10 changes: 4 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
ABlog for Sphinx
================

|Build Status|

.. |Build Status| image:: https://dev.azure.com/sunpy/ablog/_apis/build/status/sunpy.ablog?repoName=sunpy%2Fablog&branchName=main
:target: https://dev.azure.com/sunpy/ablog/_build/latest?definitionId=17&repoName=sunpy%2Fablog&branchName=main
[![CI](https://github.com/sunpy/ablog/actions/workflows/ci.yml/badge.svg)](https://github.com/sunpy/ablog/actions/workflows/ci.yml)
[![Upload Python Package](https://github.com/sunpy/ablog/actions/workflows/pythonpublish.yml/badge.svg)](https://github.com/sunpy/ablog/actions/workflows/pythonpublish.yml)

ABlog is a Sphinx extension that converts any documentation or personal website project into a full-fledged blog

Expand All @@ -19,6 +17,6 @@ The original project is no longer maintained and the `SunPy Project <https://www
Warning
-------

**This version is maintained with the aim to keep it working for SunPy Project website and thus new features or bugfixes are highly unlikely unless they directly impact.**
**This version is maintained with the aim to keep it working for SunPy Project website and thus new features or bugfixes are highly unlikely unless they directly impact the SunPy Project**

**We strongly encourage users and interested in parties in submitting patches to ``ablog``.**
**We strongly encourage users and interested in parties in submitting patches to ``ablog``**
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def rootdir():
return Path(__file__).parent.absolute() / "roots"


@pytest.fixture(scope="function", autouse=True)
@pytest.fixture(autouse=True)
def reset_blog_config():
# Reset cached configurations to enable confoverrides
from ablog.blog import Blog
Expand Down
11 changes: 5 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import re
from pathlib import Path

import ablog
from packaging.version import parse as _parse
from sphinx import addnodes

import ablog

ablog_builder = "dirhtml"
ablog_website = "_website"
extensions = [
Expand All @@ -24,7 +23,7 @@

version = str(_parse(ablog.__version__))
project = "ABlog"
copyright = "2014-2022, ABlog Team"
copyright = "2014-2022, ABlog Team" # NOQA: A001
master_doc = "index"
source_suffix = {
".rst": "restructuredtext",
Expand Down Expand Up @@ -59,10 +58,10 @@
blog_feed_fulltext = True
blog_feed_templates = {
"atom": {
"content": "{{ title }}{% for tag in post.tags %}" " #{{ tag.name|trim()|replace(' ', '') }}" "{% endfor %}",
"content": "{{ title }}{% for tag in post.tags %} #{{ tag.name|trim()|replace(' ', '') }} {% endfor %}",
},
"social": {
"content": "{{ title }}{% for tag in post.tags %}" " #{{ tag.name|trim()|replace(' ', '') }}" "{% endfor %}",
"content": "{{ title }}{% for tag in post.tags %} #{{ tag.name|trim()|replace(' ', '') }} {% endfor %}",
},
}
disqus_shortname = "https-ablog-readthedocs-io"
Expand All @@ -82,7 +81,7 @@
"ablog/languages.html",
"ablog/locations.html",
"searchbox.html",
]
],
}
html_theme_options = {
"travis_button": False,
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Once you have content (in ``.rst`` files), you can post *any page* using the :rs
:location: SF
:language: en
An alterative method is:
An alternative method is:

.. code-block:: rst
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/ablog-commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Running ``ablog deploy`` will push your website to GitHub::
`conf.py`
-g GITHUB_PAGES GitHub username for deploying to GitHub pages
-m MESSAGE commit message
-f owerwrite last commit, i.e. `commit --amend; push -f`
-f overwrite last commit, i.e. `commit --amend; push -f`
--push-quietly be more quiet when pushing changes
--github-branch GITHUB_BRANCH
Branch to use. Default is 'master'.
Expand Down
6 changes: 4 additions & 2 deletions docs/manual/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This page is a markdown file underneath.
You will need to do a few things to get setup.

1. Install [myst-parser](https://pypi.org/project/myst-parser/)
2. Add these options to your config, ``conf.py``
2. Add these options to your config, `conf.py`

```python
extensions = [
Expand All @@ -27,6 +27,7 @@ myst_update_mathjax = False
```

Then use the new blogpost metadata format (with a slight twist):

```
---
blogpost: true
Expand All @@ -41,7 +42,8 @@ language: English
Notice here we do not have a ":" at the start since the markdown metadata format is different from rst.

Please be aware that adding "myst-parser" will mean it will read all markdown files and try to parse them.
You will need to use the following in your ``conf.py`` to prevent this:
You will need to use the following in your `conf.py` to prevent this:

```python
exclude_patterns = [
"posts/*/.ipynb_checkpoints/*",
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/notebook_support.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"To add support for Notebooks to your Ablog instance, you need to configure your `docs/conf.py` (or whereever your `conf.py` is located.\n",
"To add support for Notebooks to your Ablog instance, you need to configure your `docs/conf.py` (or wherever your `conf.py` is located.\n",
"\n",
"You will need to add\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/release/ablog-v0.10-released.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ ABlog v0.10.20 released
Pull Requests merged in:

`fix documentation typo in blog-drafts <https://github.com/sunpy/ablog/pull/105>`__.
`Fix typo in "extennsion" <https://github.com/sunpy/ablog/pull/109>`__.
`Fix typo in "extension" <https://github.com/sunpy/ablog/pull/109>`__.
`Catalan translation <https://github.com/sunpy/ablog/pull/113>`__.
`Fix ablog post <https://github.com/sunpy/ablog/pull/114>`__.

Expand Down
Loading

0 comments on commit 0690144

Please sign in to comment.