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
repos: | |
- repo: https://github.com/psf/black | |
rev: 23.1.0 | |
hooks: | |
- id: black | |
args: [--config=./pyproject.toml] | |
- repo: https://github.com/python-poetry/poetry | |
rev: 1.3.0 | |
hooks: | |
- id: poetry-check |
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
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: cockroachdb | |
spec: | |
selector: | |
app: cockroachdb | |
type: ClusterIP | |
ports: |
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
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: postgres | |
spec: | |
selector: | |
app: postgres | |
ports: | |
- port: 5432 |
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
# Builder container uses pdm to install dependencies | |
FROM python:3.10 AS builder | |
ENV PDM_VERSION=1.13.4 | |
WORKDIR /build | |
COPY pdm.lock pyproject.toml ./ | |
RUN python -m pip install --upgrade pip setuptools wheel | |
RUN pip install pdm && pdm install --prod --no-lock --no-editable |
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
[tool.black] | |
line-length = 100 | |
include = '\.pyi?$' | |
exclude = ''' | |
/( | |
\.git | |
| \.mypy_cache | |
| \.tox | |
| \.venv | |
| venv |
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
[flake8] | |
# Specify a list of codes to ignore. | |
ignore = | |
E203, # whitespace before ‘:’ (conflicts with black) | |
E501, # line too long (black will fix this) | |
W503, # line break before binary operator (conflicts with black) | |
F821, # undefined name error, (bug in pyflakes) | |
max-line-length = 100 | |
max-complexity = 12 | |
# Specify the list of error codes you wish Flake8 to report. |
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
# Apply to all files without committing: | |
# pre-commit run --all-files | |
# Update this file: | |
# pre-commit autoupdate | |
repos: | |
# format markdown files | |
- repo: https://github.com/pre-commit/mirrors-prettier | |
rev: "v2.6.1" | |
hooks: |
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
prefixes = ["", "SCHEMA_REGISTRY", "SCHEMA_REGISTRY_SCHEMA_REGISTRY"] | |
middle = ["CONFLUENT", "KAFKASTORE", "ACL", "TOPIC"] | |
suffix = ["GROUP_ID", "GROUPID", "CONSUMER_GROUP_ID", "CONSUMER_GROUPID", "GROUP"] | |
from itertools import permutations | |
middle_choices = [] | |
for a in range(len(middle)+1): |
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
# Significantly reduces the size of the repository | |
# The scripts can be converted back into notebooks, but the cache will be lost | |
# Excludes the directory ./venv and any directory with a . prefix such as .git | |
# Converts all jupyter notebooks to python scripts recursively starting from $(pwd) | |
find . -path ./venv -prune -false -o -name '*.ipynb' | xargs -0 jupyter nbconvert --to script |
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
def datetime_to_string(df): | |
""" | |
Convert all datetimes to strings in a dataframe. | |
Assumes dates are all timezone aware. | |
""" | |
datetime_columns = df.select_dtypes(include="datetimetz").columns.to_list() | |
for col in datetime_columns: | |
df[col] = df[col].dt.strftime(date_format="%Y-%m-%dT%H:%M:%S%z") | |
return df |
NewerOlder