-
Notifications
You must be signed in to change notification settings - Fork 33
Fix tests, run tests in CI #64
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
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
493d65b
tests: fix version calculation
woodruffw ee78d1d
workflows: ci
woodruffw 125ec38
travis: remove old travis CI config
woodruffw 3187ec7
tests: disable some broken tests
woodruffw e85109d
[WIP] experiment with CI
woodruffw e6430b0
[WIP] listgen: fix path
woodruffw 235c31e
[WIP] more experimenting
woodruffw 3aaac6d
[WIP] listgen: syntax
woodruffw 63770a8
[WIP] listgen: disable 2.7 temporarily
woodruffw a429b80
[WIP] disable 3.2
woodruffw 892e30e
[WIP]: 3.6+ only
woodruffw 635b079
[WIP] listgen: tweak runner
woodruffw 07e95a5
[WIP]: 3.7 and newer only
woodruffw 7eabc10
[WIP] handle accelerator mods
woodruffw 4b6a4ea
[WIP] do recursive step correctly
woodruffw 206519a
[WIP] dedupe correctly
woodruffw 84598f9
[WIP]: use pkgutil
woodruffw 747b2fc
[WIP] hackety hack
woodruffw 300689c
[WIP] hackety hack
woodruffw b421654
[WIP] builtin_module_names
woodruffw 8ae1b6c
[WIP] newer python support
woodruffw c69a61e
[WIP] fix path
woodruffw eb82534
listgen: auto-PRs for 3.10+
woodruffw bd49ee1
listgen: fix base branch
woodruffw ab25cc8
walk-modules: be slightly smarter
woodruffw d80f0fc
Merge remote-tracking branch 'origin/main' into ww/fix-tests
woodruffw 37f9ffb
listgen: temporarily disable PR creation
woodruffw 04df9c7
rewrite tests
woodruffw fd48323
Makefile: enforce 100% coverage
woodruffw 572af87
README: mention the new `sys` APIs
woodruffw b663cbf
listgen: run for old Pythons, drop pull_request trigger
woodruffw 01402ca
ci: enable caching
woodruffw 795886d
ci: test on 3.10 and 3.11
woodruffw 8875a7b
base: update docstrings
woodruffw 185e894
test_base: add another consistency test
woodruffw 92e5670
tests: test long_versions as well for consistency
woodruffw d624d81
listgen: every tuesday
woodruffw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
python: | ||
- "3.7" | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
cache: pip | ||
|
||
- name: test | ||
run: make test INSTALL_EXTRA=test | ||
|
||
# lint: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: "3.10" | ||
# - name: lint | ||
# run: make lint INSTALL_EXTRA=lint | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: Generate stdlib lists | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 0 * * 2" | ||
|
||
jobs: | ||
pre-list-legacy: | ||
strategy: | ||
matrix: | ||
python: | ||
- "3.7" | ||
- "3.8" | ||
- "3.9" | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
# NOTE: matrix.python is intentionally not used here. | ||
python-version: "3.x" | ||
- name: support deps | ||
run: make dev INSTALL_EXTRA=support | ||
- name: build pre-list | ||
env: | ||
LISTGEN_PYTHON_VERSION: "${{ matrix.python }}" | ||
run: | | ||
./env/bin/python ./support/fetch-sphinx.py "${LISTGEN_PYTHON_VERSION}" > pre-list.txt | ||
- name: upload pre-list | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: pre-list-${{ matrix.python }} | ||
path: pre-list.txt | ||
|
||
expand-list-legacy: | ||
needs: pre-list-legacy | ||
strategy: | ||
matrix: | ||
python: | ||
- "3.7" | ||
- "3.8" | ||
- "3.9" | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
miketheman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: pre-list-${{ matrix.python }} | ||
- name: walk modules | ||
run: | | ||
python -V | ||
python ./support/walk-modules.py "${LISTGEN_PYTHON_VERSION}.txt" < pre-list.txt | ||
rm pre-list.txt | ||
sort -o "${LISTGEN_PYTHON_VERSION}.txt" "${LISTGEN_PYTHON_VERSION}.txt" | ||
mv "${LISTGEN_PYTHON_VERSION}.txt" ./stdlib_list/lists/ | ||
- name: create PR | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
commit-message: "[BOT] update list for ${{ matrix.python }}" | ||
branch: update-stdlib-list-${{ matrix.python }} | ||
base: main | ||
branch-suffix: timestamp | ||
title: "[BOT] update list for ${{ matrix.python }}" | ||
body: | | ||
This is an automated pull request, updating `${{ matrix.python }}.txt` after a detected change. | ||
|
||
Please review manually before merging. | ||
assignees: "woodruffw" | ||
reviewers: "woodruffw" | ||
|
||
expand-list: | ||
strategy: | ||
matrix: | ||
python: | ||
- "3.10" | ||
- "3.11" | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- name: walk modules | ||
env: | ||
LISTGEN_PYTHON_VERSION: ${{ matrix.python }} | ||
run: | | ||
python -V | ||
python ./support/walk-modules.py "${LISTGEN_PYTHON_VERSION}.txt" | ||
sort -o "${LISTGEN_PYTHON_VERSION}.txt" "${LISTGEN_PYTHON_VERSION}.txt" | ||
mv "${LISTGEN_PYTHON_VERSION}.txt" ./stdlib_list/lists/ | ||
|
||
- name: create PR | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
commit-message: "[BOT] update list for ${{ matrix.python }}" | ||
branch: update-stdlib-list-${{ matrix.python }} | ||
base: main | ||
branch-suffix: timestamp | ||
title: "[BOT] update list for ${{ matrix.python }}" | ||
body: | | ||
This is an automated pull request, updating `${{ matrix.python }}.txt` after a detected change. | ||
|
||
Please review manually before merging. | ||
assignees: "woodruffw" | ||
reviewers: "woodruffw" |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env python | ||
|
||
# fetch-sphinx.py: retrieve a particular Python version's stdlib list | ||
# using its hosted Sphinx inventory. | ||
|
||
import sys | ||
import sphobjinv as soi | ||
|
||
if __name__ == "__main__": | ||
vers = sys.argv[1] | ||
inv = soi.Inventory(url=f"https://docs.python.org/{vers}/objects.inv") | ||
modules = list(sorted(obj.name for obj in inv.objects if obj.role == "module")) | ||
print("\n".join(modules)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/usr/bin/env python | ||
|
||
import inspect | ||
import pkgutil | ||
import sys | ||
|
||
SEEN_MODS = set() | ||
|
||
|
||
def walk_pkgutil(mod_name, mod, io): | ||
for pkg in pkgutil.walk_packages(mod.__path__, mod_name + "."): | ||
if pkg.name in SEEN_MODS: | ||
continue | ||
else: | ||
# We don't recurse here because `walk_packages` takes care of | ||
# it for us. | ||
SEEN_MODS.add(pkg.name) | ||
print(pkg.name, file=io) | ||
|
||
|
||
def walk_naive(mod_name, mod, io): | ||
for attr in dir(mod): | ||
attr_obj = getattr(mod, attr, None) | ||
# Shouldn't happen, but who knows. | ||
if attr_obj is None: | ||
continue | ||
|
||
# If this member isn't a module, skip it. | ||
if not inspect.ismodule(attr_obj): | ||
continue | ||
|
||
# To filter "real" submodules from re-exports, we try | ||
# and import the submodule by its qualified name. | ||
# If the import fails, we know it's a re-exported module. | ||
try: | ||
submod_name = mod_name + "." + attr | ||
__import__(submod_name) | ||
walk(submod_name, io) | ||
except ImportError: | ||
# ...but sometimes we do want to include re-exports, since | ||
# they might be things like "accelerator" modules that don't | ||
# appear anywhere else. | ||
# For example, `_bz2` might appear as a re-export. | ||
try: | ||
# Again, try and import to avoid module-looking object | ||
# that don't actually appear on disk. Experimentally, | ||
# there are a few of these (like "TK"). | ||
__import__(attr) | ||
walk(attr, io) | ||
except ImportError: | ||
continue | ||
|
||
|
||
def walk(mod_name, io): | ||
if mod_name in SEEN_MODS: | ||
return | ||
else: | ||
SEEN_MODS.add(mod_name) | ||
print(mod_name, file=io) | ||
|
||
# Try and import it. | ||
try: | ||
mod = __import__(mod_name) | ||
|
||
if hasattr(mod, "__path__"): | ||
walk_pkgutil(mod_name, mod, io) | ||
else: | ||
walk_naive(mod_name, mod, io) | ||
|
||
except ImportError: | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
output = sys.argv[1] | ||
|
||
with open(output, mode="w") as io: | ||
for mod_name in sys.builtin_module_names: | ||
walk(mod_name, io) | ||
|
||
if hasattr(sys, "stdlib_module_names"): | ||
for mod_name in sys.stdlib_module_names: | ||
walk(mod_name, io) | ||
else: | ||
for mod_name in sys.stdin: | ||
walk(mod_name.rstrip("\n"), io) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
NB: Intentionally not enabled; will do in a separate PR.