Skip to content

Commit 6cfe5bd

Browse files
committed
Minify for 11% smaller
1 parent dfee0a4 commit 6cfe5bd

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
# top-pypi-packages
1+
# Top PyPI Packages
22

33
A weekly dump of the 5,000 most-downloaded packages from PyPI:
44

55
* https://hugovk.github.io/top-pypi-packages/top-pypi-packages-30-days.json
66
* https://hugovk.github.io/top-pypi-packages/top-pypi-packages-365-days.json
77

8+
Minified:
9+
10+
* https://hugovk.github.io/top-pypi-packages/top-pypi-packages-30-days.min.json
11+
* https://hugovk.github.io/top-pypi-packages/top-pypi-packages-365-days.min.json
12+
813
## Server setup notes
914

1015
From cron, it runs pypinfo to dump JSON and commit back to this repo.
1116

12-
### Install Python 3.6 and pip
17+
### Install Python 3.6, pip and jq
1318

1419
For example on Ubuntu 14.04:
1520

@@ -19,6 +24,7 @@ sudo apt-get update
1924
sudo apt-get install python3.6
2025
python3.6 --version
2126
curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6
27+
sudo apt-get install jq
2228
```
2329

2430
### Install and set up pypinfo

generate.sh

+5
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ set -e
66
# Generate the files
77
/usr/local/bin/pypinfo --json --indent 0 --limit 5000 --days 30 "" project > top-pypi-packages-30-days.json
88
/usr/local/bin/pypinfo --json --indent 0 --limit 5000 --days 365 "" project > top-pypi-packages-365-days.json
9+
10+
# Minify the files
11+
# Not human-readable or diffable, but about 11% smaller, eg. 268K->238K
12+
jq -c . < top-pypi-packages-30-days.json > top-pypi-packages-30-days.min.json
13+
jq -c . < top-pypi-packages-365-days.json > top-pypi-packages-365-days.min.json

index.html

+7-2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ <h2 id="what">What is this?</h2>
8080
<li><a href="https://hugovk.github.io/top-pypi-packages/top-pypi-packages-30-days.json">https://hugovk.github.io/top-pypi-packages/top-pypi-packages-30-days.json</a></li>
8181
<li><a href="https://hugovk.github.io/top-pypi-packages/top-pypi-packages-365-days.json">https://hugovk.github.io/top-pypi-packages/top-pypi-packages-365-days.json</a></li>
8282
</ul>
83+
<p>Minified:</p>
84+
<ul>
85+
<li><a href="https://hugovk.github.io/top-pypi-packages/top-pypi-packages-30-days.json">https://hugovk.github.io/top-pypi-packages/top-pypi-packages-30-days.min.json</a></li>
86+
<li><a href="https://hugovk.github.io/top-pypi-packages/top-pypi-packages-365-days.json">https://hugovk.github.io/top-pypi-packages/top-pypi-packages-365-days.min.json</a></li>
87+
</ul>
8388
<h2 id="thanks">Thanks</h2>
8489
<p>Thanks to <a href="https://pypi.python.org/">PyPI</a>, <a href="https://cloud.google.com/bigquery/">Google BigQuery</a>, <a href="https://github.com/ofek/pypinfo">pypinfo</a> and <a href="http://pythonwheels.com/">Python Wheels</a>.</p>
8590
</div>
@@ -140,14 +145,14 @@ <h2 id="charts">The charts</h2>
140145
$scope.show($scope.num_packages);
141146
$scope.now_showing_days = 'over 365 days.';
142147
};
143-
$http.get('top-pypi-packages-365-days.json').then(function(res) {
148+
$http.get('top-pypi-packages-365-days.min.json').then(function(res) {
144149
$scope.last_update = res.data.last_update;
145150
// Store all for later
146151
$scope.all_packages_365 = res.data['rows'];
147152
// We'll show these to begin
148153
$scope.days_365();
149154
});
150-
$http.get('top-pypi-packages-30-days.json').then(function(res) {
155+
$http.get('top-pypi-packages-30-days.min.json').then(function(res) {
151156
// Store all for later
152157
$scope.all_packages_30 = res.data['rows'];
153158
});

0 commit comments

Comments
 (0)