A data science notebook can easily contain hundreds of lines of Python code, a well-crafted model, and a nicely plotted set of charts. For anyone learning data science with python, this kind of notebook can represent a complete analytical workflow.
However, the line that carries the maximum hidden liabilities is the very first one:
pip install …
And all it takes is a few lines of Python to create an impressive analytical tool. This convenience comes at the cost of relying on code created and distributed by people the analyst does not know.
This is why it deserves more attention, especially in light of the incident at the beginning of the year.
More than 119,000 downloads before quarantine
More than 119,000 downloads occurred before the quarantine was triggered.
In March 2026, the frequently used packages LiteLLM and Telnyx contained malicious code in their releases as part of a software supply chain attack.
According to the official incident report from PyPI, the malicious packages were capable of executing code during installation, collecting files, and even attempting to send the collected information to an external source. In total, while the LiteLLM versions were available, more than 119,000 versions of them were downloaded.
It was particularly alarming that, besides creating suspiciously named packages, attackers had included malicious code in already used packages.
The lesson for data scientists is to exercise caution.
The installation of any Python dependency also implies the execution of other people’s software. This is an important consideration for anyone pursuing data science with python, where Python dependencies are a regular part of analytical work.
The same command can produce a different environment next month
Imagine a project that you can put on GitHub that you worked on within your course portfolio.
In the present, everything is going well with the notebook. In six months someone else clones it and installs the dependencies.
Will they get the exact software that you installed?
Possibly not, if there are no strict controls over the installation.
According to PyPI’s security team, without a lock file, dependencies can be installed in a way that allows them to receive new code from PyPI upon reinstallation. Lock files are encouraged to maintain security and reproducibility.
For anyone studying data science through Python, this is important regardless of whether they plan to work in cybersecurity. Data science with python also requires an environment that can be reproduced consistently when the project is shared or revisited.
The behavior of a newer library version might be different.
A dependency might no longer exist.
APIs can be deprecated.
A result copied and reproduced flawlessly might raise an error (surprisingly) or, more inconveniently, give a different result.
Reproducibility includes the software underneath the model
Data scientists are well acquainted with a form of reproducibility:
- Keep the dataset.
- Set seed for random numbers.
- Document the preprocessing procedure.
- Document the evaluation procedure.
The computing environment is another such form.
Imagine two data scientists using the same model code, but having a different version of NumPy, pandas, or some machine learning library. Even if the two Python scripts were the same, they would not be the same experiment because the behaviour of the library changed between two versions.
The Python Packaging Authority now has a separate chapter devoted to repeatable environments and the standardized pylock.toml file.
The takeaway from this is crystal clear: repeatable environments are an essential part of Python project management.
For learners building skills in data science with python, this makes the computing environment just as important as the model and dataset.
pip freeze is useful, but it is not the whole story
Many learners are taught to finish a project with:
pip freeze > requirements.txt
That is better than recording nothing.
PyPI’s own security guidance, however, makes an important distinction. It says pip freeze does not create a security-grade lock file because it records package names and versions but does not include the hashes needed to identify exact distribution files.
There are ways to create locked dependencies for a virtualized environment that provide an accurate record of what will be installed.
The idea is straightforward.
The person conducting the analysis should not have to determine what “the environment probably looked like.”
This is especially relevant in data science with python, where the same project may need to be reproduced by another learner, evaluator, or data scientist.
“Always install the newest version” is a weak rule
There would be no reason not to update if critical fixes were available in those updates.
But at the same time, automatic consumption of each released package does not seem to be an optimal approach.
Following the 2026 supply chain incident, PyPI proposed the concept of a dependency cooldown, in which some time would pass after a package is published to allow maintainers and security experts to identify malicious packages.
In July, yet another piece of the Python ecosystem got stricter – namely, PyPI. Prior to that change, it was possible to add new distribution files to previously released versions, but this is no longer possible for older versions, and the measure is aimed at preventing the poisoning of older versions after credentials are compromised.
Those measures show how seriously the infrastructure takes the issue of package provenance.
It should be mirrored in data science practice.
Organize your portfolio project as if it were a professional-grade project.
For anyone developing a data science with python portfolio, this means treating dependencies and the computing environment as part of the project rather than as an afterthought.
Change the standard for a good portfolio project
Having such a repository with a great notebook might come in handy.
If someone else wants to run the project, they should be able to set it up and run it again.
In other words, keep track of the Python version, ensure that everything necessary is installed and maintained, and store that information alongside the code rather than relying on the environment.
As for the final project, there would be only one question the evaluator would ask:
Clone this repository on a new machine and re-run the project.
This way, they would uncover any assumptions that the author had made about the environment that cannot be found in screenshots and notebook outputs.
In addition, they would practice their professional habits.
The model is just one part of the analytical artifact.
Everything needed to reproduce the model is also part of the evidence.
The huge package ecosystem of Python is a significant advantage for data science work.
However, that same ecosystem means that every import ultimately depends on a package and its publishing process.
When using Python, one question becomes especially important before hitting Run:
What do I need to install, and will it still work six months from now?
For anyone learning data science with python, that question is ultimately part of building a reliable, reproducible data-science project.
Build reliable, secure, and reproducible data science projects with AnalytixLabs—learn Python best practices and create portfolio-ready analytical solutions confidently.
