This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from setuptools import setup | |
if __name__ == "__main__": | |
def has_requirement(x: str) -> bool: | |
x = x.strip() | |
if x.startswith("#"): | |
return False | |
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any, Literal | |
def is_literal(literal_type: type, value: Any) -> bool: | |
"""Returns True iff the `value` is a variant of the input `literal_type`. False otherwise. | |
Raises a `ValueError` iff the input `literal_type` is not a `typing.Literal`. | |
""" | |
if not hasattr(literal_type, '__origin__') or literal_type.__origin__ != Literal: | |
raise ValueError(f"Expecting literal type, not {literal_type=}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
#################################################################### | |
# | |
# Reusable functions for creating a local temporary directory: | |
# - [mk_tmp_dir] create local directory with unique name | |
# - [cleanup] add exit trap to rm this directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
apt update | |
# | |
# install lmdb | |
# | |
apt install -y liblmdb-dev | |
LMDB_FORCE_SYSTEM=1 LMDB_FORCE_CFFI=1 pip install cffi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# syntax=docker/dockerfile:1.3 | |
ARG UBUNTU_VERSION=18.04 | |
ARG CUDA_VERSION=11.3.1 | |
# Or use a different image. | |
FROM nvidia/cuda:${CUDA_VERSION}-cudnn8-devel-ubuntu${UBUNTU_VERSION} | |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | |
# # | |
# system packages # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import pandas as pd | |
now = datetime.now() | |
df = pd.DataFrame.from_dict( | |
{ | |
"created_at": pd.Series([now, now - timedelta(seconds=100), now + timedelta(seconds=10)], dtype='object'), | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from abc import ABC | |
from dataclasses import dataclass | |
from typing import List, NamedTuple, Sequence, Type, TypeVar | |
import pandas as pd | |
__all__: Sequence[str] = ( | |
# main abstraction & utilities for columns required in a dataframe | |
"Columns", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run this example: | |
# | |
# mysecret=SECRET_VALUE docker build --secret id=mysecret,env=mysecret -f Dockerfile -t deleteme . | |
# | |
FROM debian:trixie-slim | |
RUN <<EOF cat >> file | |
#!/bin/bash | |
if [[ -z "\${MYSECRET}" ]]; then | |
echo "No MYSECRET env var!!!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[build-system] | |
requires = ["setuptools", "wheel", "setuptools_scm"] | |
build-backend = "setuptools.build_meta" | |
[project] | |
name = "mypackage" | |
requires-python = ">=3.10" | |
dynamic = ["dependencies"] | |
[tool.setuptools.dynamic] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nvidia/cuda:11.7.1-devel-ubuntu22.04 | |
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ | |
apt-get install -y software-properties-common && \ | |
add-apt-repository -y ppa:deadsnakes/ppa && \ | |
apt-get install -y \ | |
python3-setuptools python3-dev swig \ | |
wget git unzip tmux vim tree xterm \ | |
build-essential gcc \ |
NewerOlder