-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Faster cleanup of output folder (PEP-0471) #3356
base: main
Are you sure you want to change the base?
Conversation
Use os.scandir() instead of os.listdir() In accordance with PEP-0471, os.listdir has been marked for discontinued sometime in the future. https://peps.python.org/pep-0471/
Thanks for this improvement proposal, it seems ok for me.
It would be also great to see performance differences, before and after the patch. |
I agree it would be nice to quantify in this PR's description how much time this change saves. There is no need to manually modify the change-log, which is automatically appended by AutoPub. Normally I would request that a |
Do we have to worry about performance very much? What are the long-running operations, and how long do they take? Everything I've ever done is just a couple of seconds. Personally, I'd focus on user friendliness, robust code, less code, and look for reasons people are using static site generators other than this one. |
To be clear, I don't object to this PR. I'm just proposing high-level focus. |
Yeah, I'm currently expanding the pytest unittest for settings.py. Lots of corner cases missed, notably with tilda ( Maybe after |
I don't understand, but increased test coverage sounds good. Perhaps you already know, you can run
I also don't understand, but feel free to propose. |
Python Test file https://gist.github.com/egberts/f9f9f1f3156bc17a1c8718b3dfd068d3 |
@boxydog, here's the details. Relative Outside Subdirectory does not existWhere the $ python -m pelican -D -s /tmp/pelicanconf.py
CRITICAL Exception: `PATH` object in /tmp/pelicanconf.py is undefined. You need __init__.py:696
to specify a path containing the content (see pelican --help for more
information) An ERROR should have said: Undefined
|
Gotcha. Sounds like you've thought this through. Consider filing the above as an issue if you haven't already. |
Strictly speaking it's probably five issues, but I wouldn't want to discourage you with formality if you're fired up. |
I know. Five issues or roll out as one.... Your call. I'm just tightening up the test_setting.py and plan to release it in my repo but not deliver into Pelican's repo, until settings.py are nice and user-friendly. But you did give me pause about the merits of 5 separate issues. For now, trying for a single issue with #3357 |
A note to myself: add the full absolute resolved path of Pelican configuration settings file to each error/warning instance of variable setting, along with the variable name and the offending value. And setup a Pelican test area on a Windows platform for thoroughness. |
3 of 5 errors resolved by PR #3368 Wrote another issue #3369 for the remaining two with regard to the Python variable name Relative Outside Subdirectory does not existWhere the $ python -m pelican -D -s /tmp/pelicanconf.py
CRITICAL Exception: `PATH` object in /tmp/pelicanconf.py is undefined. You need __init__.py:696
to specify a path containing the content (see pelican --help for more
information) An ERROR should have said: Undefined
|
I notice your work here stalled. Is there a smaller piece you can pull out, finish, and contribute? Best wishes. |
Yes! it got stalled because pytest wasn't giving me consistent pass result with each test run so down the rabbit hole I went into pytest dev community. |
Use os.scandir() instead of os.listdir()
In accordance with PEP-0471, os.listdir has been marked for discontinued sometime in the future.
https://peps.python.org/pep-0471/
Pull Request Checklist
Resolves: #issue-number-here