diff --git a/lib/modules/manager/poetry/artifacts.ts b/lib/modules/manager/poetry/artifacts.ts
index 8f1a225c8bf098698e07e1e14a300cf32735bbd0..8755936e3c91abab063be0a678237c560e9e3231 100644
--- a/lib/modules/manager/poetry/artifacts.ts
+++ b/lib/modules/manager/poetry/artifacts.ts
@@ -20,20 +20,15 @@ import { PypiDatasource } from '../../datasource/pypi';
 import { dependencyPattern } from '../pip_requirements/extract';
 import type { UpdateArtifact, UpdateArtifactsResult } from '../types';
 import { Lockfile } from './schema';
-import type { PoetryFile, PoetryLock, PoetrySource } from './types';
+import type { PoetryFile, PoetrySource } from './types';
 
 export function getPythonConstraint(
   existingLockFileContent: string
-): string | undefined | null {
-  try {
-    const data = parse(existingLockFileContent) as PoetryLock;
-    if (is.string(data?.metadata?.['python-versions'])) {
-      return data?.metadata?.['python-versions'];
-    }
-  } catch (err) {
-    // Do nothing
-  }
-  return undefined;
+): string | null {
+  return Result.parse(
+    existingLockFileContent,
+    Lockfile.transform(({ pythonVersions }) => pythonVersions)
+  ).unwrapOrNull();
 }
 
 const pkgValRegex = regEx(`^${dependencyPattern}$`);
@@ -112,11 +107,9 @@ function getPoetrySources(content: string, fileName: string): PoetrySource[] {
   return sourceArray;
 }
 
-function getMatchingHostRule(source: PoetrySource): HostRule {
-  const scopedMatch = find({ hostType: PypiDatasource.id, url: source.url });
-  return is.nonEmptyObject(scopedMatch)
-    ? scopedMatch
-    : find({ url: source.url });
+function getMatchingHostRule(url: string | undefined): HostRule {
+  const scopedMatch = find({ hostType: PypiDatasource.id, url });
+  return is.nonEmptyObject(scopedMatch) ? scopedMatch : find({ url });
 }
 
 function getSourceCredentialVars(
@@ -127,7 +120,7 @@ function getSourceCredentialVars(
   const envVars: Record<string, string> = {};
 
   for (const source of poetrySources) {
-    const matchingHostRule = getMatchingHostRule(source);
+    const matchingHostRule = getMatchingHostRule(source.url);
     const formattedSourceName = source.name
       .replace(regEx(/(\.|-)+/g), '_')
       .toUpperCase();
@@ -142,6 +135,7 @@ function getSourceCredentialVars(
   }
   return envVars;
 }
+
 export async function updateArtifacts({
   packageFileName,
   updatedDeps,
diff --git a/lib/modules/manager/poetry/types.ts b/lib/modules/manager/poetry/types.ts
index 0c2eaa792548a4881266937b1866230501efb792..d88e278b78dbacec3a62ecf44cceab1065ef683e 100644
--- a/lib/modules/manager/poetry/types.ts
+++ b/lib/modules/manager/poetry/types.ts
@@ -37,11 +37,3 @@ export interface PoetryLockSection {
   name?: string;
   version?: string;
 }
-
-export interface PoetryLock {
-  metadata?: {
-    'lock-version'?: string;
-    'python-versions'?: string;
-  };
-  package?: PoetryLockSection[];
-}