Manuel B. Garcia

Manuel B. Garcia serves as the Senior Director for Educational Technology and Digital Learning at FEU Institute of Technology, Manila, Philippines. Read More

Contact Info

1607, FEU Tech Building,
P. Paredes St, Sampaloc,
Manila, Philippines
mbgarcia@feutech.edu.ph

Follow Me

Can Generative AI Help Document Research Code Dependencies?

Generative AI can help researchers identify, organize, and explain software dependencies, but source-code inspection alone cannot reveal every requirement. Learn how to create accurate dependency documentation that supports maintenance, collaboration, and computational reproducibility.

733
Using AI to Document Research Code Dependencies Guide 733 of 1196
01 · The Question

Can AI Identify and Explain Everything Your Research Code Depends On?

You have a collection of Python scripts developed over several months, partly with generative AI assistance. Some functions import statistical packages, others read configuration files, and one calls an external program installed separately on your computer.

The scripts work, but the project contains no clear record of which software components are required or why they are needed. A collaborator wants to run the analysis and asks for a dependency list.

You consider asking AI to inspect the code and document its dependencies. Can it reliably identify the necessary packages, distinguish essential requirements from incidental installations, and produce documentation another researcher can use?

02 · The Short Answer

AI Can Help Document Dependencies, but Its Inventory Must Be Verified

In Brief

Generative AI can help researchers document software dependencies by examining source code, identifying apparent package requirements, explaining their roles, and organizing verified dependency information into readable documentation. However, AI cannot reliably identify every dependency or establish exact installed versions from source code alone.

Accurate dependency documentation should combine code inspection with package-manager records, environment metadata, build configurations, and actual execution tests. AI is most useful for interpreting and organizing this evidence, while researchers remain responsible for verifying that the documentation accurately describes the computational workflow.

03 · What You Need to Know

What Researchers Should Document About Software Dependencies

What Is a Software Dependency in Research Code?

A software dependency is a component that a program requires to execute or perform a particular function.

Dependencies may include programming-language packages, libraries, external executables, runtime systems, application programming interfaces, and system-level components.

For example, a Python script might use pandas to manipulate tabular data, NumPy for numerical operations, and statsmodels to estimate statistical models. Another script might call an external executable that must be installed separately.

Research software can also depend on configuration files, data schemas, credentials, and external services. These are not all software packages, but they may be necessary for the workflow to operate correctly.

Dependency documentation should therefore describe the relevant requirements of the workflow rather than merely reproduce a list of import statements.

Why Does Dependency Documentation Matter?

Researchers often develop code incrementally. Packages may be installed during debugging, replaced by alternatives, or retained after the functions that required them have been removed.

Over time, the environment can accumulate software that is no longer relevant to the project.

Without clear documentation, collaborators may struggle to determine which components are essential, which versions were used, and which dependencies must be installed before executing the analysis.

Dependency documentation supports reproducibility, maintenance, troubleshooting, and the transfer of research software between collaborators.

It also helps researchers identify potential compatibility problems when packages are updated or moved to another computing environment.

What Is the Difference Between Direct and Transitive Dependencies?

A direct dependency is explicitly required by the research project. A transitive dependency is required by another dependency.

Direct dependency A package or software component that the project explicitly uses or declares as a requirement.
Transitive dependency A package or component required indirectly because another dependency needs it.

For example, a researcher may directly use a statistical package that depends on numerical libraries. Those libraries may be installed automatically even if the research script never imports them.

Transitive dependencies matter because changes in their versions can affect installation compatibility and sometimes computational behavior.

Researchers should distinguish between documenting the packages directly required by the project and preserving the resolved dependency information needed to reconstruct its environment.

What Can AI Identify by Reading Source Code?

AI can inspect import statements, function calls, package references, and configuration files to identify apparent dependencies.

It may also recognize that a particular function belongs to a known software package or that a script calls an external executable.

For example, AI might identify that a Python project imports pandas, SciPy, and matplotlib, then explain how each package contributes to the analysis.

However, source-code inspection has limitations. A package may be imported dynamically, used only under particular conditions, or loaded through a plugin system. External executables may be invoked indirectly.

Furthermore, import names do not always match the names of installable package distributions.

AI can therefore generate a useful preliminary inventory, but the inventory should not be treated as complete without verification.

Why Can't AI Determine Exact Package Versions From Imports?

An import statement identifies a software module, not the version installed when the analysis was executed.

For example, import pandas does not establish whether the researcher used a particular earlier or later release.

AI may suggest versions based on general compatibility knowledge, but those suggestions are not evidence of the historical environment.

Exact versions should be obtained from available package-manager records, lock files, environment exports, or other verified installation metadata.

Where those records are unavailable, researchers should distinguish inferred compatibility requirements from confirmed historical versions.

This distinction is particularly important when creating a reproducible software environment file from incomplete project materials.

What Should a Useful Dependency Inventory Contain?

A dependency inventory should explain more than the names of installed packages.

For consequential software components, useful information may include the package or tool name, its role in the project, the version used, the source of the version information, and any relevant platform requirements.

Dependency information Purpose Possible evidence
Package or tool name Identifies the required component Import statement, configuration file, or package-manager record
Role in the analysis Explains why the dependency is needed Relevant functions and code references
Installed version Supports environment reconstruction Lock file, package inventory, or environment metadata
Dependency relationship Distinguishes direct from transitive requirements Package-manager dependency information
Platform requirements Identifies operating-system or architecture constraints Official installation documentation and system records
External services Documents runtime requirements beyond local packages API documentation, configuration, and execution records
Verification status Indicates whether the requirement was confirmed Installation and execution tests

Not every project needs a separate table containing all these fields. A concise README and machine-readable dependency specification may be sufficient for simpler workflows.

The documentation should be detailed enough for another qualified researcher to understand and reconstruct the relevant computational requirements.

How Can Researchers Verify AI-Suggested Python Dependencies?

Python provides several ways to inspect package installations and dependencies.

The command python -m pip freeze lists installed distributions in the active environment. The command python -m pip show can display information about a specified installed package, while python -m pip inspect provides structured information about the installed environment.

Researchers may also use dependency-management tools that maintain project specifications or lock files.

AI can help interpret these outputs, but the underlying records should come from the actual environment whenever possible.

Researchers should be careful when removing apparently unused dependencies. A package may be required through dynamic imports, optional functionality, or execution paths not evident from a simple code inspection.

Fresh-environment testing is a useful way to determine whether the documented dependencies are sufficient.

How Can Researchers Document Dependencies in R Projects?

R projects may use packages installed through CRAN, Bioconductor, GitHub, or other repositories.

Tools such as renv can record project dependencies and package versions in a lock file, supporting later restoration.

AI may help explain package roles, interpret renv metadata, or identify apparent dependencies in R scripts.

However, the actual dependency record should be checked using the R project and its package-management tools.

Some R packages also require system libraries, compilers, or external software. These requirements may not be fully represented by package names alone.

Researchers should document such requirements when they are necessary for installation or execution.

Should Researchers Document Dependencies That Are No Longer Used?

Not necessarily as active project requirements.

Development environments often contain packages installed for abandoned experiments or earlier versions of the analysis.

A dependency inventory intended to describe the current analytical workflow should distinguish active requirements from historical or unused installations.

However, researchers should avoid removing dependencies solely because AI believes they are unnecessary. Some requirements may be invoked indirectly or only during particular execution paths.

When preparing a clean project specification, researchers can test whether the workflow runs without the suspected dependency.

Historical environment records associated with published results should be preserved separately rather than silently rewritten to reflect a later simplified configuration.

What About Dependencies on External APIs and Online Services?

Some research code relies on services outside the local software environment, including APIs, remote databases, cloud computing services, or hosted machine-learning models.

These dependencies introduce additional reproducibility concerns because the service may change independently of the researcher's code.

Researchers should document the service provider, relevant API or model version when available, required configuration, and the role of the service in the workflow.

Where permitted and appropriate, preserving authorized inputs and outputs can help establish what the external service returned during the original analysis.

Credentials should never be included in publicly shared dependency records. Documentation can identify required environment variables or authentication procedures without exposing secrets.

If an external service is essential to reproducing the analysis, researchers should explain the limitations created by its availability, access conditions, and potential changes.

Can AI Help Identify Dependency Conflicts?

Yes. AI can interpret error messages, compare package constraints, and suggest possible explanations for installation failures.

For example, it may recognize that two packages require incompatible versions of a shared dependency.

However, AI suggestions should be verified using package-manager diagnostics and official documentation. A proposed version combination may be outdated, unavailable, or incompatible with the project's platform.

Researchers should avoid changing dependencies simply to eliminate an installation error without checking whether the revised environment preserves the analytical behavior associated with the original results.

Dependency troubleshooting should therefore include both installation checks and execution tests.

How Should Researchers Document Dependency Updates?

Updating a dependency can change software behavior even when the research code itself remains unchanged.

Researchers should preserve the earlier dependency specification and document significant updates, particularly when they affect analytical calculations or compatibility.

Version control can associate dependency-file changes with the corresponding code revisions.

For consequential updates, researchers should rerun relevant tests and compare the resulting outputs with previously established reference results.

These records support traceable changes to AI-assisted research software and help distinguish environment changes from modifications to analytical logic.

Does Dependency Documentation Make Research Code Reproducible?

Dependency documentation is necessary for many computational workflows, but it is not sufficient on its own.

A complete package inventory cannot compensate for missing input data, undocumented preprocessing, incorrect code, or unavailable external services.

Likewise, a documented environment may install successfully while producing different outputs because of changes in numerical behavior or execution conditions.

Researchers should therefore test whether the documented dependencies support execution of the actual analysis.

The dependency record should be preserved with the code, relevant data specifications, tests, and execution instructions needed for reproducible AI-generated research code.

Should Dependency Documentation Be Archived With the Research Code?

Yes, when the dependencies are necessary to reconstruct the computational workflow.

A research software release should preserve the dependency specifications associated with the code used to produce the reported findings.

Depending on the project, this may include requirements files, lock files, container definitions, documentation of external tools, and relevant environment metadata.

Researchers should distinguish the preserved analytical environment from later development updates.

Long-term archiving of AI-assisted research code should account for the availability of dependencies as well as the source code itself.

04 · A Practical Example

Using AI to Build a Verified Dependency Inventory

Hypothetical Example

Documenting Dependencies in a Python Survey Analysis

A researcher has developed Python scripts for cleaning questionnaire responses, calculating engagement scores, estimating regression models, and generating figures. The project contains several AI-assisted functions but no organized dependency documentation.

Step 1: Inspect the source code

The researcher identifies imports for pandas, NumPy, statsmodels, and matplotlib. One script also invokes an external command-line tool used during data preparation.

Step 2: Obtain environment records

The researcher exports the installed Python package inventory and records the interpreter version. The external executable's version is obtained separately.

Step 3: Ask AI to organize the information

The researcher provides the nonsensitive dependency records and relevant code excerpts. AI drafts a table identifying each apparent direct dependency and its role in the workflow.

Step 4: Verify the inventory

The researcher checks the package names, installed versions, and external tool requirements. Two packages suggested by AI are found to be unnecessary for the current analytical workflow.

Step 5: Test the documented requirements

A collaborator creates a clean environment using the verified specification, installs the external tool, and executes the analytical scripts.

Step 6: Preserve the documentation

The final dependency inventory, machine-readable environment file, code revision, and execution instructions are included in the archived research software release.

AI helped organize and explain the dependencies, but the inventory's reliability came from comparison with actual environment records and successful reconstruction of the workflow.

The example also shows why a dependency list should not be treated as complete merely because it contains every visible import statement.

05 · What Researchers Often Get Wrong

Common Misconceptions About AI-Assisted Dependency Documentation

Misconception

Every Dependency Appears in an Import Statement

Research code may depend on transitive packages, dynamically loaded modules, external executables, and system libraries that do not appear as ordinary imports. Source-code inspection provides only part of the dependency picture.

Misconception

AI Can Determine the Exact Installed Version of a Package From Its Name

A package name or import statement does not establish the historical version used. Researchers should rely on verified environment records rather than AI-generated guesses.

Misconception

A List of Installed Packages Is the Same as a List of Project Requirements

An environment may contain unrelated or obsolete packages. Researchers should distinguish the active requirements of the project from the complete inventory of an existing installation.

Misconception

Transitive Dependencies Do Not Matter Because the Researcher Never Imported Them

Indirect dependencies can affect installation compatibility and computational behavior. Appropriate environment records should preserve enough resolved dependency information for reconstruction.

Misconception

Dependency Documentation Is Complete Once AI Produces a Table

A readable inventory is useful, but it must accurately represent the actual workflow. Researchers should verify the entries and test whether the documented requirements support execution.

Misconception

Updating Dependencies Cannot Change Research Results if the Source Code Is Unchanged

Package updates can modify algorithms, defaults, numerical behavior, or compatibility. Consequential dependency changes should be documented and followed by appropriate testing.

06 · What This Means for You

Let AI Explain Dependencies, but Ground the Documentation in Verified Evidence

Researchers should use AI primarily to interpret, organize, and clarify dependency information obtained from the project and its working environment.

When the original environment is unavailable, AI may help reconstruct candidate requirements, but inferred information should be clearly distinguished from verified historical records.

A simple decision framework

If the working environment is available
Inspect package-manager records and environment metadata before preparing the dependency inventory.
If only source code is available
Use AI to identify apparent dependencies, but verify package names and acknowledge uncertainty about historical versions.
If the workflow uses external executables or services
Document their roles, relevant versions, configuration requirements, and access limitations separately from language packages.
If AI suggests removing an apparently unused dependency
Test the workflow without it before treating the dependency as unnecessary.
If dependencies change after results have been generated
Preserve the earlier environment record and verify whether the updated environment changes analytical behavior.

For relatively simple projects, a concise dependency section in the README and a verified environment file may be sufficient.

For complex workflows, a more detailed inventory can clarify direct and transitive requirements, external tools, and platform-specific constraints.

The objective is to make the research software understandable and executable without depending on the original developer's memory or an AI model's ability to guess the missing environment.

07 · A Quick Checklist

Before Finalizing AI-Assisted Research Dependency Documentation

Check whether the dependency record is accurate and usable:
Identify direct package dependencies from the source code and project configuration.
Inspect package-manager records for installed versions and relevant transitive dependencies.
Verify AI-suggested package names and dependency relationships against authoritative records.
Document external executables, system libraries, and services required by the workflow.
Distinguish active project requirements from unrelated packages installed in the development environment.
Explain the role of consequential dependencies in the analytical workflow.
Preserve verified version information and identify any inferred or uncertain requirements.
Test whether the documented dependencies support execution in a clean environment.
Preserve the dependency records with the exact research code revision and execution instructions.
08 · Frequently Asked Questions

Frequently Asked Questions About AI-Assisted Research Dependency Documentation

Can AI identify all dependencies in a research codebase?

Not reliably from source code alone. AI can identify apparent imports and software requirements, but dynamic dependencies, external tools, system libraries, and transitive packages may require package-manager records and execution-based verification.

Can AI determine which Python packages a research script needs?

AI can identify likely packages from imports and function calls, but researchers should verify package distribution names, versions, and indirect requirements against the working environment and official documentation.

What is the difference between direct and transitive dependencies?

Direct dependencies are explicitly required by the project. Transitive dependencies are required indirectly by other packages. Both can matter when reconstructing the computational environment.

Should researchers document every installed package?

A complete environment inventory may be useful for reconstruction, but project documentation should distinguish essential requirements from unrelated installations. The appropriate detail depends on the environment-management strategy.

Can AI explain dependency conflicts in Python or R?

Yes. AI can interpret error messages and suggest possible causes, but proposed solutions should be checked using package-manager diagnostics and official documentation before dependencies are changed.

Do external APIs count as research software dependencies?

They can be important runtime dependencies when the analysis requires them. Researchers should document the relevant service, version or endpoint information, configuration, and access limitations without exposing credentials.

Does documenting dependencies make research code reproducible?

Dependency documentation supports reproducibility but is not sufficient by itself. Researchers also need the relevant code, data, execution instructions, and evidence that the reconstructed workflow produces consistent results.

Should dependency records be archived with published research code?

Yes, when they are necessary to reconstruct the analysis. Verified environment files, lock files, external software requirements, and related documentation should be preserved with the corresponding analytical release.

09 · The Bottom Line

AI Can Organize Dependency Knowledge, but It Cannot Replace Environment Evidence

The Bottom Line

Generative AI can help researchers identify, explain, and document software dependencies, but accurate dependency records must be grounded in verified package information, project configurations, and actual execution requirements rather than inferred from source code alone.

The most useful documentation explains what the research software requires, why those dependencies matter, and how the environment can be reconstructed. AI can make that documentation easier to prepare, while verification and preservation remain essential to computational reproducibility.

10 · Sources and Further Reading

Authoritative Resources on Research Software Dependencies

11 · Cite this Guide

How to Cite This Guide

This guide is intended to be read, shared, and used in research, teaching, and academic work. If you draw on its ideas, explanations, or other content, please acknowledge the source by citing the guide. Doing so gives appropriate credit and helps your readers locate the original resource.

Has the Field Guide helped your research?

If a guide helped clarify a question, inform a research decision, or move your work forward, I would love to hear about your experience. Your story may also help other researchers discover the Field Guide.

Share Your Experience
Takes only a few minutes