mirror of
https://github.com/kennethreitz/kennethreitz.org.git
synced 2026-06-05 22:50:17 +00:00
chore: Update software engineer link in index.md
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
# background
|
||||
|
||||
`background` is a simple program that allows you to run background tasks
|
||||
in any Python application. It is a simple and easy-to-use library that
|
||||
allows you to run tasks in the background without blocking the main
|
||||
thread.
|
||||
|
||||
I'm using it on this FastAPI application to run trivial background tasks,
|
||||
outside of the main event loop.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
You can install `background` using `pip`:
|
||||
|
||||
```bash
|
||||
$ uv pip install background
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Here is a simple example of how you can use `background`:
|
||||
|
||||
```python
|
||||
import time
|
||||
import background
|
||||
|
||||
@background.task
|
||||
def work():
|
||||
# Do something expensive here.
|
||||
time.sleep(10)
|
||||
|
||||
|
||||
for _ in range(100):
|
||||
work()
|
||||
```
|
||||
|
||||
In the background, `work` will be executed using a ThreadPoolExecutor. The default
|
||||
number of threads is `multiprocessing.cpu_count()`, and is configurable.
|
||||
|
||||
## Learn More
|
||||
|
||||
The repository was gifted to [Parth Shandilya](https://github.com/ParthS007),
|
||||
who now maintains the project.
|
||||
|
||||
- https://github.com/ParthS007/background
|
||||
- https://pypi.org/project/background/
|
||||
@@ -0,0 +1,28 @@
|
||||
# dj-database-url
|
||||
|
||||
`dj-database-url` is a Python library that allows you to configure your Django application to use a database URL.
|
||||
|
||||
This need arose at my time at Heroku, where we allowed users to configure their Django application by setting an environment variable called `DATABASE_URL`.
|
||||
|
||||
## Installation
|
||||
|
||||
Installing `dj-database-url` is simple:
|
||||
|
||||
$ pip install dj-database-url
|
||||
|
||||
## Usage
|
||||
|
||||
Then, in your `settings.py` file, you can use `dj-database-url` to configure your database:
|
||||
|
||||
|
||||
import dj_database_url
|
||||
|
||||
DATABASES['default'] = dj_database_url.config(
|
||||
conn_max_age=600,
|
||||
conn_health_checks=True,
|
||||
)
|
||||
|
||||
|
||||
There are many options you can pass to `dj-database-url.config()`. See the [dj-database-url documentation](https://pypi.org/project/dj-database-url/) for more information.
|
||||
|
||||
https://pypi.org/project/dj-database-url/
|
||||
@@ -0,0 +1,14 @@
|
||||
# Super Sphere
|
||||
|
||||
Super Sphere is a game where you control a sphere and try to avoid obstacles. The game is simple, but it's also very challenging. The game is available on Android and iOS.
|
||||
|
||||
## Features
|
||||
|
||||
- **Simple Controls**: The game has simple controls that make it easy to play.
|
||||
- **Challenging Gameplay**: The game is challenging and requires quick reflexes to avoid obstacles.
|
||||
|
||||
## Downloads
|
||||
|
||||
You can download Super Sphere for free from GitHub:
|
||||
|
||||
[https://github.com/kennethreitz/super-sphere](https://github.com/kennethreitz/super-sphere)
|
||||
@@ -0,0 +1,14 @@
|
||||
# Super Sphere II
|
||||
|
||||
The successor to [Super Sphere](/projects/games/super-sphere), Super Sphere II is a game where you control a sphere and try to avoid obstacles. The game is simple, but it's also very challenging.
|
||||
|
||||
## Features
|
||||
|
||||
- **Simple Controls**: The game has simple controls that make it easy to play.
|
||||
- **Challenging Gameplay**: The game is challenging and requires quick reflexes to avoid obstacles.
|
||||
|
||||
## Downloads
|
||||
|
||||
You can download Super Sphere for free from GitHub:
|
||||
|
||||
[https://github.com/not-kennethreitz/super-sphere2](https://github.com/not-kennethreitz/super-sphere2)
|
||||
@@ -0,0 +1,63 @@
|
||||
# httpbin.org
|
||||
|
||||
[httpbin.org](https://httpbin.org/) is a simple HTTP request and response service. It is a useful tool for testing HTTP clients and debugging webhooks. The service provides a variety of endpoints that return different types of data, such as headers, IP address, and user-agent.
|
||||
|
||||
## Features
|
||||
|
||||
- **HTTP Methods**: httpbin.org supports various HTTP methods, including GET, POST, PUT, DELETE, and PATCH, allowing you to test different types of requests.
|
||||
- **Request Inspection**: The service allows you to inspect the details of the incoming request, such as headers, query parameters, and body content.
|
||||
- **Response Formats**: httpbin.org can return responses in different formats, such as JSON, HTML, and images, enabling you to test how your client handles different content types.
|
||||
- **Status Codes**: The service can return specific HTTP status codes, such as 200 OK, 404 Not Found, and 500 Internal Server Error, allowing you to test error handling in your client.
|
||||
- **Authentication**: httpbin.org supports basic authentication, allowing you to test how your client handles authenticated requests.
|
||||
- **Dynamic Data**: The service can generate dynamic data, such as random JSON responses or images of a specified size, enabling you to test edge cases in your client.
|
||||
|
||||
## Running with Docker
|
||||
|
||||
You can also run httpbin.org locally using Docker. First, pull the httpbin image from Docker Hub:
|
||||
|
||||
```bash
|
||||
$ docker pull kennethreitz/httpbin
|
||||
```
|
||||
|
||||
Then, run the httpbin container:
|
||||
|
||||
```bash
|
||||
$ docker run -p 80:80 kennethreitz/httpbin
|
||||
```
|
||||
|
||||
This will start the httpbin service on port 80 of your local machine, allowing you to interact with it using your HTTP client of choice.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
You can interact with httpbin.org using various HTTP clients, such as cURL, Python requests, or Postman. Here are some examples of how you can use the service:
|
||||
|
||||
### GET Request
|
||||
|
||||
To make a GET request to httpbin.org, you can use cURL:
|
||||
|
||||
```bash
|
||||
$ curl https://httpbin.org/get
|
||||
```
|
||||
|
||||
This will return a JSON response containing details of the request, such as headers, origin, and URL.
|
||||
|
||||
### POST Request
|
||||
|
||||
To make a POST request to httpbin.org with data, you can use cURL:
|
||||
|
||||
```bash
|
||||
$ curl -X POST https://httpbin.org/post -d "key1=value1&key2=value2"
|
||||
```
|
||||
|
||||
This will return a JSON response containing the data you posted.
|
||||
|
||||
### Authentication
|
||||
|
||||
To make an authenticated request to httpbin.org, you can use cURL with basic authentication:
|
||||
|
||||
```bash
|
||||
$ curl -u username:password https://httpbin.org/basic-auth/username/password
|
||||
```
|
||||
|
||||
This will return a JSON response indicating whether the authentication was successful.
|
||||
@@ -0,0 +1,4 @@
|
||||
Here is a list of some of my software projects.
|
||||
|
||||
You can find more projects on my [GitHub profile](https://github.com/kennethreitz).
|
||||
I try to always be working on something new and exciting! That isn't always the case, though.
|
||||
@@ -0,0 +1,35 @@
|
||||
# Maya: Datetimes for Humans
|
||||
|
||||
Maya is a Python library that simplifies working with datetimes. It provides a simple and intuitive interface for parsing, formatting, and manipulating dates and times, making it easier to work with temporal data in Python.
|
||||
|
||||
## Features
|
||||
|
||||
- **Human-readable API**: Maya's API is designed to be easy to read and understand, making it simple to work with datetimes in Python.
|
||||
- **Timezone support**: Maya supports working with datetimes in different timezones, allowing you to handle time conversions and daylight saving time changes.
|
||||
- **Parsing and formatting**: Maya provides functions for parsing datetimes from strings and formatting datetimes to strings, making it easy to work with date and time data.
|
||||
- **Manipulation**: Maya allows you to manipulate datetimes by adding or subtracting time intervals, such as days, hours, minutes, and seconds.
|
||||
- **Relative datetimes**: Maya supports working with relative datetimes, such as "tomorrow," "next week," or "last month," making it easy to work with dates in a human-friendly way.
|
||||
|
||||
## Installation
|
||||
|
||||
You can install Maya using pip:
|
||||
|
||||
```bash
|
||||
$ pip install maya
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Here's an example of how you can use Maya to work with datetimes in Python:
|
||||
|
||||
```python
|
||||
import maya
|
||||
|
||||
# Create a datetime object
|
||||
dt = maya.now()
|
||||
|
||||
# Format the datetime as a string
|
||||
formatted_dt = dt.rfc2822()
|
||||
|
||||
print(formatted_dt)
|
||||
```
|
||||
@@ -0,0 +1,7 @@
|
||||
# osx-gcc-installer
|
||||
|
||||
This legacy project is no longer maintained, but at one point it was used to install GCC on OSX.
|
||||
|
||||
It helped inspire the `xcode-select --install` command.
|
||||
|
||||
https://github.com/kennethreitz/osx-gcc-installer
|
||||
@@ -0,0 +1,42 @@
|
||||
# Pipenv
|
||||
|
||||
[Pipenv](https://pipenv.pypa.io/) is a tool for managing Python dependencies. It is a wrapper around pip and virtualenv.
|
||||
|
||||
https://github.com/pypa/pipenv
|
||||
|
||||
|
||||
## Why Use Pipenv?
|
||||
|
||||
- **Unified Workflow:** Pipenv streamlines the process of managing your project's dependencies and virtual environments into a single command-line tool, making it easier to keep everything organized.
|
||||
|
||||
- **Automatic Virtual Environments:** When you install a package, Pipenv automatically creates a virtual environment and installs your packages within it, keeping your global Python environment clean.
|
||||
|
||||
- **Lockfiles for Deterministic Builds:** Pipenv uses a `Pipfile` to specify your dependencies and a `Pipfile.lock` to lock them down. This ensures that you and your team always install the exact same versions, minimizing the "works on my machine" problem.
|
||||
|
||||
- **Enhanced Security:** By leveraging hash verification, Pipenv ensures that the packages you install are secure and haven't been tampered with.
|
||||
|
||||
- **Simplified Dependency Management:** Pipenv abstracts away the complexity of managing dependencies, making it easier for developers to focus on writing code instead of wrestling with dependency issues.
|
||||
|
||||
## Key Features
|
||||
|
||||
- **Pipfile and Pipfile.lock:** These files replace the traditional `requirements.txt`, offering a more readable and secure way to manage dependencies.
|
||||
- **Automatic environment management:** Automatically create and manage a virtual environment for your project.
|
||||
- **Seamless integration:** Works perfectly with Python's `pip` and `virtualenv`, making it an easy transition for users familiar with these tools.
|
||||
- **Cross-platform support:** Pipenv works across all major platforms, ensuring a consistent experience for all developers.
|
||||
|
||||
## Get Started with Pipenv
|
||||
|
||||
To get started with Pipenv, simply install it using `pip`:
|
||||
|
||||
```bash
|
||||
$ pip install pipenv
|
||||
```
|
||||
|
||||
After installation, you can create a new project, install dependencies, and start working in an isolated environment:
|
||||
|
||||
```bash
|
||||
$ pipenv install requests
|
||||
$ pipenv shell
|
||||
```
|
||||
|
||||
Pipenv will handle the rest, from setting up the environment to locking your dependencies. Whether you are a seasoned Python developer or just getting started, Pipenv simplifies your workflow, allowing you to focus on what truly matters—building great software.
|
||||
@@ -0,0 +1,20 @@
|
||||
# PyTheory: Music Theory for Humans
|
||||
|
||||
[`pytheory`](https://github.com/kennethreitz/pytheory) is a Python library that simplifies working with music theory concepts. It provides a simple and intuitive interface for representing musical elements such as notes, scales, chords, and intervals, making it easier to work with music theory in Python.
|
||||
|
||||
## Features
|
||||
|
||||
- **Note Representation**: PyTheory allows you to represent musical notes using the standard Western notation (`A`, `Bb`, `C#`, etc.), enabling you to work with notes in different formats.
|
||||
- **Scale Generation**: The library provides functions for generating scales based on different modes, such as major, minor, pentatonic, and blues scales, allowing you to explore different musical scales.
|
||||
- **Chord Construction**: PyTheory supports constructing chords from notes, intervals, or scale degrees, making it easy to create and analyze chords in different keys.
|
||||
- **Interval Calculation**: The library allows you to calculate intervals between notes, enabling you to determine the distance between two pitches in a musical context.
|
||||
|
||||
This project is highly experimental, and is more of a thought exercise than a practical library. It aims to explore how music theory concepts can be represented and manipulated using Python, and to provide a foundation for further research and development in this area.
|
||||
|
||||
## Installation
|
||||
|
||||
You can install `pytheory` using pip:
|
||||
|
||||
```bash
|
||||
$ pip install pytheory
|
||||
```
|
||||
@@ -0,0 +1,7 @@
|
||||
# Records: SQL for Humans
|
||||
|
||||
Records is a library for working with tabular data in Python, accessible via SQL.
|
||||
|
||||
Database support includes RedShift, Postgres, MySQL, SQLite, Oracle, and MS-SQL (drivers not included).
|
||||
|
||||
https://github.com/kennethreitz/records
|
||||
@@ -0,0 +1,24 @@
|
||||
# Requests: HTTP for Humans
|
||||
|
||||
The Requests library is a popular HTTP library for Python. It provides a simple and intuitive interface for making HTTP requests, making it easy to interact with web services and APIs.
|
||||
|
||||
$ uv pip install requests
|
||||
|
||||
This project is downloaded over 20 million times a day, and is widely used in the Python community. It is known for its ease of use and powerful features, making it a go-to choice for developers who need to work with HTTP in their Python projects.
|
||||
|
||||
**Fun fact**: the logo of the Requests project is a tattoo that I have on my right arm.
|
||||
|
||||
## Resources
|
||||
|
||||
- [Requests Documentation](https://docs.python-requests.org/en/master/)
|
||||
- [HTTP Methods](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods)
|
||||
- [HTTP Status Codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
||||
- [HTTP Headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers)
|
||||
|
||||
## Additional Reading
|
||||
|
||||
- [Python for Humans](/talks/python-for-humans)
|
||||
- [Documentation is King](/talks/documentation-is-king)
|
||||
- [The Zen of Python](https://www.python.org/dev/peps/pep-0020/)
|
||||
- [PEP 8 - Style Guide for Python Code](https://www.python.org/dev/peps/pep-0008/)
|
||||
- [Python Requests Library: A Guide](https://realpython.com/python-requests/)
|
||||
@@ -0,0 +1,15 @@
|
||||
# Responder: a Familiar Web Framework
|
||||
|
||||
Responder is a web framework for Python. It is highly experimental and is not recommended for production use.
|
||||
|
||||
## The Basic Idea
|
||||
|
||||
The primary concept here is to bring the niceties that are brought forth from both Flask and Falcon and unify them into a single framework, along with some new ideas I have. I also wanted to take some of the API primitives that are instilled in the Requests library and put them into a web framework. So, you'll find a lot of parallels here with Requests.
|
||||
|
||||
- Setting `resp.content` sends back bytes.
|
||||
- Setting `resp.text` sends back unicode, while setting resp.html sends back HTML.
|
||||
- Setting `resp.media` sends back JSON/YAML (`.text`/`.html`/`.content` override this).
|
||||
- Case-insensitive `req.headers` dict (from Requests directly).
|
||||
- `resp.status_code`, `req.method`, `req.url`, and other familiar friends.
|
||||
|
||||
https://github.com/kennethreitz/responder
|
||||
@@ -0,0 +1,39 @@
|
||||
# Tablib: Tabular Datasets
|
||||
|
||||
Tablib is a format-agnostic tabular dataset library, written in Python. It allows you to import, export, and manipulate tabular data sets.
|
||||
|
||||
## Features
|
||||
|
||||
- **Format Agnostic**: Tablib supports a variety of formats, including Excel, CSV, JSON, and YAML, allowing you to work with data in different file types.
|
||||
- **Data Manipulation**: The library provides functions for sorting, filtering, and transforming data sets, enabling you to perform common data operations.
|
||||
- **Import and Export**: Tablib allows you to import data from files or URLs, and export data to different formats, making it easy to work with data from various sources.
|
||||
|
||||
This was one of my first open source projects. The [documentation](https://tablib.readthedocs.io/en/stable/) is extensive and covers all aspects of the library. It was my passion project for a long time.
|
||||
|
||||
## Installation
|
||||
|
||||
You can install Tablib using pip:
|
||||
|
||||
```bash
|
||||
$ pip install tablib
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
The official documentation for Tablib can be found [here](https://tablib.readthedocs.io/en/stable/).
|
||||
|
||||
## Usage
|
||||
|
||||
Here's an example of how you can use Tablib to work with tabular datasets in Python:
|
||||
|
||||
```python
|
||||
import tablib
|
||||
|
||||
# Create a dataset
|
||||
data = tablib.Dataset(headers=["Name", "Age", "City"])
|
||||
for row in [
|
||||
["Alice", 24, "New York"],
|
||||
["Bob", 30, "San Francisco"],
|
||||
["Charlie", 28, "Seattle"],
|
||||
]:
|
||||
data.append(row)
|
||||
@@ -0,0 +1,63 @@
|
||||
# httpbin.org
|
||||
|
||||
[httpbin.org](https://httpbin.org/) is a simple HTTP request and response service. It is a useful tool for testing HTTP clients and debugging webhooks. The service provides a variety of endpoints that return different types of data, such as headers, IP address, and user-agent.
|
||||
|
||||
## Features
|
||||
|
||||
- **HTTP Methods**: httpbin.org supports various HTTP methods, including GET, POST, PUT, DELETE, and PATCH, allowing you to test different types of requests.
|
||||
- **Request Inspection**: The service allows you to inspect the details of the incoming request, such as headers, query parameters, and body content.
|
||||
- **Response Formats**: httpbin.org can return responses in different formats, such as JSON, HTML, and images, enabling you to test how your client handles different content types.
|
||||
- **Status Codes**: The service can return specific HTTP status codes, such as 200 OK, 404 Not Found, and 500 Internal Server Error, allowing you to test error handling in your client.
|
||||
- **Authentication**: httpbin.org supports basic authentication, allowing you to test how your client handles authenticated requests.
|
||||
- **Dynamic Data**: The service can generate dynamic data, such as random JSON responses or images of a specified size, enabling you to test edge cases in your client.
|
||||
|
||||
## Running with Docker
|
||||
|
||||
You can also run httpbin.org locally using Docker. First, pull the httpbin image from Docker Hub:
|
||||
|
||||
```bash
|
||||
$ docker pull kennethreitz/httpbin
|
||||
```
|
||||
|
||||
Then, run the httpbin container:
|
||||
|
||||
```bash
|
||||
$ docker run -p 80:80 kennethreitz/httpbin
|
||||
```
|
||||
|
||||
This will start the httpbin service on port 80 of your local machine, allowing you to interact with it using your HTTP client of choice.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
You can interact with httpbin.org using various HTTP clients, such as cURL, Python requests, or Postman. Here are some examples of how you can use the service:
|
||||
|
||||
### GET Request
|
||||
|
||||
To make a GET request to httpbin.org, you can use cURL:
|
||||
|
||||
```bash
|
||||
$ curl https://httpbin.org/get
|
||||
```
|
||||
|
||||
This will return a JSON response containing details of the request, such as headers, origin, and URL.
|
||||
|
||||
### POST Request
|
||||
|
||||
To make a POST request to httpbin.org with data, you can use cURL:
|
||||
|
||||
```bash
|
||||
$ curl -X POST https://httpbin.org/post -d "key1=value1&key2=value2"
|
||||
```
|
||||
|
||||
This will return a JSON response containing the data you posted.
|
||||
|
||||
### Authentication
|
||||
|
||||
To make an authenticated request to httpbin.org, you can use cURL with basic authentication:
|
||||
|
||||
```bash
|
||||
$ curl -u username:password https://httpbin.org/basic-auth/username/password
|
||||
```
|
||||
|
||||
This will return a JSON response indicating whether the authentication was successful.
|
||||
@@ -0,0 +1,12 @@
|
||||
# pep8.org
|
||||
|
||||
[pep8.org](https://pep8.org/) is a website for the Python community to read PEP 8, the official Python style guide.
|
||||
|
||||
- Beautiful is better than ugly.
|
||||
- Explicit is better than implicit.
|
||||
- Simple is better than complex.
|
||||
- Complex is better than complicated.
|
||||
|
||||
Enjoy coding!
|
||||
|
||||
https://pep8.org
|
||||
@@ -0,0 +1,12 @@
|
||||
# python-guide.org
|
||||
|
||||
[`python-guide.org`](https://python-guide.org/) is a comprehensive guide to Python programming, covering topics such as best practices, code style, and project structure. The guide aims to provide developers with a set of guidelines and recommendations for writing clean, readable, and maintainable Python code.
|
||||
|
||||
## O'Reilly Book
|
||||
|
||||
The website was converted into a book published by O'Reilly Media, titled "The Hitchhiker's Guide to Python."
|
||||
|
||||
The book covers a wide range of topics, including Python installation, virtual environments, package management, testing, documentation, and deployment. It serves as a valuable resource for both beginner and experienced Python developers looking to improve their coding practices and workflows.
|
||||
|
||||
- [Buy on Amazon](https://amzn.to/3SMIm3T)
|
||||
- [Read Online](https://python-guide.org/)
|
||||
@@ -0,0 +1,10 @@
|
||||
# strainsdb.org
|
||||
|
||||
|
||||
[`strainsdb.org`](https://strainsdb.org/) is a simple Django app that contains information about various strains of cannabis. It was made as a proof of concept for using AI to generate content for a website.
|
||||
|
||||
The app allows users to browse different strains, view details about each strain, and search for specific strains based on their characteristics.
|
||||
|
||||
Each strain also contains terpene information, which is extracted from `gpt-3.5` using [instructor](https://python.useinstructor.com) and stored in SQLite.
|
||||
|
||||
https://strainsdb.org/
|
||||
Reference in New Issue
Block a user