-
-
Notifications
You must be signed in to change notification settings - Fork 143
Rename poe tasks #137
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
Rename poe tasks #137
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
dccc186
clean poe tasks
twoertwein 04657cd
fix pytest
twoertwein f314756
change help for test_dist
twoertwein 29cfa27
remove options from test_src
twoertwein 6373fe1
fix workflow
twoertwein 7916e8b
typo
twoertwein 2e62aea
pip force-reinstall
twoertwein 1f246f4
rename workflow and _step
twoertwein 01cd37f
add style
twoertwein eb189b3
dist
twoertwein 031db32
fix
twoertwein 7a33d8a
change help
twoertwein 8fd5ef7
make test_all the first entry
twoertwein 6769f1d
install the latest wheel
twoertwein 4c68510
small changes
twoertwein 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 |
---|---|---|
|
@@ -39,29 +39,17 @@ jobs: | |
- name: Install project dependencies | ||
run: poetry install -vvv --no-root | ||
|
||
- name: Run MyPy Against Source Code | ||
- name: Run mypy on 'tests' (using the local stubs) and on the local stubs | ||
run: poetry run poe mypy_src | ||
|
||
- name: Run Pyright Against Source Code | ||
- name: Run pyright on 'tests' (using the local stubs) and on the local stubs | ||
run: poetry run poe pyright_src | ||
|
||
- name: Run Pytest Against Source Code | ||
run: poetry run poe pytest_src | ||
|
||
- name: Build Distribution | ||
run: poetry run poe build_dist | ||
|
||
- name: Install Distribution | ||
run: poetry run poe install_dist | ||
- name: Run pytest | ||
run: poetry run poe pytest | ||
|
||
- if: matrix.python-version == '3.8' && matrix.os == 'ubuntu-latest' | ||
uses: pre-commit/[email protected] | ||
|
||
- name: Rename Source Code | ||
run: poetry run poe rename_src | ||
|
||
- name: Run Pyright Against Distribution | ||
run: poetry run poe pyright_dist | ||
|
||
- name: Run MyPy Against Distribution | ||
run: poetry run poe mypy_dist | ||
- name: Install pandas-stubs and run tests on the installed stubs | ||
run: poetry run poe test_dist |
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 |
---|---|---|
@@ -1,82 +1,40 @@ | ||
from typing import Literal | ||
|
||
from scripts._job import run_job | ||
from scripts.test import _step | ||
|
||
|
||
def test_src(profile: str, clean_cache: bool = False): | ||
steps = [] | ||
if clean_cache: | ||
steps.extend( | ||
[ | ||
_step.clean_mypy_cache, | ||
_step.clean_pytest_cache, | ||
] | ||
) | ||
|
||
if profile in (None, "", "default"): | ||
steps.extend([_step.mypy_src, _step.pyright_src]) | ||
elif profile == "pytest": | ||
steps.extend([_step.pytest_src]) | ||
elif profile == "style": | ||
steps.extend([_step.style_src]) | ||
elif profile == "full": | ||
steps.extend( | ||
[_step.mypy_src, _step.pyright_src, _step.pytest_src, _step.style_src] | ||
) | ||
else: | ||
raise ModuleNotFoundError("Profile not found!") | ||
|
||
run_job(steps) | ||
|
||
|
||
def test_dist(clean_cache: bool = False): | ||
_CACHE_STEPS = [_step.clean_mypy_cache, _step.clean_pytest_cache] | ||
_SRC_STEPS = [_step.mypy_src, _step.pyright_src, _step.pytest, _step.style] | ||
_DIST_STEPS = [ | ||
_step.build_dist, | ||
_step.install_dist, | ||
_step.rename_src, | ||
_step.mypy_dist, | ||
_step.pyright_dist, | ||
_step.uninstall_dist, | ||
_step.restore_src, | ||
] | ||
|
||
|
||
def test( | ||
clean_cache: bool = False, | ||
src: bool = False, | ||
dist: bool = False, | ||
type_checker: Literal["", "mypy", "pyright"] = "", | ||
): | ||
steps = [] | ||
if clean_cache: | ||
steps.extend( | ||
[ | ||
_step.clean_mypy_cache, | ||
_step.clean_pytest_cache, | ||
] | ||
) | ||
steps.extend(_CACHE_STEPS) | ||
|
||
steps.extend( | ||
[ | ||
_step.build_dist, | ||
_step.install_dist, | ||
_step.rename_src, | ||
_step.mypy_dist, | ||
_step.pyright_dist, | ||
_step.uninstall_dist, | ||
_step.restore_src, | ||
] | ||
) | ||
|
||
run_job(steps) | ||
if src: | ||
steps.extend(_SRC_STEPS) | ||
|
||
if dist: | ||
steps.extend(_DIST_STEPS) | ||
|
||
def test_all(clean_cache: bool = False): | ||
steps = [] | ||
if clean_cache: | ||
steps.extend( | ||
[ | ||
_step.clean_mypy_cache, | ||
_step.clean_pytest_cache, | ||
] | ||
) | ||
|
||
steps.extend( | ||
[ | ||
_step.mypy_src, | ||
_step.pyright_src, | ||
_step.pytest_src, | ||
_step.style_src, | ||
_step.build_dist, | ||
_step.install_dist, | ||
_step.rename_src, | ||
_step.mypy_dist, | ||
_step.pyright_dist, | ||
_step.uninstall_dist, | ||
_step.restore_src, | ||
] | ||
) | ||
if type_checker: | ||
# either pyright or mypy | ||
remove = "mypy" if type_checker == "pyright" else "pyright" | ||
steps = [step for step in steps if remove not in step.name] | ||
|
||
run_job(steps) |
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
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.
Can we keep this one in there? It's useful sometimes to just run
pytest
and notmypy
andpyright
?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.
test_src has some redundancy with the other tests. Pytest can still be run with
poe test_src --profile=pytest
.I think there are two options:
I slightly prefer option 2.
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.
Added
pytest_src
back and removed the profiles fromtest_src
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.
How about this:
test_src
have no profile, domypy
,pyright
,pytest
andstyle
pytest_src
style
then we have the following options:
test_src
(does all of the next 4)mypy_src
pyright_src
pytest_src
style
test_dist
(does all of the next 3)mypy_dist
pyright_dist
pytest_dist
(should add that)Don't think we need
install_dist
andrename_src
as top level 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.
Yeah, that is missing right now.
I like that as it makes testing the installation easier while developing but it will make the CI slower (unless the CI just calls test_dist)
tests/ is not part of the wheel (and I think it is good that it isn't part of the wheel)
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 fine if the CI just calls
test_dist
or just calls the 3 individual pieces (which I think it does now)If you look at the
poe
run, bothmypy_dist
andpyright_dist
test thetests
folder against the installed distribution, so we're fine.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.
Now it looks like this:
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.
looks good