diff --git a/.gitignore b/.gitignore deleted file mode 100644 index a4b5d1a..0000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -__pycache__/ -cache/ -output/ -venv/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index d9690ed..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# To execute those rules on all files: pre-commit run --all-files -repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 - hooks: - - id: check-ast - - id: check-byte-order-marker - - id: check-case-conflict - - id: check-docstring-first - - id: check-yaml - - id: debug-statements - - id: end-of-file-fixer - - id: trailing-whitespace - - id: mixed-line-ending - args: ['--fix=lf'] - - id: check-added-large-files - args: ['--maxkb=1000'] diff --git a/.python-version b/.python-version deleted file mode 100644 index 371cfe3..0000000 --- a/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.11.1 diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 17185c3..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 py-pdf - -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. diff --git a/Makefile b/Makefile deleted file mode 100644 index b364f06..0000000 --- a/Makefile +++ /dev/null @@ -1,79 +0,0 @@ -PY?= -PELICAN?=pelican -PELICANOPTS= - -BASEDIR=$(CURDIR) -INPUTDIR=$(BASEDIR)/content -OUTPUTDIR=$(BASEDIR)/output -CONFFILE=$(BASEDIR)/pelicanconf.py -PUBLISHCONF=$(BASEDIR)/publishconf.py - -GITHUB_PAGES_BRANCH=gh-pages - - -DEBUG ?= 0 -ifeq ($(DEBUG), 1) - PELICANOPTS += -D -endif - -RELATIVE ?= 0 -ifeq ($(RELATIVE), 1) - PELICANOPTS += --relative-urls -endif - -SERVER ?= "0.0.0.0" - -PORT ?= 0 -ifneq ($(PORT), 0) - PELICANOPTS += -p $(PORT) -endif - - -help: - @echo 'Makefile for a pelican Web site ' - @echo ' ' - @echo 'Usage: ' - @echo ' make html (re)generate the web site ' - @echo ' make clean remove the generated files ' - @echo ' make regenerate regenerate files upon modification ' - @echo ' make publish generate using production settings ' - @echo ' make serve [PORT=8000] serve site at http://localhost:8000' - @echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 ' - @echo ' make devserver [PORT=8000] serve and regenerate together ' - @echo ' make devserver-global regenerate and serve on 0.0.0.0 ' - @echo ' make github upload the web site via gh-pages ' - @echo ' ' - @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html ' - @echo 'Set the RELATIVE variable to 1 to enable relative urls ' - @echo ' ' - -html: - "$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) - -clean: - [ ! -d "$(OUTPUTDIR)" ] || rm -rf "$(OUTPUTDIR)" - -regenerate: - "$(PELICAN)" -r "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) - -serve: - "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) - -serve-global: - "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -b $(SERVER) - -devserver: - "$(PELICAN)" -lr "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) - -devserver-global: - $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -b 0.0.0.0 - -publish: - "$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(PUBLISHCONF)" $(PELICANOPTS) - -github: publish - ghp-import -m "Generate Pelican site" -b $(GITHUB_PAGES_BRANCH) "$(OUTPUTDIR)" - git push origin $(GITHUB_PAGES_BRANCH) - - -.PHONY: html help clean regenerate serve serve-global devserver publish github diff --git a/README.md b/README.md deleted file mode 100644 index ba210b7..0000000 --- a/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# py-pdf.github.io -Website py-pdf - -## Install requirements -``` -$ pip install -r requirements.txt -$ pre-commit install -``` - -## Launch local server with livereload -``` -$ invoke livereload -``` - -## Adding a Python dependency -1. Edit `requirements.in` -2. Run `pip-compile requirements.in` to generate `requirements.txt` - -## Publish -``` -$ make github -``` diff --git a/archives.html b/archives.html index fc0f61e..16182a6 100644 --- a/archives.html +++ b/archives.html @@ -33,6 +33,7 @@

links

  • fpdf2
  • PyPDF-Builder
  • pdfly
  • +
  • pypdf_table_extraction
  • diff --git a/authors.html b/authors.html index bcfcf5a..73808e7 100644 --- a/authors.html +++ b/authors.html @@ -34,6 +34,7 @@

    links

  • fpdf2
  • PyPDF-Builder
  • pdfly
  • +
  • pypdf_table_extraction
  • diff --git a/categories.html b/categories.html index 24e8953..f3997a7 100644 --- a/categories.html +++ b/categories.html @@ -34,6 +34,7 @@

    links

  • fpdf2
  • PyPDF-Builder
  • pdfly
  • +
  • pypdf_table_extraction
  • diff --git a/content/images/github-org-public-membership.png b/content/images/github-org-public-membership.png deleted file mode 100644 index 1ca257e..0000000 Binary files a/content/images/github-org-public-membership.png and /dev/null differ diff --git a/content/images/pypdf-snake.png b/content/images/pypdf-snake.png deleted file mode 100644 index 8c7f6c2..0000000 Binary files a/content/images/pypdf-snake.png and /dev/null differ diff --git a/content/pages/index.md b/content/pages/index.md deleted file mode 100644 index f5d8b14..0000000 --- a/content/pages/index.md +++ /dev/null @@ -1,10 +0,0 @@ -Title: The py-pdf organization -Slug: ../index -Save_as: index.html -Authors: Martin Thoma -Summary: What py-pdf is about - -The py-pdf organization is a group of Python developers who provide -libraries and applications around PDF documents. - -
    ![pypdf logo](images/pypdf-snake.png)
    diff --git a/content/pages/maintainer-guidelines.md b/content/pages/maintainer-guidelines.md deleted file mode 100644 index ca765d5..0000000 --- a/content/pages/maintainer-guidelines.md +++ /dev/null @@ -1,137 +0,0 @@ -Title: Maintainer guidelines -Tags: guideline, maintainer - -## Table of contents - - - - -- [Volunteering](#volunteering) -- [Governance](#governance) - * [The relationship of py-pdf to its projects](#the-relationship-of-py-pdf-to-its-projects) - * [Conditions for projects to be added to py-pdf](#conditions-for-projects-to-be-added-to-py-pdf) - * [Responsibility of project maintainers](#responsibility-of-project-maintainers) - * [GitHub roles](#github-roles) -- [Releases](#releases) - - - -## Volunteering -All [@py-pdf](https://github.com/py-pdf) members are volunteers. -They dedicate some of their time to maintain open-source projects, answer questions and review Pull Requests. - -[@py-pdf](https://github.com/py-pdf) members should never be required to operate within deadlines, or even respond within a given time frame. - -If you are a user of a [@py-pdf](https://github.com/py-pdf) project and want something done, -whether it is a bugfix or a feature request, your best options for achieving what you want are: - -* being polite and patient -* volunteer to contribute yourself - -To all [@py-pdf](https://github.com/py-pdf) members, remember: [it's okay to hit pause](https://opensource.guide/best-practices/#its-okay-to-hit-pause), and take time away from volunteer open-source work. - -
    - -## Governance -`py-pdf` governance model is descibed there: - - -
    - -## The relationship of py-pdf to its projects - -`py-pdf` wants to ensure the Python-PDF ecosystem is prospering. We recognize that individual -maintainers did and still do an outstanding job, but we also see that personal lives sometimes -move away from software projects. - -That means: - -1. `py-pdf` offers the platform to exchange ideas and provide feedback -2. `py-pdf` administrators who are not project members do interfere, when (a) no activity by the maintainers is in the project for at least 6 months and at least 3 friendly "are you alive" questions over at least 6 weeks. (b) security issues are detected -3. `py-pdf` leaves the projects do their thing in all other cases. - -
    - -## Conditions for projects to be added to py-pdf - -We want projects which provide value to users and we need to be able to maintain them. We want to improve the Python / PDF ecosystem and not scatter it. - -1. The project has to be a Python project and about PDF documents -2. If it's a software project, it has (1) a README with the projects purpose, installation instructions, and a usage example (2) it's either the main project or the fork that has more popularity measured in GitHub stars -3. It either has a different purpose than all other projects in `py-pdf` or is more popular than the existing projects for that purpose -4. It needs to be a FOSS license (e.g. BSD, MIT, Apache) - -
    - -## Responsibility of project maintainers - -1. **Software Reliability**: Please ensure that your project follows best practices in software development. Introduce a [deprecation process](https://pypdf.readthedocs.io/en/latest/dev/deprecations.html) and follow it. -2. **Kindness**: We are all here because it's fun to help others and create good software. But we are humans: people can have bad days and people might not speak English as a mother tongue. When in doubt, assume the best. Let people know how you perceived their interaction. -3. **Know your Limits**: It's ok to reduce the time you spend on your project or even step away from it. Stay healthy. -4. **Let your Project Grow**: Especially if you step away, let others take over. Make it explicit that you're looking for another person who would take over. -It's OK to [say no](https://opensource.guide/best-practices/#learning-to-say-no). - - - -
    - -## GitHub roles -The base permission for [@py-pdf](https://github.com/py-pdf) members is set to **Write**, -meaning any [@py-pdf](https://github.com/py-pdf) member has read permissions, -can manage issues and pull requests, and also push to repositories. - -We encourage [@py-pdf](https://github.com/py-pdf) members, and especially maintainers, to make their organization membership **public** -on , in order to clarify who has ownership of the organization, and the associated rights to perform package releases: - -![](../images/github-org-public-membership.png) - -
    - -## Releases -Depending on the projects, the release process can be automated inside GitHub Actions pipelines, or stays manual. - - - - - - diff --git a/content/pages/py-pdf-owners.md b/content/pages/py-pdf-owners.md deleted file mode 100644 index 69e3d1e..0000000 --- a/content/pages/py-pdf-owners.md +++ /dev/null @@ -1,24 +0,0 @@ -Title: Rules for py-pdf owners -Date: 2023-04-18 17:10 -Modified: 2023-04-18 17:10 -Tags: Governance -Slug: py-pdf-owners -Authors: Martin Thoma -Summary: How py-pdf organization owners agree to act - -Welcome to the "py-pdf" organization! As a [GitHub organiztion owner](https://docs.github.com/en/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization), -your role is to ensure that our projects flourish while minimizing unnecessary -interference. To achieve this goal, we ask that you follow these rules. - -## The Rules - -1. **No owner removes any other owner** from the organization, except if any of those events happen: - 1. There is evidence for credentials being stolen / a malicious owner. Latest 30 minutes after the owner was removed, an [issue in py-pdf.github.io](https://github.com/py-pdf/py-pdf.github.io/issues) is created. The incident is publicly documented. - 2. The other owner is not active for at least 12 months. The owner is contacted at least 3 times over at least 3 months. The last e-mail is at least 30 days ago. Am [issue in py-pdf.github.io](https://github.com/py-pdf/py-pdf.github.io/issues) is created to document it. - 3. The other owner is harming the project in the way they act publicly (e.g. insulting people in issues). This needs all other owners to agree + an [issue in py-pdf.github.io](https://github.com/py-pdf/py-pdf.github.io/issues). If there is only 2 owners in total (one about to be removed) a 75% majority of people voting with "thumbs up" (to remove) vs less than 25% people voting with "thumbs down" (not remove). In that case, there need to be at least 4 non-owners to vote to remove the owner. -2. **No owner adds any new owner** to the organization, except if all of the following conditions are met: - 1. The new owner has two-factor authentication enabled (see [security settings](https://github.com/settings/security) - security keys and authenticator app are preferred), and - 2. All other owners agree, and - 3. The new owner agrees to those rules. In case the new owner has an account successor, the new owner ensures that person also agrees to the rules. -3. **Owners typically don't interfere with other projects**, except if the project itself is at risk (e.g. security issues / no merges for at least 6 months) -4. **Those rules can only be changed by all owners agreeing** on the new version. This "py-pdf owner ruleset" should be documented at https://py-pdf.github.io/. Any change is done by PR / agreement is showed by an approval. diff --git a/feeds/all.atom.xml b/feeds/all.atom.xml index 014588e..64bc85b 100644 --- a/feeds/all.atom.xml +++ b/feeds/all.atom.xml @@ -1,2 +1,2 @@ -The py-pdf organizationhttps://py-pdf.github.io/2023-10-09T22:13:49Z \ No newline at end of file +The py-pdf organizationhttps://py-pdf.github.io/2024-08-19T18:03:44Z \ No newline at end of file diff --git a/index.html b/index.html index bae38ed..323c40a 100644 --- a/index.html +++ b/index.html @@ -34,6 +34,7 @@

    links

  • fpdf2
  • PyPDF-Builder
  • pdfly
  • +
  • pypdf_table_extraction
  • diff --git a/pages/maintainer-guidelines.html b/pages/maintainer-guidelines.html index 08fdde4..0687c30 100644 --- a/pages/maintainer-guidelines.html +++ b/pages/maintainer-guidelines.html @@ -149,6 +149,7 @@

    links

  • fpdf2
  • PyPDF-Builder
  • pdfly
  • +
  • pypdf_table_extraction
  • diff --git a/pages/py-pdf-owners.html b/pages/py-pdf-owners.html index c12113b..df52ff3 100644 --- a/pages/py-pdf-owners.html +++ b/pages/py-pdf-owners.html @@ -51,6 +51,7 @@

    links

  • fpdf2
  • PyPDF-Builder
  • pdfly
  • +
  • pypdf_table_extraction
  • diff --git a/pelicanconf.py b/pelicanconf.py deleted file mode 100644 index 64acc24..0000000 --- a/pelicanconf.py +++ /dev/null @@ -1,52 +0,0 @@ -import logging - -logging.root.setLevel(logging.INFO) -logging.getLogger('pelican.utils').setLevel(logging.WARN) # avoids verbose "-> Copying ..." logs -logging.getLogger('tornado.access').setLevel(logging.WARN) # avoids verbose HTTP logs from livereload server -# Configure LOG_FORMAT to prefix it with "%(asctime)s [%(module)s]": -if logging.root.handlers: # handlers are only set the 2nd time this file is evaluated by Pelican - formatter = logging.root.handlers[0].formatter - formatter._fmt = formatter._style._fmt = "%(asctime)s [%(name)s] %(levelname)s %(message)s" - -AUTHOR = "The py-pdf owners" -SITENAME = "The py-pdf organization" - -TIMEZONE = "Europe/Berlin" -DEFAULT_LANG = "en" - -PATH = './content' -OUTPUT_PATH = './output' - -# Blogroll -LINKS = ( - ("Github", "https://github.com/py-pdf"), - # Order the following by Github stars: - # Either link to GitHub or to PyPI - ("pypdf and PyPDF2", "https://github.com/py-pdf/pypdf"), - ("fpdf2", "https://github.com/py-pdf/fpdf2"), - ("PyPDF-Builder", "https://github.com/py-pdf/PyPDF-Builder"), - ("pdfly", "https://github.com/py-pdf/pdfly"), - ("pypdf_table_extraction", "https://github.com/py-pdf/pypdf_table_extraction"), -) - -# Social widget -SOCIAL = ( # ('You can add links in your config file', '#'), - ("py_pdf", "https://twitter.com/py_pdf"), -) - -DEFAULT_PAGINATION = 10 - - -####################################### -# Config options specific to dev-mode: -####################################### - -# Uncomment following line if you want document-relative URLs when developing -# RELATIVE_URLS = True - -# Feed generation is usually not desired when developing -FEED_ALL_ATOM = None -CATEGORY_FEED_ATOM = None -TRANSLATION_FEED_ATOM = None -AUTHOR_FEED_ATOM = None -AUTHOR_FEED_RSS = None diff --git a/publishconf.py b/publishconf.py deleted file mode 100644 index c496cad..0000000 --- a/publishconf.py +++ /dev/null @@ -1,22 +0,0 @@ -# This file is only used if you use `make publish` or -# explicitly specify it as your config file. - -import os -import sys - -sys.path.append(os.curdir) -from pelicanconf import * # noqa - -# If your site is available via HTTPS, make sure SITEURL begins with https:// -SITEURL = "https://py-pdf.github.io" -RELATIVE_URLS = False - -FEED_ALL_ATOM = "feeds/all.atom.xml" -CATEGORY_FEED_ATOM = "feeds/{slug}.atom.xml" - -DELETE_OUTPUT_DIRECTORY = True - -# Following items are often useful when publishing - -# DISQUS_SITENAME = "" -# GOOGLE_ANALYTICS = "" diff --git a/requirements.in b/requirements.in deleted file mode 100644 index 90f2d78..0000000 --- a/requirements.in +++ /dev/null @@ -1,9 +0,0 @@ -ghp-import # publish blog on https://py-pdf.github.io/ -pip-tools # brings pip-compile to update the requirements.txt -pre-commit # automatically apply style checks/autofixes - -# For the blog: -invoke -livereload -markdown -pelican diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 1165a56..0000000 --- a/requirements.txt +++ /dev/null @@ -1,98 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.8 -# by the following command: -# -# pip-compile requirements.in -# -blinker==1.6 - # via pelican -build==0.10.0 - # via pip-tools -cfgv==3.3.1 - # via pre-commit -click==8.1.3 - # via pip-tools -distlib==0.3.6 - # via virtualenv -docutils==0.19 - # via pelican -feedgenerator==2.0.0 - # via pelican -filelock==3.10.7 - # via virtualenv -ghp-import==2.1.0 - # via -r requirements.in -identify==2.5.22 - # via pre-commit -importlib-metadata==6.1.0 - # via markdown -invoke==2.0.0 - # via -r requirements.in -jinja2==3.1.2 - # via pelican -livereload==2.6.3 - # via -r requirements.in -markdown==3.4.3 - # via -r requirements.in -markdown-it-py==2.2.0 - # via rich -markupsafe==2.1.2 - # via jinja2 -mdurl==0.1.2 - # via markdown-it-py -nodeenv==1.7.0 - # via pre-commit -packaging==23.0 - # via build -pelican==4.8.0 - # via -r requirements.in -pip-tools==6.12.3 - # via -r requirements.in -platformdirs==3.2.0 - # via virtualenv -pre-commit==3.2.1 - # via -r requirements.in -pygments==2.14.0 - # via - # pelican - # rich -pyproject-hooks==1.0.0 - # via build -python-dateutil==2.8.2 - # via - # ghp-import - # pelican -pytz==2023.3 - # via - # feedgenerator - # pelican -pyyaml==6.0 - # via pre-commit -rich==13.3.3 - # via pelican -six==1.16.0 - # via - # livereload - # python-dateutil -tomli==2.0.1 - # via - # build - # pyproject-hooks -tornado==6.2 - # via livereload -typing-extensions==4.5.0 - # via - # blinker - # rich -unidecode==1.3.6 - # via pelican -virtualenv==20.21.0 - # via pre-commit -wheel==0.40.0 - # via pip-tools -zipp==3.15.0 - # via importlib-metadata - -# The following packages are considered to be unsafe in a requirements file: -# pip -# setuptools diff --git a/tags.html b/tags.html index 06c8bc1..91b3172 100644 --- a/tags.html +++ b/tags.html @@ -34,6 +34,7 @@

    links

  • fpdf2
  • PyPDF-Builder
  • pdfly
  • +
  • pypdf_table_extraction
  • diff --git a/tasks.py b/tasks.py deleted file mode 100644 index 5e3edde..0000000 --- a/tasks.py +++ /dev/null @@ -1,160 +0,0 @@ -import os -import shlex -import shutil -import sys -import datetime - -from invoke import task -from invoke.main import program -from livereload import Server -from pelican import main as pelican_main -from pelican.server import ComplexHTTPRequestHandler, RootedHTTPServer -from pelican.settings import DEFAULT_CONFIG, get_settings_from_file - -OPEN_BROWSER_ON_SERVE = True -SETTINGS_FILE_BASE = "pelicanconf.py" -SETTINGS = {} -SETTINGS.update(DEFAULT_CONFIG) -LOCAL_SETTINGS = get_settings_from_file(SETTINGS_FILE_BASE) -SETTINGS.update(LOCAL_SETTINGS) - -CONFIG = { - "settings_base": SETTINGS_FILE_BASE, - "settings_publish": "publishconf.py", - # Output path. Can be absolute or relative to tasks.py. Default: 'output' - "deploy_path": SETTINGS["OUTPUT_PATH"], - # Github Pages configuration - "github_pages_branch": "gh-pages", - "commit_message": f"'Publish site on {datetime.date.today().isoformat()}'", - # Host and port for `serve` - "host": "localhost", - "port": 8000, -} - - -@task -def clean(c): - """Remove generated files""" - if os.path.isdir(CONFIG["deploy_path"]): - shutil.rmtree(CONFIG["deploy_path"]) - os.makedirs(CONFIG["deploy_path"]) - - -@task -def build(c): - """Build local version of site""" - pelican_run("-s {settings_base}".format(**CONFIG)) - - -@task -def rebuild(c): - """`build` with the delete switch""" - pelican_run("-d -s {settings_base}".format(**CONFIG)) - - -@task -def regenerate(c): - """Automatically regenerate site upon file modification""" - pelican_run("-r -s {settings_base}".format(**CONFIG)) - - -@task -def serve(c): - """Serve site at http://$HOST:$PORT/ (default is localhost:8000)""" - - class AddressReuseTCPServer(RootedHTTPServer): - allow_reuse_address = True - - server = AddressReuseTCPServer( - CONFIG["deploy_path"], - (CONFIG["host"], CONFIG["port"]), - ComplexHTTPRequestHandler, - ) - - if OPEN_BROWSER_ON_SERVE: - # Open site in default browser - import webbrowser - - webbrowser.open("http://{host}:{port}".format(**CONFIG)) - - sys.stderr.write("Serving at {host}:{port} ...\n".format(**CONFIG)) - server.serve_forever() - - -@task -def reserve(c): - """`build`, then `serve`""" - build(c) - serve(c) - - -@task -def preview(c): - """Build production version of site""" - pelican_run("-s {settings_publish}".format(**CONFIG)) - - -@task -def livereload(c): - """Automatically reload browser tab upon file modification.""" - def cached_build(): - cmd = "-s {settings_base} -e CACHE_CONTENT=true LOAD_CONTENT_CACHE=true" - pelican_run(cmd.format(**CONFIG)) - - cached_build() - server = Server() - theme_path = SETTINGS["THEME"] - watched_globs = [ - CONFIG["settings_base"], - f"{theme_path}/templates/**/*.html", - ] - - content_file_extensions = [".md", ".rst"] - for extension in content_file_extensions: - content_glob = "{}/**/*{}".format(SETTINGS["PATH"], extension) - watched_globs.append(content_glob) - - static_file_extensions = [".css", ".js"] - for extension in static_file_extensions: - static_file_glob = f"{theme_path}/static/**/*{extension}" - watched_globs.append(static_file_glob) - - for glob in watched_globs: - server.watch(glob, cached_build) - - if OPEN_BROWSER_ON_SERVE: - # Open site in default browser - import webbrowser - - webbrowser.open("http://{host}:{port}".format(**CONFIG)) - - server.serve(host=CONFIG["host"], port=CONFIG["port"], root=CONFIG["deploy_path"]) - - -@task -def publish(c): - """Publish to production via rsync""" - pelican_run("-s {settings_publish}".format(**CONFIG)) - c.run( - 'rsync --delete --exclude ".DS_Store" -pthrvz -c ' - '-e "ssh -p {ssh_port}" ' - "{} {ssh_user}@{ssh_host}:{ssh_path}".format( - CONFIG["deploy_path"].rstrip("/") + "/", **CONFIG - ) - ) - - -@task -def gh_pages(c): - """Publish to GitHub Pages""" - preview(c) - c.run( - "ghp-import -b {github_pages_branch} " - "-m {commit_message} " - "{deploy_path} -p".format(**CONFIG) - ) - - -def pelican_run(cmd): - cmd += " " + program.core.remainder # allows to pass-through args to pelican - pelican_main(shlex.split(cmd))