Skip to content

Instantly share code, notes, and snippets.

View phillipuniverse's full-sized avatar

Phillip Verheyden phillipuniverse

View GitHub Profile
@phillipuniverse
phillipuniverse / README.md
Created December 1, 2024 19:17
Attempt at monkeypatching FastAPI to work with pydantic.v1 package when Pydantic v2 is installed

An incomplete attempt at trying to allow pydantic.v1 models in FastAPI. My overall conclusion is this is probably a waste of time and too risky, likely adds more risk and takes more time than modifying all models to work with Pydantic v2. There are too many edge cases with FastAPI usage of the global fastapi._compat.PYDANTIC_V2 variable which gets resolved at import time.

Versions

FastAPI 0.115.5 and Pydantic 2.10.2

Usage

Invoke patch_v2_compat() before you do anything with the FastAPI application (like adding routes):

@phillipuniverse
phillipuniverse / README.md
Last active December 4, 2022 15:19
OpenTelemetry bridge to Datadog Profiler

Supporting code for some exploration on DataDog/dd-trace-py#3819.

Attempted in the context of a Django app. The settings.py file corresponds to the main Django settings.py, but code should be able to be extracted out to other library entrypoints.

@phillipuniverse
phillipuniverse / CODEOWNERS
Last active August 1, 2022 18:25
Rollbar forward to
/basedir/documents/ @myorg/squad1
/basedir/documents/otherplace @myorg/squad1
/basedir/ui/ @myorg/squad3
/basedir/preferences/ @myorg/squad2
package org.broadleafoverrides.config;
import com.broadleafcommerce.solr.autoconfigure.SolrProperties;
import com.broadleafcommerce.solr.autoconfigure.SolrServer;
import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecutor;
import org.apache.commons.exec.Executor;
import org.apache.commons.exec.PumpStreamHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
[MASTER]
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
extension-pkg-whitelist=
# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS
server:
port: 8443
ssl:
key-password: keypass
key-store: classpath:local.keystore
key-store-password: storepass
@phillipuniverse
phillipuniverse / DemoApplication.java
Last active January 10, 2023 14:57
JUnit 5 integration test with Spring Cloud Stream and embedded Kafka
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Input;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.SubscribableChannel;
[WARNING] The requested profile "SNAPSHOTS" could not be activated because it does not exist.
[ERROR] Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:1.21.1:check (check) on project broadleaf-auth-services-samples-main: Execution check of goal com.diffplug.spotless:spotless-maven-plugin:1.21.1:check failed: Unable to load the mojo 'check' (or one of its required components) from the plugin 'com.diffplug.spotless:spotless-maven-plugin:1.21.1': com.google.inject.ProvisionException: Unable to provision, see the following errors:
[ERROR]
[ERROR] 1) Error injecting: private org.eclipse.aether.spi.log.Logger org.apache.maven.repository.internal.DefaultVersionRangeResolver.logger
[ERROR] while locating org.apache.maven.repository.internal.DefaultVersionRangeResolver
[ERROR] while locating java.lang.Object annotated with *
[ERROR] at org.eclipse.sisu.wire.LocatorWiring
[ERROR] while locating org.eclipse.aether.impl.VersionRangeResolver
[ERROR] for parameter 2 at org.eclipse.aether.internal.impl.De
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@phillipuniverse
phillipuniverse / Dockerfile
Created July 26, 2018 13:25
Spring Boot exectuable jar Dockerfile with JAVA_OPTS, debugging and JRebel support
# Used as a base image that other Spring Boot-based
# docker containers can be based off of. Example dependent Dockerfile:
#
# FROM <this-image>
# ADD target/myjar.jar /app.jar
#
# Alternatively, you can modify this file to use a build arg:
# ...
# ...
# ARG JAR_FILE