Skip to content

Commit d4e9ce3

Browse files
committed
Merge branch 'master' into pr-150
2 parents edde6a4 + 1e8295d commit d4e9ce3

26 files changed

+353
-208
lines changed

.circleci/config.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- cache-pip
1818
# Install the packages needed to build our documentation
1919
# This will depend on your particular package!
20-
- run:
20+
- run:
2121
name: Set up environment
2222
command: |
2323
# Install conda
@@ -41,8 +41,8 @@ jobs:
4141
name: Build docs to store
4242
command: |
4343
export PATH="$HOME/miniconda/bin:$PATH"
44-
cd docs
45-
make html
44+
sphinx-build -b html docs/ docs/_build/html -W --keep-going
45+
4646
# Tell Circle to store the documentation output in a folder that we can access later
4747
- store_artifacts:
4848
path: docs/_build/html/
File renamed without changes.

.github/workflows/tests.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: continuous-integration
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
7+
lint:
8+
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: [3.8]
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
22+
- name: Set up Node/yarn
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: '10.x'
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
python -m pip install --upgrade pre-commit
31+
pip install -e .
32+
yarn install
33+
34+
- name: Lint
35+
run: |
36+
pre-commit run --all-files
37+
38+
39+
# Build docs on a number of Python versions. In the future this can be
40+
# where tests go.
41+
tests:
42+
43+
runs-on: ubuntu-latest
44+
strategy:
45+
matrix:
46+
python-version: [3.6, 3.7, 3.8]
47+
48+
steps:
49+
- uses: actions/checkout@v2
50+
- name: Set up Python ${{ matrix.python-version }}
51+
uses: actions/setup-python@v1
52+
with:
53+
python-version: ${{ matrix.python-version }}
54+
- name: Install dependencies
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install -e .
58+
pip install -r docs/requirements.txt
59+
60+
# Build the docs
61+
- name: Build docs to store
62+
run: |
63+
export PATH="$HOME/miniconda/bin:$PATH"
64+
sphinx-build -b html docs/ docs/_build/html -W --keep-going

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,5 @@ ENV/
101101
# mypy
102102
.mypy_cache/
103103

104-
node_modules/
104+
node_modules/
105+
.vscode

.pre-commit-config.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@ repos:
66
language: system
77
entry: bash -c "yarn build:production"
88
files: ^src/*
9+
- repo: https://github.com/psf/black
10+
rev: stable
11+
hooks:
12+
- id: black
13+
language_version: python3.6
14+
- repo: https://gitlab.com/pycqa/flake8
15+
rev: 3.7.9
16+
hooks:
17+
- id: flake8

.vscode/settings.json

-4
This file was deleted.

README.md

+13-77
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,18 @@ Sites that are using this theme:
1515
- JupyterHub and Binder: https://docs.mybinder.org/, http://z2jh.jupyter.org/en/latest/, https://repo2docker.readthedocs.io/en/latest/, https://jupyterhub-team-compass.readthedocs.io/en/latest/
1616
- Jupyter Book beta version uses an extension of this theme: https://beta.jupyterbook.org
1717

18-
This repo holds a temporary (slimmed down) copy of the pandas documentation to
19-
test the theme with on PRs. The result is hosted at the demo site.
2018

2119
## Installation and usage
2220

23-
This theme is not yet released as a package on PyPI, but you can already install
21+
The theme is available on PyPI and conda-forge. You can install
2422
and use as follows:
2523

26-
- Install the `pydata-sphinx-theme` in your doc build environment from the git
27-
repo. You can do this manually with pip:
24+
- Install the `pydata-sphinx-theme` in your doc build environment:
2825

2926
```
30-
pip install git+https://github.com/pandas-dev/pydata-sphinx-theme.git@master
31-
```
32-
33-
or in a conda environment yml file, you can add:
34-
35-
```
36-
- pip:
37-
- git+https://github.com/pandas-dev/pydata-sphinx-theme.git@master
27+
pip install pydata-sphinx-theme
28+
# or
29+
conda install pydata-sphinx-theme --channel conda-forge
3830
```
3931

4032
- Then, in the `conf.py` of your sphinx docs, you update the `html_theme`
@@ -53,69 +45,11 @@ are very welcome!
5345

5446
## Theme development
5547

56-
The theme is bundled via Webpack. In `./src/*` the theme related stylesheets and javascript is located. 2 entrypoints are available:
57-
58-
- Stylesheet: `./src/scss/index.scss'
59-
- Javascript: `./src/js/index.js`
60-
61-
Both entrypoints will be bundled into `./pydata_sphinx_theme/static/{css,js}`.
62-
63-
Theme development was inspired by the [ReadTheDocs sphinx theme](https://github.com/readthedocs/sphinx_rtd_theme).
64-
65-
### Steps to develop the theme:
66-
67-
1. Install yarn
68-
2. Install theme dependencies
69-
3. Run development server
70-
4. Build production assets
71-
72-
**Important:** in orde to commit changes to the theme, ensure you run `yarn build:production` so all assets will be bundled into `./pydata_sphinx_theme/static/`.
73-
74-
#### Install yarn
75-
76-
[Yarn](https://yarnpkg.com) is a package manager we use for managing Javascript and CSS dependencies.
77-
78-
Install via conda:
48+
Contributions are very welcome! Installing the development version, building
49+
the demo docs and developing the css/js of the theme, etc, is explained in
50+
more detail in the contributing section of the documentation:
51+
https://pydata-sphinx-theme.readthedocs.io/en/latest/contributing.html
7952

80-
```bash
81-
conda install yarn
82-
```
83-
84-
Install alternative: https://classic.yarnpkg.com/en/docs/install.
85-
86-
#### Install theme dependencies
87-
88-
Install theme related dependencies:
89-
90-
```bash
91-
yarn install
92-
```
93-
94-
#### Run development server
95-
96-
```bash
97-
yarn build:dev
98-
```
99-
100-
A development server is available at http://localhost:1919. When working
101-
on the theme, like editing stylesheets, javascript, .rst or .py files
102-
every save reloads the development server. This reload includes bundling
103-
stylesheets, javascript, and running sphinx again.
104-
105-
The following files will be watched and reloaded on change:
106-
107-
- ./src/js/index.js
108-
- ./src/scss/index.scss
109-
- ./docs/\*\*/\*.rst
110-
- ./docs/\*\*/\*.py
111-
112-
#### Build production assets
113-
114-
To build the new theme assets into the theme, run the following command.
115-
116-
```bash
117-
yarn build:production
118-
```
11953

12054
## How is this theme working?
12155

@@ -152,13 +86,13 @@ To this end, this package includes:
15286
subclassing sphinx' translator, but overriding certain elements to generate
15387
Bootstrap-compatible html. Currently, this includes: converting admonitions to
15488
Bootstrap "alert" classes, and updating the classes used for html tables.
155-
- A [sphinx "monkeypatch"](./pydata_sphinx_theme/__init__.py) to add toctree
89+
- A [sphinx event](./pydata_sphinx_theme/__init__.py) to add navigation
15690
objects into the html context which is available in the html (jinja2)
15791
templates. This allows to put the structure of the navigation elements in the
15892
actual layout, instead of having to rely on the hard-coded formatting of
15993
sphinx (this is inspired on the navigation objects of mkdocs:
16094
https://www.mkdocs.org/user-guide/custom-themes/#nav). We would love to see
161-
this added to sphinx itself (instead of needing to monkeypatch), but for not
95+
this added to sphinx itself (instead of needing a sphinx event), but for now
16296
did not yet get any reaction from the sphinx developers.
16397

16498
Those items also avoid writing javascript functions to "fix up" the html
@@ -173,3 +107,5 @@ Currently, the main difference is that this theme is using Bootstrap 4 instead
173107
of 3 and provides a different default layout. At some point, it would be good to
174108
contribute changes to that package (or at least the parts that deal with
175109
Bootstrap and sphinx that could be shared).
110+
111+
The initial layout and css were inspired on the Bootstrap documentation site.

_variables.scss

Whitespace-only changes.

docs/conf.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
# -- Project information -----------------------------------------------------
1919

20-
project = 'PyData Sphinx Theme'
21-
copyright = '2019, PyData Community'
22-
author = 'PyData Community'
20+
project = "PyData Sphinx Theme"
21+
copyright = "2019, PyData Community"
22+
author = "PyData Community"
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = '0.0.1dev0'
25+
release = "0.0.1dev0"
2626

2727

2828
# -- General configuration ---------------------------------------------------
@@ -42,33 +42,33 @@
4242
autosummary_generate = True
4343

4444
# Add any paths that contain templates here, relative to this directory.
45-
templates_path = ['_templates']
45+
templates_path = ["_templates"]
4646

4747
# List of patterns, relative to source directory, that match files and
4848
# directories to ignore when looking for source files.
4949
# This pattern also affects html_static_path and html_extra_path.
50-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
50+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
5151

5252

5353
# -- Options for HTML output -------------------------------------------------
5454

5555
# The theme to use for HTML and HTML Help pages. See the documentation for
5656
# a list of builtin themes.
5757
#
58-
html_theme = 'pydata_sphinx_theme'
59-
html_logo = '_static/pandas.svg'
58+
html_theme = "pydata_sphinx_theme"
59+
html_logo = "_static/pandas.svg"
6060

6161
html_theme_options = {
6262
"external_links": [
63-
{
64-
'url': "https://pandas.pydata.org/pandas-docs/stable/",
65-
"name": "Pandas Docs"
66-
}
63+
{"url": "https://pandas.pydata.org/pandas-docs/stable/", "name": "Pandas Docs"}
6764
],
6865
"github_url": "https://github.com/pandas-dev/pydata-sphinx-theme",
6966
"twitter_url": "https://twitter.com/pandas_dev",
7067
"use_edit_page_button": True,
68+
<<<<<<< HEAD
7169
# "require_js": False # Just for testing
70+
=======
71+
>>>>>>> master
7272
}
7373

7474
html_context = {
@@ -84,12 +84,13 @@
8484
# Add any paths that contain custom static files (such as style sheets) here,
8585
# relative to this directory. They are copied after the builtin static files,
8686
# so a file named "default.css" will overwrite the builtin "default.css".
87-
html_static_path = ['_static']
87+
html_static_path = ["_static"]
8888

8989

9090
# -- Auto-convert markdown pages to demo --------------------------------------
9191
import recommonmark
9292
from recommonmark.transform import AutoStructify
9393

94+
9495
def setup(app):
9596
app.add_transform(AutoStructify)

0 commit comments

Comments
 (0)