IT systems · Practical guide

Python and Jupyter validation for GxP use

A Python notebook works on the developer's computer. After a package update it returns a different result, or the visible table is left over from an earlier run. For quality decisions, trace the full analytical process from input through the execution environment to the approved result.

Table of contents

At a glance

How do you validate Python and Jupyter for GxP analyses?

Validate the specific analysis workflow for its intended use. Define the interpreter, packages, configuration, source data and calculation rules. Test results against independent references, including failure and boundary cases. For Jupyter, check consistency between execution order, kernel state and stored outputs. Preserve the link between code version, environment, data, run and result.

The application is the object of the assessment

Python is a programming language and a runtime environment. Jupyter provides an interactive work environment. This does not imply a general GxP release or a blanket prohibition. What matters is whether the specific process is appropriate for its intended use. An exploratory notebook during development serves a different purpose than a released procedure used for calculating a batch-specific quality metric. Describe this decision and its potential consequences if misapplied.

At the system boundary, there are more components than the lines of code written in-house: interpreter, libraries, operating system, database drivers, import logic, configuration, user rights, and output pathways. An external scheduler or a cloud platform may also be relevant. Assess components based on their impact on the outcome. Classifying a library does not automatically address how an individually developed calculation method should be validated. The presence of an existing R or Excel validation does not substitute for a Python validation.

Sources: [1]

The evaluation rule shall be demonstrably definable.

Define the intended workflow such that two individuals can independently review and verify the same assessment. Which fields are processed? What units, limits, and exclusion rules apply? How are missing values, repeated measurements, and duplicates handled? What does the result mean in a technical and scientific context? Clearly define when no usable result may be generated. A program that silently interprets an unknown unit text as a default unit may pass technical validation but produce incorrect scientific results.

Separate data selection, calculation, and decision-making. A correct mean derived from an inappropriate population remains unusable. The specification should therefore include the data status, selection filters, and handling of corrected records. Explicitly define the required accuracy and rounding time point. An rounded display value is not necessarily the value upon which a limit should be assessed. Test both levels against the released rule.

Define package and runtime control criteria

The pip documentation distinguishes version binding, hash checking and the provision of installation packages. In addition to direct packages, take into account their dependencies. A stored package name without version does not hold the actual used status. Hashes support the comparison of delivered files; they prove neither technical correctness nor security of all package functions. Installation packages can also be bound to operating system and architecture.

A dedicated environment suite can consolidate interpreter version, package list, relevant system libraries, configuration, and installation verification. Crucially, it must enable the targeted reproduction and identification of the released environment. Validate this reconstruction on a controlled target environment. A version log from the developer's workstation alone does not guarantee that a subsequent user or machine can obtain the required environment. Document external services whose behavior may change independently of the local package list.

Sources: [2] [3]

Jupyter: Visible code and actual state

A notebook enables interactive work. Cells can be re-executed or rearranged during development. Stored outputs may reflect a different development state than the currently visible code. Therefore, for a released run, a defined initial state and controlled execution are required. Verify that the workflow completes fully when initiated with a fresh kernel start using the specified inputs. Variables from a prior experiment must not influence the results.

nbconvert supports programmatic execution and various error handling mechanisms. The allow_errors option enables continuation despite execution errors. Therefore, a fully completed output document does not constitute sufficient evidence of successful execution. Verify the actual execution status, error messages, and completeness of expected results. Establish a clear distinction between intentionally anticipated error tests and unexpected execution halts. A test report must not represent a partially executed run as a fully passed computation.

Sources: [4]

Example: Correctly combine concentrations

An independent exercise process conducts three measurements: 0.8 mg/ml, 900 µg/ml, and 1.0 mg/ml. The defined target unit is mg/ml. After correct unit conversion, the values become 0.8, 0.9, and 1.0; their arithmetic mean is 0.9 mg/ml. Simply averaging the numerical values yields approximately 300.6. This is not a minor rounding error—it represents a different interpretation. Determine the reference independently of the conversion code under evaluation and maintain the original units throughout.

Expand the same case deliberately: The second row has an empty unit, a sample appears twice in import, and a result was retrospectively corrected. The expected reaction is defined prior to each test. A missing value may not be included as zero in the mean without a release rule. The following work aid is a methodological suggestion. It does not establish universal regulatory tolerances and does not replace professional determination of your actual calculation.

Test cases for the concentration calculation
Test caseIndependently established expectationEvidence needed
Mixed units in the reference set 0.9 mg/ml according to the established conversion Incoming batch, conversion and unrounded result
Unit left blank Defined rejection or approved treatment Error status and restricted use of results
Duplicate sample ID No undetected double weighing Identity verification and documented procedure
Fresh Kernel Result without hidden prior variables is reproducible Fully controlled run
Errors in middle cell No overall status deemed misleading or misleadingly presented Run status and identification of incomplete output
New package version Impact assessed before release Change reference and corresponding regression tests

References, Edge Cases and Error Detection

Select reference data based on the actually used functions. For group formation, multiple groups with similar naming conventions are required. For time filtering, data sets before, at, and after the boundary must be provided. For linkages, both missing and duplicate key values are needed. Test not only a convenient normal case. A small, deliberately constructed reference population can initially better explain the logic than a large production sample lacking independently known expectations.

Also assess the test method. Does the comparison detect an intentionally swapped unit text or a missing result line? Shared auxiliary functions between production and reference calculations may introduce the same error on both sides. For critical references, employ an appropriate independent calculation pathway. For numerical methods, justify tolerances based on the method and intended use. Exact bit-level equality is not appropriate for all calculations; however, broad tolerances must not conceal professionally relevant deviations.

Link the result, run and approval

A traceable results package identifies input data, code version, environment, parameters, run timestamp, status, and responsible review. Consider the actual electronic original information. A PDF containing a graphic cannot automatically replace the full context of a complex analysis. Define which files, logs, and metadata are required for future reconstruction. Additionally, describe how modifications to previously reviewed results remain detectable.

Version control supports the assignment of code changes. However, it is not automatically a complete technical audit trail for all data inputs and execution actions. Similarly, a successful automated test run does not constitute approval of the results. Roles, access, review, and release are designed appropriately to the process. Avoid a model in which the same user can unobservedly exchange input data, code, and final release file.

Sources: [1] [5]

Manage changes and ongoing usage

A change may originate from own code, a package, the data source, or the infrastructure. Assess the impact on the released statement. For example, a new file export may alter data types and column names, even if the Python code remains unchanged. A package update may introduce different default values. Describe which checks are triggered by each type of change and which validation evidence remains applicable without modification. A blanket, complete restart after every change is no more justified than unreviewed continued operation.

Train users within the limits of the released process. Exploration, development and regular result generation should have distinctly different states. A manually repaired notebook cell does not belong tacitly in the next routine report. If a processing fails, cause, affected results and repetition are treated comprehensiblely. A viable python process can be used in everyday life: the team recognizes its status, its limitations and the next allowed step.

Project experience and collaboration

Verify a calculation against its data, code and expected values

We start with a known analysis result. Process owners connect the data, code and calculation rule, while IT identifies the interpreter, packages and runtime environment. One script may need a straightforward test and approval process. Linked notebooks and changing datasets also require a record of execution order and runtime state. Together, we prepare independent expected values and failure cases. A later reviewer should be able to link the tested run to its inputs and code version.

Frequent Questions on Python and Jupyter Validation

Must Python as a programming language be fully validated?

The specific intended use and the associated process determine the scope of validation evidence. Assess the runtime, components, and inherent functions based on their impact. A generic evaluation of every Python function would neither represent your actual system nor serve as a reliable substitute for robust testing of quality-critical applications.

Sources: [1]

Does a requirements.txt file suffice for a reproducible environment?

Not solely. The file must appropriately specify the required package version; interpreters, system libraries, configuration, and other dependencies may also be relevant. Verify the actual reconstitution. A stored environment report supports traceability but neither proves complete installation nor demonstrates functional equivalence.

Sources: [2]

Is a successful notebook export considered a valid run?

Not automatically. An export may contain stored outputs or arise despite authorized errors. Review the controlled execution, all required results, and the actual error status. The procedure must detect incomplete or inconsistent outputs and prevent unverified use of such outputs.

Sources: [4]

Do we need separate tests for each library function?

The scope is derived from the employed function and its failure consequences. Test your relevant processing, including the necessary component usage. Supplier certifications and available information can support the assessment. A lengthy list of tested functions is less meaningful than verifiable evidence of the actual calculation pathways required.

Must a result produce exactly the same bits each time it is repeated?

For numerical methods, professionally justified tolerances and acceptable variations may be appropriate. Define which deviation remains acceptable for the intended conclusion and specify the rounding approach. Procedures with random dependencies require additional specifications. A tolerance must not mask relevant errors; technically unnecessary bit-level equality should not unjustifiably reject correct results.

Can Git replace release and audit trail functions?

Version control documents specific changes to the managed inventory. It does not automatically capture all data entries, executions, and technical decisions. Review the required audit trail, roles, and release authorizations. Suitability arises from the controlled overall process and not solely from the use of a particular tool.

Sources: [5]

Sources and review date

Status: October 15, 2026. Regulatory classification and manufacturer responsibilities are separately documented. Examples, test matrices, and templates are standalone reference tools; they are customized for actual usage purposes.

  1. European Commission: EU GMP Annex 11, Computerised Systems (2011)Current version as per EudraLex inventory as of 15.10.2026. Application, risks, operation, and data lifecycle; specific testing proposals are derived independently.
  2. pip: Repeatable InstallsVersion binding, transitive dependencies, hashes, and platform limits of installation bundles. No GxP certification.
  3. pip: Secure installsHash-checking requires complete dependency tracing; technical integrity control does not replace a professional assessment.
  4. Jupyter nbconvert: Executing notebooksReference documentation nbconvert 7.14.1: programmatic execution and allow_errors. Additionally verify the actually used product version.
  5. PIC/S: PI 041-1, Good Practices for Data Management and Integrity (2021)Inspection Guidance on Data Integrity; in particular electronic data, transmission, access, and review.

Sources checked: .

Daniel Herrmann, Daniel Herrmann Consulting

Daniel Herrmann Consulting

How we can support you

Daniel Herrmann Consulting combines professional assessment with hands-on work on the specific system. During the first meeting, we clarify your intended use, existing documentation, and the next most appropriate action step.

  • Computer system validation →

    Bring your GxP systems into validated operation, from laboratory software, MES and eQMS to ERP. We define the scope, plan risk-based tests using GAMP 5 and hand the evidence to QA for release.

Send a project enquiry Customer testimonials →