Skip to content

Instantly share code, notes, and snippets.

View pradyunsg's full-sized avatar
👀
Away from open source stuff for a bit.

Pradyun Gedam pradyunsg

👀
Away from open source stuff for a bit.
View GitHub Profile
pip install --dry-run -I --only-binary :all: --debug -r ...
@pradyunsg
pradyunsg / find-top-level-from-wheel-file.py
Last active December 4, 2023 13:15
Figuring out the top-level importable names from a wheel
"""Takes a .whl file and figures out the top-level importable names in that wheel.
Usage:
$ python find-top-level-from-wheel-file.py ./setuptools-65.4.1-py3-none-any.whl
['_distutils_hack', 'pkg_resources', 'setuptools']
Testing:
$ pytest find-top-level-from-wheel-file.py
...
[[tool.pre-commit.repos]]
repo = "https://github.com/pre-commit/pre-commit-hooks"
rev = "v4.0.1"
hooks = [
{ id = "trailing-whitespace" },
{ id = "trailing-whitespace" },
{ id = "end-of-file-fixer" },
{ id = "check-docstring-first" },
{ id = "check-json" },
{ id = "check-yaml" },
@pradyunsg
pradyunsg / pip-error-messages.md
Created October 15, 2021 18:24
A draft of what better error messages in pip _could_ look like

Better Error Messages in pip

Example 1

Today:

ERROR: Could not find a version that satisfies the requirement qwertyuidfudsjhdblfnsfngnsjkfnjsflz (from versions: none)
ERROR: No matching distribution found for qwertyuidfudsjhdblfnsfngnsjkfnjsfl
  1. Grab a clean virtual environment.
  2. Run PIP_RESOLVER_DEBUG=1 pip install "flake8 <= 4.0.1" "flake8-isort < 4.1.0".
@pradyunsg
pradyunsg / downloads.sql
Created July 26, 2021 10:18
Downloads of s390x wheels from PyPI
SELECT
COUNT(*) AS count
FROM
`the-psf.pypi.file_downloads`
WHERE
DATE(timestamp) BETWEEN DATE "2021-06-01" AND DATE "2021-06-01"
AND file.filename LIKE "%-%-manylinux_%_%_s390x%";
-- 85136
@pradyunsg
pradyunsg / css_to_inject.css
Created September 21, 2020 15:59
Limited height Repository Files listing, on GitHub
[aria-labelledby="files"] {
overflow-y: auto;
max-height: 46vh;
/* Add a shadow to the edges with scroll-hidden content */
background:
/* Shadow covers */
linear-gradient(white 30%, rgba(255, 255, 255, 0)),
linear-gradient(rgba(255, 255, 255, 0), white 70%) 0 100%,
/* Shadows */
@pradyunsg
pradyunsg / README.md
Created August 26, 2020 12:20
Nicer LimeSurvey form UI

USAGE

  1. Open the "[LimeSurvey]/survey/index.php?r=admin/responses/sa/index/surveyid/[survey-id]".
  2. Get the HTML of the table element containing the responses into a file.
    • Right click the first response, Inspect Element
    • Select "<table class="table-striped table">" in the new window/pane that opened.
    • Copy the HTML for that element (w/ ctrl+c or cmd+c)
    • Paste this into a text editor and save this file (anything works, I'm assuming it's surveys.html).
  3. Install jinja2 and BeautifulSoup4. (pip install jinja2 beautifulsoup4)
  4. Run python nicer-survey-ui.py surveys.html.