Skip to content

Commit

Permalink
Prepare deployment (#2)
Browse files Browse the repository at this point in the history
* add bump version as dependency

* rename package to lm_pelican_quarto

* Bump version: 0.0.0 → 0.1.0

* improve README

* less quarto in readme

* add deployment workflow

* remove deployment step from pelican's main workflow

* Bump version: 0.1.0 → 0.2.0

* fix link to quarto docs in readme

---------

Co-authored-by: lukas <[email protected]>
  • Loading branch information
lmuenter and lukas authored Sep 3, 2024
1 parent 92d37ab commit 2f4392f
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 70 deletions.
6 changes: 6 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[bumpversion]
current_version = 0.2.0
commit = True
tag = True

[bumpversion:file:pyproject.toml]
31 changes: 31 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build and Publish to PyPI

on:
push:
tags:
- 'v*'

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Install PDM
run: pip install pdm

- name: Build package
run: pdm build

- name: Publish to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: dist
44 changes: 2 additions & 42 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
uses: JustinBeckwith/linkinator-action@v1
with:
retry: true
linksToSkip: "https://pypi.org/project/pelican-quarto/"
linksToSkip: "https://pypi.org/project/lm-pelican-quarto/"

- name: Set up Python & PDM
uses: pdm-project/setup-pdm@v4
Expand All @@ -54,44 +54,4 @@ jobs:
run: pdm install

- name: Run linters
run: pdm run invoke lint --diff

deploy:
name: Deploy
environment: Deployment
needs: [test, lint]
runs-on: ubuntu-latest
if: github.ref=='refs/heads/main' && github.event_name!='pull_request'

permissions:
contents: write
id-token: write

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Check release
id: check_release
run: |
python -m pip install autopub httpx
python -m pip install https://github.com/scikit-build/github-release/archive/master.zip
autopub check
- name: Publish
if: ${{ steps.check_release.outputs.autopub_release=='true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
autopub prepare
autopub commit
autopub build
autopub githubrelease
- name: Upload package to PyPI
if: ${{ steps.check_release.outputs.autopub_release=='true' }}
uses: pypa/gh-action-pypi-publish@release/v1
run: pdm run invoke lint --diff
73 changes: 51 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,67 @@
quarto: A Plugin for Pelican
====================================================
# A Quarto Reader for Pelican

[![Build Status](https://img.shields.io/github/actions/workflow/status/pelican-plugins/quarto/main.yml?branch=main)](https://github.com/lmuenter/pelican-quarto/actions)
[![PyPI Version](https://img.shields.io/pypi/v/pelican-quarto)](https://pypi.org/project/pelican-quarto/)
[![Downloads](https://img.shields.io/pypi/dm/pelican-quarto)](https://pypi.org/project/pelican-quarto/)
![License](https://img.shields.io/pypi/l/pelican-quarto?color=blue)
[![Build Status](https://img.shields.io/github/actions/workflow/status/lmuenter/pelican-quarto/main.yml?branch=main)](https://github.com/lmuenter/pelican-quarto/actions)
[![PyPI Version](https://img.shields.io/pypi/v/lm-pelican-quarto)](https://pypi.org/project/lm-pelican-quarto/)
[![Downloads](https://img.shields.io/pypi/dm/lm-pelican-quarto)](https://pypi.org/project/lm-pelican-quarto/)
![License](https://img.shields.io/pypi/l/lm-pelican-quarto?color=blue)

Example plugin generated by cookiecutter-pelican-plugin
This plugin integrates Quarto with Pelican, allowing you to render interactive reports and high-quality documents directly within your Pelican-generated static website.

Installation
------------
## Features

This plugin can be installed via:
- **Seamless Integration**: Automatically read and render Quarto Markdown (`.qmd`) files found in Pelican's content directory, making it easy to use Quarto with your existing Pelican setup.

python -m pip install pelican-quarto
- **Interactive Content**: Easily present dynamic and interactive elements like charts, tables, and other visualizations within Pelican pages, enhancing the interactivity and engagement of your content.

As long as you have not explicitly added a `PLUGINS` setting to your Pelican settings file, then the newly-installed plugin should be automatically detected and enabled. Otherwise, you must add `quarto` to your existing `PLUGINS` list. For more information, please see the [How to Use Plugins](https://docs.getpelican.com/en/latest/plugins.html#how-to-use-plugins) documentation.
- **Quarto Asset Management**: Utilizes Quarto’s asset management system, consolidating JavaScript, stylesheets, and other assets into a single `<output>/site_libs/` directory for efficient loading and maintenance.

Usage
-----
## Installation

<<Add plugin details here>>
You can install the Pelican-Quarto plugin using pip:

Contributing
------------
```bash
pip install lm-pelican-quarto
```

Contributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on [existing issues][].
After installation, add `lm_pelican_quarto` to your `PLUGINS` list in your Pelican settings file. For more detailed instructions, refer to the [How to Use Plugins](https://docs.getpelican.com/en/latest/plugins.html#how-to-use-plugins) section in the Pelican documentation.

To start contributing to this plugin, review the [Contributing to Pelican][] documentation, beginning with the **Contributing Code** section.
## Usage

Once integrated, Pelican-Quarto will automatically process Quarto Markdown (`.qmd`) files present in your content directory. During the build process, Pelican will:

1. Use the Quarto CLI to render `.qmd` files into HTML.
2. Generate necessary assets and place them in the `<output>/site_libs/` directory.
3. Merge Quarto-generated HTML into Pelican's HTML structure, ensuring that your site maintains a consistent look and feel.

This seamless process allows you to leverage Quarto's advanced content capabilities with minimal configuration or manual intervention.

## Customization

Pelican-Quarto will generate a `_quarto.yml` configuration file at the root of your content directory. You can customize this file to suit your specific needs. For more details on customization options, please refer to the [Quarto Documentation](https://quarto.org/docs/projects/quarto-projects.html).

### Quarto Pre-configuration

Pelican-Quarto employs a minimalist Quarto setup to simplify integration with Pelican. By default, it uses Quarto’s `Website` project type to minimize additional asset files in your output directory. You are free to experiment with different themes, enable or disable specific Quarto features, and further customize your Quarto environment.

## Dependencies

This plugin requires Quarto to be installed and accessible in your system's PATH. Ensure that you have [downloaded and installed Quarto](https://quarto.org/docs/download/) before using this plugin.

## Current Limitations

Pelican-Quarto is currently under active development. Some planned features include:

- Enhanced customization options via Pelican settings, allowing users to specify more detailed Quarto configurations directly from their Pelican setup.

## Contributing

Contributions to Pelican-Quarto are welcome and greatly appreciated. Whether it’s improving documentation, adding new features, or fixing bugs, every contribution helps. You can also contribute by reviewing and providing feedback on [existing issues][existing issues].

To get started with contributing, please refer to the [Contributing to Pelican][Contributing to Pelican] guide, particularly the **Contributing Code** section.

[existing issues]: https://github.com/lmuenter/pelican-quarto/issues
[Contributing to Pelican]: https://docs.getpelican.com/en/latest/contribute.html

License
-------
## License

This project is licensed under the MIT license.
This project is licensed under the MIT License.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_plugin_functionality(create_article, temp_path, quarto_run_mock):
"PATH": content_path,
"OUTPUT_PATH": output_path,
"PLUGIN_PATHS": ["../"],
"PLUGINS": ["quarto"],
"PLUGINS": ["lm_pelican_quarto"],
}
)
pelican = Pelican(settings=settings)
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pelican-quarto"
version = "0.0.0"
name = "lm-pelican-quarto"
version = "0.2.0"
description = "A plugin for integrating Quarto reports in your Pelican articles."
authors = [{name = "Lukas Muenter", email = "[email protected]"}]
license = {text = "MIT"}
Expand Down Expand Up @@ -57,7 +57,7 @@ source-includes = [
"CHANGELOG.md",
"CONTRIBUTING.md",
]
includes = ["pelican/"]
includes = ["pelican/plugins/lm_pelican_quarto"]
excludes = ["**/.DS_Store", "**/test_data/**", "tasks.py"]

[tool.autopub]
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ ruff==0.6.2
pelican==4.9.1
pyYAML==6.0.2
markdown==3.7
beautifulsoup4==4.12.3
beautifulsoup4==4.12.3
bump2version==1.0.1
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

logger = logging.getLogger(__name__)

PKG_NAME = "quarto"
PKG_NAME = "lm_pelican_quarto"
PKG_PATH = Path(f"pelican/plugins/{PKG_NAME}")

ACTIVE_VENV = os.environ.get("VIRTUAL_ENV", None)
Expand Down

0 comments on commit 2f4392f

Please sign in to comment.