-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: spring cleaning #1271
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I likely don't have bandwidth to give this an extremely detailed review, but I am a big +1 on the general approach, esp splitting __init__.py
into modules, and I think if the docs look the same and the tests still pass, I'm +1 on merging unless somebody finds something obviously wrong. We can always iterate and these refactors will help us maintain and keep track of stuff much better, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall +1 on this. I did a quick look and left a few comments. Please though let's wait for #1264 to merge first
src/pydata_sphinx_theme/__init__.py
Outdated
from .edit_this_page import setup_edit_url | ||
from .logo import copy_logo_images, setup_logo_path | ||
from .pygment import overwrite_pygments_css | ||
from .short_link import ShortenLinkTransform | ||
from .toctree import add_toctree_functions | ||
from .translator import setup_translators | ||
from .utils import config_provided_by_user, get_theme_options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about putting these in a directory with an __init__
? So this would become, e.g.,
from ._helpers import setup_edit_url, copy_logo_images, setup_logo_path, etc
IDK what the best name is (probably doesn't matter much). Ideas: _tools
, _pst
, _helpers
, _init_helpers
, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of creating a extra folder to store them but I see you point of reducing the number of import lines. Let me try something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think of the modifications made in 71f73c2 ? It avoids the extra folder and greatly simplify the imort statements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good enough for me. Personally I prefer having in a folder (when I ls
a directory shorter lists are easier for me to scan quickly) but it's a matter of taste so I won't push the issue.
I don't see it in the diff of #1258, and I don't think we changed the bootstrap version in that PR 🤷🏻 In any event it's possible that we're supposed to include the license if we redistribute the source; can you peek at the license and see if that's required? |
I cheked the bootstrap file and now the `bootstrap.js file starts with /*! For license information please see bootstrap.js.LICENSE.txt */ So I assumed it should be generted and added it to the ignored files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good @12rambau. I'll go ahead and commit the spelling / docstring fixes I suggested; then there's one question I'll let you decide whether to do it now or leave it alone. Feel free to merge once you make that call.
def traverse_or_findall(node: Node, condition: str, **kwargs) -> Iterator[Node]: | ||
"""Triage node.traverse (docutils <0.18.1) vs node.findall. | ||
|
||
TODO: This check can be removed when the minimum supported docutils version | ||
for numpydoc is docutils>=0.18.1. | ||
""" | ||
return ( | ||
node.findall(condition, **kwargs) | ||
if hasattr(node, "findall") | ||
else node.traverse(condition, **kwargs) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this would make more sense in .utils
(or perhaps .fixes
or .shims
?) But since I think it's only used this one place (right?) I guess let's leave it alone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@12rambau this is the one I want your second opinion about, whether it's worth it to move it to .utils
(or some other file) now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's true it could be reused, let me move it to .utils
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oof, this file is a beast :) just commenting to say I didn't really read this file / I'm trusting that it's a copy/paste from __init__
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no worries, it's a copy/paste. Edit anything there without caution and you'll break the sidebars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look at the PR diff and it looks good to me - I also looked through the example docs and it looks good as well. So I'm +1 on merging this and cutting out a patch release!
Fix #1270, Fix #1216
As mentioned in the title this PR is not about functional changes to pydata-sphinx-theme but only some clean up of our files. Let me do a list of the modifications:
flake8
in favor ofruff
. As We are testing everything I had to add a lot of docstring in packages and modules and change the format of some to respect Google style. Nothing else was required to make it work. It's integrated to our pre-commits.prettier
_extention
folder as it's not a script that should be launched. Updated the conf.py file accordingly.nox
without any other arguments to run all the sessionslint
session to apply pre-commitscompile
session was not doing anything anymore, I set back the compilation commandconftest.py
filesetup_translators
application function to the translator.pyutils.py
file with the common config parameters helperstoctree.py
file.__init__.py
the update_config with all the deprecation notices and the layout creation