Support Your Foundation
My GitHub account hosts more than 60 projects. I would estimate that 90% of these are built using the same handful of packages: Django, requests, PostgreSQL, etc. These projects often share common infrastructure as well.
I’ve created a simple script that can analyze your ‘requirements.txt’ file and inform you if there’s a funding page on PyPI for the corresponding project.
If you visit https://github.com/sponsors/explore, you can see the dependencies of your public repositories that you can sponsor.
Are there any other methods to support these developers or projects in an easy or fast way?
#Made by https://twitter.com/OppositeInvict2
import requests
def get_packages_from_requirements_file(filepath):
with open(filepath, 'r') as file:
lines = file.readlines()
packages = [line.strip().split('==')[0] for line in lines]
return packages
def get_pypi_info(package):
url = f'https://pypi.org/pypi/{package}/json'
response = requests.get(url)
response.raise_for_status() # will raise an error if the request fails
return response.json()
def check_for_funding_link(package):
package_info = get_pypi_info(package)
project_urls = package_info['info'].get('project_urls', {})
funding_link = project_urls.get(
'Funding') # 'Funding' is common but not guaranteed
if funding_link:
print(f'Package {package} has a funding link: {funding_link}')
else:
print(f'Package {package} does not have a funding link.')
def analyze_requirements_file(filepath):
packages = get_packages_from_requirements_file(filepath)
for package in packages:
check_for_funding_link(package)
analyze_requirements_file(
'requirements.txt') # change to your requirements.txt file path