Skip to content

Commit 713d37e

Browse files
committed
Merge remote-tracking branch 'upstream/main' into feat_pyenv_support
2 parents 3fa0ecc + 4477ce6 commit 713d37e

23 files changed

+630
-117
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
pull_request:
55
branches:
66
- main
7+
push:
8+
branches:
9+
- main
710

811
jobs:
912
test:

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ coverage.xml
2626

2727
# mypy
2828
.mypy_cache/
29+
30+
# Generated documentation
31+
/docs/build/
32+
/docs/source/api/

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repos:
2525
- id: isort
2626
name: isort
2727
- repo: https://github.com/psf/black
28-
rev: 22.6.0
28+
rev: 22.8.0
2929
hooks:
3030
- id: black
3131
- repo: https://github.com/pycqa/flake8

CONTRIBUTING.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Contribution guide for developers
2+
3+
## Documentation
4+
5+
### Install the documentation dependencies
6+
7+
To get started, you will need to install the documentation dependencies from the project root:
8+
9+
```shell
10+
poetry install --extras docs
11+
```
12+
13+
### The quickest way to get started
14+
15+
The following command (run from project root) will launch a live-reloaded session of the
16+
documentation in your browser, effectively combining the steps detailed in the following sections:
17+
18+
```shell
19+
poetry run make -C docs live
20+
```
21+
22+
### Activate the environment
23+
24+
You will need to activate the virtual environment in order to use the dependencies that were
25+
just installed:
26+
27+
```shell
28+
poetry shell
29+
```
30+
31+
Your prompt should now have a prefix, e.g.:
32+
33+
```shell
34+
(pyscript-cli-_y5OiBT8-py3.9) mattkram [~/dev/pyscript-cli] $
35+
```
36+
37+
### Generate the docs in live mode
38+
39+
The live mode will allow you to generate the documentation with live reload.
40+
41+
From the project root, run the following command :
42+
43+
```shell
44+
make -C docs live
45+
```
46+
47+
Or, alternately, navigate to the `docs` directory and run:
48+
49+
```shell
50+
make live
51+
```
52+
53+
54+
Either of the above commands should launch a live dev server and you will be able to view the
55+
docs in your browser.
56+
As the files are updated, the docs should be refreshed.
57+
58+
### Generate static docs
59+
60+
If you don't want to use the live reload mode, simply replace either command above with `html`,
61+
e.g.:
62+
63+
```shell
64+
make -C docs html
65+
```

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
A command-line interface for [PyScript](https://pyscript.net).
44

55

6-
[![Version](https://img.shields.io/pypi/v/pyscript-cli.svg)](https://pypi.org/project/pyscript-cli/)
6+
[![Version](https://img.shields.io/pypi/v/pyscript.svg)](https://pypi.org/project/pyscript/)
77
[![Test](https://github.com/pyscript/pyscript-cli/actions/workflows/test.yml/badge.svg)](https://github.com/pyscript/pyscript-cli/actions/workflows/test.yml)
88
[![codecov](https://codecov.io/gh/pyscript/pyscript-cli/branch/main/graph/badge.svg?token=dCxt9oBQPL)](https://codecov.io/gh/pyscript/pyscript-cli)
99
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pyscript/pyscript-cli/main.svg)](https://results.pre-commit.ci/latest/github/pyscript/pyscript-cli/main)
@@ -16,7 +16,7 @@ Quickly wrap Python scripts into a HTML template, pre-configured with [PyScript]
1616
## Installation
1717

1818
```shell
19-
$ pip install pyscript-cli
19+
$ pip install pyscript
2020
```
2121

2222
## Usage

docs/Makefile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Internal variables.
12+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(SPHINXOPTS) source
13+
14+
# Put it first so that "make" without argument is like "make help".
15+
help:
16+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
17+
18+
.PHONY: help Makefile
19+
20+
.PHONY: api-docs
21+
api-docs:
22+
sphinx-apidoc -f -o source/api ../src/pyscript -H "API Docs"
23+
24+
.PHONY: html
25+
html: api-docs
26+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
27+
@echo
28+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
29+
30+
.PHONY: live
31+
live: api-docs
32+
sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) --watch ../src --open-browser
33+
34+
# Catch-all target: route all unknown targets to Sphinx using the new
35+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
36+
%: Makefile
37+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Install the documentation dependencies
2+
# This is required because readthedocs needs requirements.txt
3+
..[docs]

docs/source/_static/avatar.jpeg

10.6 KB
Loading

docs/source/conf.py

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
"""Documentation configuration for `pyscript-cli`."""
2+
from __future__ import annotations
3+
4+
import sys
5+
from datetime import datetime
6+
from pathlib import Path
7+
8+
import toml
9+
10+
# Ensure the package is in the path
11+
project_root = Path(__file__).parents[2]
12+
sys.path.insert(0, (project_root / "src").as_posix())
13+
14+
# General information about the project.
15+
project = "pyscript-cli"
16+
author = "Anaconda"
17+
copyright = f"2022 - {datetime.now().year}, {author}"
18+
19+
# Load the package version from pyproject.toml
20+
with (project_root / "pyproject.toml").open("r") as fp:
21+
version = toml.load(fp)["tool"]["poetry"]["version"]
22+
release = version
23+
24+
25+
# Add any Sphinx extension module names here, as strings. They can be
26+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
27+
# ones.
28+
extensions = [
29+
"myst_parser",
30+
"sphinx.ext.doctest",
31+
"sphinx.ext.intersphinx",
32+
"sphinx.ext.coverage",
33+
"sphinx.ext.mathjax",
34+
"sphinx.ext.autodoc",
35+
"sphinx.ext.napoleon",
36+
"sphinx.ext.viewcode",
37+
"sphinx_autodoc_typehints",
38+
]
39+
40+
# Add any paths that contain templates here, relative to this directory.
41+
templates_path = ["_templates"]
42+
exclude_patterns: list[str] = []
43+
44+
# The suffix(es) of source filenames.
45+
source_suffix = [".rst", ".md"]
46+
47+
# The master toctree document.
48+
master_doc = "index"
49+
50+
# The name of the Pygments (syntax highlighting) style to use.
51+
pygments_style = "sphinx"
52+
53+
autodoc_default_options = {
54+
"members": None,
55+
"undoc-members": None,
56+
"show-inheritance": None,
57+
}
58+
59+
# The theme to use for HTML and HTML Help pages.
60+
html_theme = "pydata_sphinx_theme"
61+
# html_logo = "_static/avatar.jpeg"
62+
html_favicon = "_static/avatar.jpeg"
63+
html_theme_options = {
64+
"github_url": "https://github.com/pyscript/pyscript-cli",
65+
"icon_links": [
66+
{
67+
"name": "PyPI",
68+
"url": "https://pypi.org/project/pyscript-cli",
69+
"icon": "fas fa-box",
70+
},
71+
],
72+
}
73+
html_static_path = ["_static"]

0 commit comments

Comments
 (0)