Skip to content

Commit

Permalink
MAINT: pre-commit fix and master->main (#249)
Browse files Browse the repository at this point in the history
* pre-commit fix and master->main

* remove old installs

* update tox testing

* update pytest pins

* set python=310 due to npm

* fix tests and update tox

* update python and os x

* sphinx-5 for now

* remove os x testing
  • Loading branch information
mmcky authored Sep 9, 2024
1 parent a521b04 commit 2bed94d
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 72 deletions.
22 changes: 2 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,14 @@ jobs:
auto-update-conda: true
auto-activate-base: true
miniconda-version: 'latest'
python-version: "3.10"
python-version: "3.11"
environment-file: lecture-python-programming.myst/environment.yml
activate-environment: lecture-python-programming
- name: Install quantecon-book-theme
shell: bash -l {0}
run: |
pip uninstall -y quantecon-book-theme
python -m pip install .
- name: Install sphinx-multitoc-numbering
shell: bash -l {0}
run: |
git clone https://github.com/executablebooks/sphinx-multitoc-numbering.git
cd sphinx-multitoc-numbering
python setup.py install
cd ../ && rm -rf sphinx-multitoc-numbering
- name: Install sphinx-exercise
shell: bash -l {0}
run: |
git clone https://github.com/executablebooks/sphinx-exercise.git
cd sphinx-exercise
python setup.py install
cd ../ && rm -rf sphinx-exercise
- name: Install Dependencies
shell: bash -l {0}
run: |
pip install jupyter-book
- name: Display Conda Environment Versions
shell: bash -l {0}
run: conda list
Expand All @@ -57,7 +39,7 @@ jobs:
uses: nwtgck/[email protected]
with:
publish-dir: 'lecture-python-programming.myst/_build/html/'
production-branch: master
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Preview Deploy from GitHub Actions"
env:
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: continuous-integration

on:
push:
branches: [master]
branches: [main]
tags:
- 'v*'
pull_request:
Expand All @@ -14,22 +14,19 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: "3.11"
- uses: pre-commit/[email protected]

tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.11"]
# Only test the latest major release of Sphinx because otherwise we need to
# keep multiple versions of regression tests on file and this creates lots of
# noise in the tests.
sphinx: ["~=5.0"]
include:
- os: macos-latest
python-version: 3.x
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -51,7 +48,7 @@ jobs:
pytest --durations=10 --cov=quantecon_book_theme --cov-report=xml --cov-report=term-missing
- name: Upload to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9 && github.repository == 'QuantEcon/quantecon-book-theme' && github.event_name == 'pull_request'
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 && github.repository == 'QuantEcon/quantecon-book-theme' && github.event_name == 'pull_request'
uses: codecov/[email protected]
with:
name: ebp-qbt-pytests-py3.7
Expand All @@ -70,7 +67,7 @@ jobs:
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
- name: Build package
run: |
python -m pip install -U pip build
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ doc = [
test = [
"myst_nb",
"coverage",
"pytest~=7.1",
"pytest",
"pytest-cov",
"beautifulsoup4",
"sphinx_thebe",
"pytest-regressions~=2.0.1",
"pytest-regressions",
"sphinx_copybutton",
"sphinx_togglebutton",
]
Expand Down
4 changes: 2 additions & 2 deletions src/quantecon_book_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ def get_github_src_folder(app):
if repo_url:
branch = config_theme.get("repository_branch")
if not branch:
# Explicitly check in cae branch is ""
branch = "master"
# Explicitly check in case branch is ""
branch = "main"
relpath = config_theme.get("path_to_docs", "")
org, repo = repo_url.strip("/").split("/")[-2:]
context.update(
Expand Down
6 changes: 3 additions & 3 deletions src/quantecon_book_theme/assets/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1193,13 +1193,13 @@ tt {
}
}

div.admonition, .admonition {
div.admonition,
.admonition {
font-size: 0.9rem;
margin: 1.5rem auto;
padding: 0 1rem 0.5rem 1rem;
page-break-inside: avoid;
box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.1),
0 0 0.05rem rgba(0, 0, 0, 0.1);
box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.1), 0 0 0.05rem rgba(0, 0, 0, 0.1);
> .admonition-title {
position: relative;
margin: 0 -1rem;
Expand Down
2 changes: 1 addition & 1 deletion src/quantecon_book_theme/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,5 @@ def _is_notebook(app, pagename):
def _get_branch(config_theme):
branch = config_theme.get("nb_branch")
if not branch:
branch = "master"
branch = "main"
return branch
2 changes: 1 addition & 1 deletion tests/sites/base/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"repository_url": "https://github.com/executablebooks/sphinx-book-theme",
"nb_repository_url": "https://github.com/executablebooks/sphinx-book-theme",
"navigation_with_keys": True,
# "repository_branch": "master", # Not using this, should default to master
# "repository_branch": "main", # Not using this, should default to main
"launch_buttons": {
"binderhub_url": "https://mybinder.org",
"jupyterhub_url": "https://datahub.berkeley.edu",
Expand Down
67 changes: 35 additions & 32 deletions tests/test_build/test_build_book.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,41 @@
<a class="reference internal" href="section1/index.html">
3. Section 1 index
</a>
<input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/>
<label class="toctree-toggle" for="toctree-checkbox-1">
<i class="fa-solid fa-chevron-down">
</i>
</label>
<ul>
<li class="toctree-l2">
<a class="reference internal" href="section1/page1.html">
3.1. Section 1 page1
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="section1/ntbk.html">
3.2. A test notebook
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="section1/ntbkmd.html">
3.3. Section 1 page1
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="section1/ntbk_octave.html">
3.4. Octave
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="section1/ntbk_julia.html">
3.5. Julia
</a>
</li>
</ul>
<details>
<summary>
<span class="toctree-toggle" role="presentation">
<i class="fa-solid fa-chevron-down">
</i>
</span>
</summary>
<ul>
<li class="toctree-l2">
<a class="reference internal" href="section1/page1.html">
3.1. Section 1 page1
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="section1/ntbk.html">
3.2. A test notebook
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="section1/ntbkmd.html">
3.3. Section 1 page1
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="section1/ntbk_octave.html">
3.4. Octave
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="section1/ntbk_julia.html">
3.5. Julia
</a>
</li>
</ul>
</details>
</li>
<li class="toctree-l1">
<a class="reference external" href="https://google.com">
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
# then then deleting compiled files has been found to fix it: `find . -name \*.pyc -delete`

[tox]
envlist = py39-sphinx5
envlist = py311-sphinx5

[testenv]
usedevelop=true
passenv = TERM # To make terminal coloring / other variables pass through

[testenv:py{37,38,39}-pre-commit]
[testenv:py{311}-pre-commit]
extras = code_style
commands = pre-commit run {posargs}

Expand All @@ -43,7 +43,7 @@ deps =
commands =
stb serve docs --open-browser

[testenv:py{37,38,39}-sphinx{5,6}]
[testenv:py{311}-sphinx{5,6}]
extras = test
deps =
sphinx5: sphinx>=5,<6
Expand Down

1 comment on commit 2bed94d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.