Skip to content

Commit 0c42fad

Browse files
authored
Merge pull request #6 from aaliddell/dev
1.5.0 Release
2 parents aafd5d6 + 329e0e7 commit 0c42fad

34 files changed

+1085
-1277
lines changed

.flake8

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
[flake8]
22
max-line-length = 100
3-
ignore = E261,E501,E731,W503
3+
ignore =
4+
# Ignore line break before binary operator
5+
W503,
6+
per-file-ignores =
7+
__init__.py:
8+
# Ignore unused imports in __init__.py files
9+
F401,
10+
# Ignore 'from module import *' in __init__.py files
11+
F403,
12+
test_*.py:
13+
# Ignore line too long in tests
14+
E501,
15+
# Ignore pydocstyle in tests
16+
D100,D101,D102,D103
17+
conftest.py:
18+
# Ignore line too long in tests setup
19+
E501,
420
exclude = .ipynb_checkpoints

.github/workflows/ci.yml

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
os: [macos-latest, ubuntu-latest, windows-latest]
18-
python-version: [3.6, 3.7, 3.8, 3.9]
18+
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
1919

2020
steps:
2121
- uses: actions/checkout@v2
@@ -45,38 +45,3 @@ jobs:
4545
run: nox -s pylint
4646
- name: Run pydocstyle
4747
run: nox -s pydocstyle
48-
49-
docs:
50-
name: Build and push docs
51-
runs-on: ubuntu-latest
52-
if: github.ref == 'refs/heads/main'
53-
steps:
54-
- uses: actions/checkout@v2
55-
with:
56-
fetch-depth: 0 # To fetch all refs
57-
- name: Set up Python
58-
uses: actions/setup-python@v1
59-
with:
60-
python-version: 3.8
61-
- name: Install nox
62-
run: pip install nox
63-
- name: Build docs
64-
run: nox -s docs -- -d /tmp/sphinx-doctrees
65-
- name: Copy built docs and checkout
66-
run: |
67-
rm -rf __pycache__ **/__pycache__ .doctrees **/.doctrees .buildinfo **/.buildinfo
68-
cp -r docs/build /tmp/sphinx-build
69-
git clean -fx
70-
git checkout gh-pages
71-
git rm -r . # Clean branch to ensure removed files don't persist
72-
- name: Commit and push docs
73-
env:
74-
GIT_WORK_TREE: /tmp/sphinx-build
75-
run: |
76-
git status
77-
git add .
78-
git status
79-
git config --global user.name "${GITHUB_ACTOR}"
80-
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
81-
git commit --allow-empty --message "Update docs to ${GITHUB_SHA} from ${GITHUB_REF}"
82-
git push

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ dmypy.json
8585
/docs/build
8686

8787
# Autogenerated API docs
88-
/docs/source/api
88+
/docs/api

.readthedocs.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
sphinx:
3+
configuration: docs/conf.py
4+
python:
5+
version: 3.7
6+
install:
7+
- method: pip
8+
path: .
9+
extra_requirements:
10+
- dev

README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ library.
1717
:alt: CI Status
1818
:target: https://github.com/aaliddell/s2cell/actions
1919

20+
.. image:: https://readthedocs.org/projects/s2cell/badge/?version=latest
21+
:alt: Documentation Status
22+
:target: https://docs.s2cell.aliddell.com/en/latest
23+
2024
.. image:: https://img.shields.io/github/license/aaliddell/s2cell
2125
:alt: License
2226
:target: https://github.com/aaliddell/s2cell

docs/source/annotated_source.rst renamed to docs/annotated_source.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ system that are useful for understanding the steps to convert from one represent
1313
The full source of the library is included below.
1414

1515

16-
.. literalinclude:: ../../s2cell/__init__.py
16+
.. literalinclude:: ../s2cell/s2cell.py
1717
:language: python3
18-
:lines: 25-
18+
:lines: 22-

docs/source/changelog.rst renamed to docs/changelog.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
Changelog
66
=========
77

8+
1.5.0
9+
-----
10+
11+
- Moved main source out of ``__init__.py``
12+
- Moved docs hosting to Read the Docs
13+
- Updated docs to improve readability
14+
15+
816
1.4.0
917
-----
1018

docs/conf.py

Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import datetime
2+
import os
23

34
# -- Project information -----------------------------------------------------
45

@@ -20,80 +21,109 @@
2021
extensions = [
2122
# Internal
2223
'sphinx.ext.autodoc',
23-
'sphinx.ext.githubpages',
2424
'sphinx.ext.napoleon',
2525

2626
# External
27+
'notfound.extension',
2728
'sphinx_sitemap',
2829
]
2930

3031
# Add any paths that contain templates here, relative to this directory.
31-
templates_path = []
32+
templates_path = ['templates']
3233

3334
# List of patterns, relative to source directory, that match files and
3435
# directories to ignore when looking for source files.
3536
# This pattern also affects html_static_path and html_extra_path.
36-
exclude_patterns = ['.ipynb_checkpoints', '**/.ipynb_checkpoints']
37+
exclude_patterns = ['.ipynb_checkpoints', '**/.ipynb_checkpoints', 'api/s2cell.rst']
3738

3839
# Code highlighting
3940
pygments_style = 'monokai'
4041

4142
# Enable figure numbering
4243
numfig = True
4344

45+
# Setup root doc
46+
root_doc = 'index'
47+
48+
49+
# -- Run sphinx-apidoc -------------------------------------------------------
50+
51+
def run_apidoc(_):
52+
import sphinx.ext.apidoc
53+
54+
docs_path = os.path.dirname(__file__)
55+
apidoc_path = os.path.join(docs_path, 'api')
56+
module_path = os.path.join(docs_path, '..', 's2cell')
57+
58+
sphinx.ext.apidoc.main([
59+
'--no-toc',
60+
'--force',
61+
'--separate',
62+
'-o', apidoc_path,
63+
module_path
64+
])
65+
66+
67+
def setup(app):
68+
app.connect('builder-inited', run_apidoc)
69+
4470

4571
# -- Options for HTML output -------------------------------------------------
4672

4773
# The theme to use for HTML and HTML Help pages. See the documentation for
4874
# a list of builtin themes.
4975
#
50-
import sphinx_redactor_theme
51-
html_theme = 'sphinx_redactor_theme'
52-
html_theme_path = [sphinx_redactor_theme.get_html_theme_path()]
76+
html_theme = 'furo'
77+
78+
# Title
79+
html_title = 's2cell'
5380

5481
# Logo and favicon
55-
html_logo = 'source/_static/logo.min.svg'
56-
html_favicon = 'source/_static/logo-64.png'
82+
html_logo = 'static/logo.min.svg'
83+
html_favicon = 'static/logo-64.png'
5784

5885
# Base URL for docs
59-
# Used to generate CNAME file
6086
html_baseurl = 'https://docs.s2cell.aliddell.com'
6187

6288
# Extra vars to provide to templating
6389
html_context = {
6490
'baseurl': html_baseurl,
65-
'icon_png': 'logo.png'
91+
'icon_png': 'logo.png',
92+
'absolute_icon_png': html_baseurl + '/en/latest/_static/logo.png' # Used by meta tags
6693
}
6794

6895
# Add any paths that contain custom static files (such as style sheets) here,
6996
# relative to this directory. They are copied after the builtin static files,
7097
# so a file named "default.css" will overwrite the builtin "default.css".
71-
html_static_path = ['source/_static']
98+
html_static_path = ['static']
7299

73100
# Theme options
74101
html_theme_options = {
75-
'display_version': True,
102+
'sidebar_hide_name': True,
103+
'light_css_variables': {
104+
'color-brand-primary': '#de6b00',
105+
'color-brand-content': '#de6b00',
106+
},
107+
'dark_css_variables': {
108+
'color-brand-primary': '#de6b00',
109+
'color-brand-content': '#de6b00',
110+
},
76111
}
77112

78113
# Disable footer
79114
html_show_sphinx = False
80115

81-
# Template overrides
82-
templates_path = ['_templates']
83-
84116
# Add CSS files
85-
html_css_files = [
86-
'pygments.css', # Manually add pygments.css, since sphinx_redactor_theme does not
87-
'customise.css',
88-
]
117+
html_css_files = []
89118

90119
# Extra files to include
91120
html_extra_path = [
92-
'source/robots.txt',
121+
'robots.txt',
93122
]
94123

95124
# Sitemap options
96-
sitemap_url_scheme = '{lang}{link}'
125+
sitemap_filename = "sitemap-override.xml" # RTD generates sitemap with not much in it...
126+
sitemap_url_scheme = "{link}"
97127

98128
# -- Options for autodoc -----------------------------------------------------
99129

docs/source/index.rst renamed to docs/index.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
:description: Minimal Python S2 cell ID, S2 token and lat/lon conversion library
33
:keywords: S2, S2 Geometry, s2cell, S2 cell, cell ID, S2 token, token, Python
44

5-
.. include:: ../../README.rst
5+
.. include:: ../README.rst
66

77

88
.. toctree::
99
:hidden:
1010

1111
Overview <self>
12-
s2_concepts
13-
API Reference <api/s2cell>
14-
useful_s2_links
12+
Concepts <s2_concepts>
13+
API Reference <api/s2cell.s2cell>
14+
Useful Links <useful_s2_links>
1515
annotated_source
1616
changelog
File renamed without changes.

0 commit comments

Comments
 (0)