Skip to content

Commit 34c155a

Browse files
committed
Merge remote-tracking branch 'upstream/main' into glossary
2 parents 21d6115 + c52e600 commit 34c155a

File tree

5 files changed

+170
-45
lines changed

5 files changed

+170
-45
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Update Top Ranked Issues
2+
3+
on:
4+
# For testing purposes (can be removed later)
5+
pull_request:
6+
schedule:
7+
# # Runs every day at 3:00 AM UTC
8+
# - cron: '0 3 * * *'
9+
- cron: '*/10 * * * *'
10+
11+
jobs:
12+
run-script:
13+
runs-on: ubuntu-latest
14+
15+
env:
16+
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
18+
steps:
19+
- name: Check out the repository
20+
uses: actions/checkout@v4 # This ensures the repository code is available
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.12"
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install PyGithub
31+
32+
- name: Run update_top_ranking_issues.py
33+
run: |
34+
python ./scripts/update_top_ranking_issues.py

docs/sphinx/source/whatsnew/v0.11.2.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,16 @@ Requirements
2929
~~~~~~~~~~~~
3030

3131

32+
Maintenance
33+
~~~~~~~~~~~
34+
* Added a decorator to deprecate renamed keyword arguments in functions,
35+
:py:func:`pvlib._deprecation.renamed_kwarg_warning`. (:pull:`2237`)
36+
37+
3238
Contributors
3339
~~~~~~~~~~~~
3440
* Cliff Hansen (:ghuser:`cwhanse`)
3541
* Rajiv Daxini (:ghuser:`RDaxini`)
36-
42+
* Mark Mikofski (:ghuser:`mikofski`)
43+
* matsuobasho (:ghuser:`matsuobasho`)
44+
* Echedey Luis (:ghuser:`echedey-ls`)

pvlib/tests/test__deprecation.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,56 @@
55
import pytest
66

77
from pvlib import _deprecation
8+
from .conftest import fail_on_pvlib_version
89

910
import warnings
1011

1112

13+
@pytest.mark.xfail(strict=True,
14+
reason='fail_on_pvlib_version should cause test to fail')
15+
@fail_on_pvlib_version('0.0')
16+
def test_fail_on_pvlib_version():
17+
pass # pragma: no cover
18+
19+
20+
@fail_on_pvlib_version('100000.0')
21+
def test_fail_on_pvlib_version_pass():
22+
pass
23+
24+
25+
@pytest.mark.xfail(strict=True, reason='ensure that the test is called')
26+
@fail_on_pvlib_version('100000.0')
27+
def test_fail_on_pvlib_version_fail_in_test():
28+
raise Exception
29+
30+
31+
# set up to test using fixtures with function decorated with
32+
# conftest.fail_on_pvlib_version
33+
@pytest.fixture
34+
def some_data():
35+
return "some data"
36+
37+
38+
def alt_func(*args):
39+
return args
40+
41+
42+
@pytest.fixture
43+
def deprec_func():
44+
return _deprecation.deprecated(
45+
"350.8", alternative="alt_func", name="deprec_func", removal="350.9"
46+
)(alt_func)
47+
48+
49+
@fail_on_pvlib_version('350.9')
50+
def test_use_fixture_with_decorator(some_data, deprec_func):
51+
# test that the correct data is returned by the some_data fixture
52+
assert some_data == "some data"
53+
with pytest.warns(_deprecation.pvlibDeprecationWarning):
54+
# test for custom deprecation warning provided by pvlib
55+
deprec_func(some_data)
56+
57+
1258
@pytest.fixture
1359
def renamed_kwarg_func():
1460
"""Returns a function decorated by renamed_kwarg_warning.

pvlib/tests/test_conftest.py

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,6 @@
11
import pytest
2-
import pandas
32

43
from pvlib.tests import conftest
5-
from pvlib.tests.conftest import fail_on_pvlib_version
6-
7-
from pvlib._deprecation import pvlibDeprecationWarning, deprecated
8-
9-
@pytest.mark.xfail(strict=True,
10-
reason='fail_on_pvlib_version should cause test to fail')
11-
@fail_on_pvlib_version('0.0')
12-
def test_fail_on_pvlib_version():
13-
pass
14-
15-
16-
@fail_on_pvlib_version('100000.0')
17-
def test_fail_on_pvlib_version_pass():
18-
pass
19-
20-
21-
@pytest.mark.xfail(strict=True, reason='ensure that the test is called')
22-
@fail_on_pvlib_version('100000.0')
23-
def test_fail_on_pvlib_version_fail_in_test():
24-
raise Exception
25-
26-
27-
# set up to test using fixtures with function decorated with
28-
# conftest.fail_on_pvlib_version
29-
@pytest.fixture()
30-
def some_data():
31-
return "some data"
32-
33-
34-
def alt_func(*args):
35-
return args
36-
37-
38-
deprec_func = deprecated('350.8', alternative='alt_func',
39-
name='deprec_func', removal='350.9')(alt_func)
40-
41-
42-
@fail_on_pvlib_version('350.9')
43-
def test_use_fixture_with_decorator(some_data):
44-
# test that the correct data is returned by the some_data fixture
45-
assert some_data == "some data"
46-
with pytest.warns(pvlibDeprecationWarning): # test for deprecation warning
47-
deprec_func(some_data)
484

495

506
@pytest.mark.parametrize('function_name', ['assert_index_equal',
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import os
2+
import itertools
3+
from datetime import datetime, timedelta
4+
5+
from github import Github
6+
from github.Issue import Issue
7+
from github.Repository import Repository
8+
9+
10+
def main():
11+
start_time: datetime = datetime.now()
12+
13+
# --- Initialization ---
14+
# GitHub Workflow will pass in the token as an environment variable,
15+
# but we can place it in our env when running the script locally,
16+
# for convenience
17+
local_github_token: str | None = None
18+
github_token: str | None = (
19+
local_github_token or os.getenv("GITHUB_ACCESS_TOKEN")
20+
)
21+
github = Github(github_token)
22+
23+
# repository name
24+
repo_name: str = "pvlib/pvlib-python"
25+
repository: Repository = github.get_repo(repo_name)
26+
27+
# Number of top issues to list
28+
MAX_ISSUES = 19
29+
TOP_ISSUES_CARD_NUMBER = 2196
30+
31+
# Rate limiting
32+
remaining_requests_before: int = github.rate_limiting[0]
33+
print(f"Remaining requests before: {remaining_requests_before}")
34+
35+
# --- Actions ---
36+
# Get sorted issues
37+
query: str = (
38+
f'repo:{repository.full_name} is:open is:issue sort:reactions-+1-desc'
39+
)
40+
issues = github.search_issues(query)
41+
42+
# Format
43+
ranked_issues = []
44+
# Continuous number generator for the numbered list, starts at 1
45+
index_generator = itertools.count(1)
46+
for issue in issues:
47+
# Don't include the overview card (skip to next iteration)
48+
if issue.number == TOP_ISSUES_CARD_NUMBER:
49+
continue
50+
51+
# Get numbered list item index from generator
52+
i = next(index_generator)
53+
if i >= MAX_ISSUES:
54+
break
55+
56+
markdown_bullet_point: str = (
57+
f"{issue.html_url} " +
58+
f"({issue._rawData['reactions']['+1']} :thumbsup:)"
59+
)
60+
61+
markdown_bullet_point = f"{i}. {markdown_bullet_point}"
62+
ranked_issues.append(markdown_bullet_point)
63+
64+
# edit top issues
65+
top_issues_card: Issue = repository.get_issue(
66+
number=TOP_ISSUES_CARD_NUMBER
67+
)
68+
header = "Top Ranking Issues"
69+
new_body = header + "\n" + "\n".join(ranked_issues)
70+
top_issues_card.edit(
71+
body=new_body
72+
)
73+
74+
print(top_issues_card.body)
75+
76+
run_duration: timedelta = datetime.now() - start_time
77+
print(run_duration)
78+
79+
80+
if __name__ == "__main__":
81+
main()

0 commit comments

Comments
 (0)