Skip to content

Commit fbdda08

Browse files
committed
CI/script fixes
1 parent 407e5d2 commit fbdda08

File tree

7 files changed

+83
-34
lines changed

7 files changed

+83
-34
lines changed

.github/workflows/docs.yml

+28-25
Original file line numberDiff line numberDiff line change
@@ -59,37 +59,40 @@ jobs:
5959
name: awesomeSphinx docs
6060
path: docs/_build/html
6161

62+
# NO DEPLOYMENT FOR PUSHES
63+
# DOCS GET DEPLOYED WEEKLY
64+
6265
# the following steps are only done after pushing to main or merging a PR
6366
# clone and set up the old gh-pages branch
64-
- name: Clone old gh-pages
65-
if: ${{ github.event_name == 'push' }}
66-
run: |
67-
set -x
68-
git fetch
69-
( git branch gh-pages remotes/origin/gh-pages && git clone . --branch=gh-pages _gh-pages/ ) || mkdir _gh-pages
70-
rm -rf _gh-pages/.git/
71-
mkdir -p _gh-pages/
67+
# - name: Clone old gh-pages
68+
# if: ${{ github.event_name == 'push' }}
69+
# run: |
70+
# set -x
71+
# git fetch
72+
# ( git branch gh-pages remotes/origin/gh-pages && git clone . --branch=gh-pages _gh-pages/ ) || mkdir _gh-pages
73+
# rm -rf _gh-pages/.git/
74+
# mkdir -p _gh-pages/
7275
# if a push and default branch, copy build to _gh-pages/ as the "main"
7376
# deployment.
74-
- name: Copy docs build
75-
if: ${{ github.event_name == 'push' }}
76-
run: |
77-
set -x
78-
rsync -a docs/_build/html/ _gh-pages/
77+
# - name: Copy docs build
78+
# if: ${{ github.event_name == 'push' }}
79+
# run: |
80+
# set -x
81+
# rsync -a docs/_build/html/ _gh-pages/
7982

8083
# add the .nojekyll file
81-
- name: nojekyll
82-
if: ${{ github.event_name == 'push' }}
83-
run: |
84-
touch _gh-pages/.nojekyll
84+
# - name: nojekyll
85+
# if: ${{ github.event_name == 'push' }}
86+
# run: |
87+
# touch _gh-pages/.nojekyll
8588

8689
# deploy
8790
# https://github.com/peaceiris/actions-gh-pages
88-
- name: Deploy
89-
uses: peaceiris/actions-gh-pages@v3
90-
if: ${{ github.event_name == 'push' }}
91-
with:
92-
publish_branch: gh-pages
93-
github_token: ${{ secrets.GITHUB_TOKEN }}
94-
publish_dir: _gh-pages/
95-
force_orphan: true
91+
# - name: Deploy
92+
# uses: peaceiris/actions-gh-pages@v3
93+
# if: ${{ github.event_name == 'push' }}
94+
# with:
95+
# publish_branch: gh-pages
96+
# github_token: ${{ secrets.GITHUB_TOKEN }}
97+
# publish_dir: _gh-pages/
98+
# force_orphan: true

.vscode/launch.json

+43-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,41 @@
1515
"GOOGLE_APPLICATION_CREDENTIALS": "${workspaceFolder}/secrets/google_cloud.json"
1616
}
1717
},
18+
{
19+
"name": "1_pypi_json SHORT",
20+
"type": "python",
21+
"request": "launch",
22+
"program": "scripts/pypi_json.py",
23+
"console": "integratedTerminal",
24+
"justMyCode": true,
25+
"env": {
26+
"GOOGLE_APPLICATION_CREDENTIALS": "${workspaceFolder}/secrets/google_cloud.json",
27+
"AWESOMESPHINX_AMOUNT": "3",
28+
"AWESOMESPHINX_DAYS": "1",
29+
}
30+
},
31+
{
32+
"name": "2_github_stats SHORT",
33+
"type": "python",
34+
"request": "launch",
35+
"program": "scripts/github_stats.py",
36+
"console": "integratedTerminal",
37+
"justMyCode": true,
38+
"env": {
39+
"AWESOMESPHINX_AMOUNT": "3",
40+
}
41+
},
42+
{
43+
"name": "3_needs.json SHORT",
44+
"type": "python",
45+
"request": "launch",
46+
"program": "scripts/needs_json.py",
47+
"console": "integratedTerminal",
48+
"justMyCode": true,
49+
"env": {
50+
"AWESOMESPHINX_AMOUNT": "3",
51+
}
52+
},
1853

1954
{
2055
"name": "Sphinx build CLEAN",
@@ -23,7 +58,10 @@
2358
"program": "${workspaceFolder}/.venv/bin/sphinx-build",
2459
"args": ["-v", "-b", "html", ".", "_build/html", "-a", "-E"],
2560
"console": "integratedTerminal",
26-
"cwd": "${workspaceFolder}/docs"
61+
"cwd": "${workspaceFolder}/docs",
62+
"env": {
63+
"AWESOMESPHINX_NEEDS_FILE": "/../awesome.json",
64+
}
2765
},
2866

2967
{
@@ -33,7 +71,10 @@
3371
"program": "${workspaceFolder}/.venv/bin/sphinx-build",
3472
"args": ["-b", "html", ".", "_build/html"],
3573
"console": "integratedTerminal",
36-
"cwd": "${workspaceFolder}/docs"
74+
"cwd": "${workspaceFolder}/docs",
75+
"env": {
76+
"AWESOMESPHINX_NEEDS_FILE": "/../awesome.json",
77+
}
3778
}
3879
]
3980
}

docs/additions.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Specific Need objects
1212
---------------------
1313

1414

15-
.. needextend:: SUNPY-SPHINX-THEME
15+
.. needextend:: SUNPY-SPHINX-THEME2
16+
:strict: False
1617
:sphinx_type: theme
1718

1819
.. needextend:: SPHINX-NEEDS

docs/conf.py

+2
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@
172172

173173
needs_variant_options = ["status"] # Not needed, but workarund to avoid a bug and some warnings
174174

175+
needs_needextend_strict = False
176+
175177
def days_since_build(app, need, needs, *args, **kwargs):
176178
"""
177179
Calculates the days from now to a given date, which is normally in the past.

docs/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
git+https://github.com/useblocks/sphinx-needs/#egg=sphinx-needs
1+
git+https://github.com/useblocks/sphinx-needs@needextend_strict
22
sphinxcontrib.plantuml
33
sphinx_design
44
sphinx-immaterial

scripts/awesome_config.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,14 @@
4646
WHERE file.project in ('{}')
4747
-- Only query the last X days of history
4848
AND DATE(timestamp)
49-
BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
49+
BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL {} DAY)
5050
AND CURRENT_DATE()
5151
GROUP BY `project`
5252
"""
5353

54+
# Amount of days to fetch data from PyPI
55+
BIGQUERY_DAYS = int(os.environ.get('AWESOMESPHINX_DAYS', 30))
56+
5457
##################################################
5558
# GITHUB_STATS.PY configs
5659
##################################################
@@ -60,7 +63,7 @@
6063
##################################################
6164
# NEEDS_JSON.PY configs
6265
##################################################
63-
PYPI_FILE = JSON_FILE
66+
PYPI_FILE = os.environ.get('AWESOMESPHINX_PYPI_FILE', JSON_FILE)
6467
#PYPI_FILE = 'data/20221024_pypi_data.json'
6568

6669
NEED_FILE = 'awesome.json'

scripts/pypi_json.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
def get_dl_month(name, results, counter):
2020
client = bigquery.Client()
21-
query_string = BIGQUERY_DL_MONTH.format(name)
21+
query_string = BIGQUERY_DL_MONTH.format(name, BIGQUERY_DAYS)
2222
query_job = client.query(query_string)
2323
query_results = query_job.result()
2424
for row in query_results:
@@ -102,7 +102,7 @@ def get_package_data(name, results):
102102
tools_data = results
103103

104104
# collect PyPi BigQuery downloads numbers
105-
print(f'Collecting PyPi BigQuery Stats for {len(tools_data)} tools')
105+
print(f'Collecting PyPi BigQuery Stats for {len(tools_data)} tools for {BIGQUERY_DAYS} days')
106106

107107
threads = {}
108108
results = {}
@@ -128,7 +128,6 @@ def get_package_data(name, results):
128128
package['awesome_stats'] = {
129129
'month': results[name],
130130
}
131-
print(f'{name}: {results[name]:,}')
132131
except KeyError:
133132
package['awesome_stats'] = {
134133
'month': 0,

0 commit comments

Comments
 (0)