Python Forum
How to detect third party packages used in the code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to detect third party packages used in the code
#1
Hi,
I really do not know how to do this.
Is there any way to detect what are the third party packages used when we are using code developed by others. Not by eye-ball check (I want auto-detect).

The example code below: I imported openpyxl, pandas
I want to list them.

import pandas as pd
df_hyper=pd.read_excel(r'D:\Mekala_Backupdata\PythonCodes\hyperlink.xlsx',escape=False)
df_hyper.to_html('mylink.html',escape=False,index=False)

import openpyxl

wb = openpyxl.load_workbook(r'D:\Mekala_Backupdata\PythonCodes\hyperlink.xlsx')
ws = wb.get_sheet_by_name('Hyperlinks')
print(ws.cell(row=2, column=1).hyperlink.target)
Reply
#2
The standard way for a project to list its third party dependencies is to use a requirements file.
Reply
#3
I want to list down automatically when reading other's code and without going through the code. Can we develop any python code to detect such functionality?
Reply
#4
Why? If projects are using the requirements file, why do you need that?
Reply
#5
Because I want to list all packages, and check their versions in my local machine.
Reply
#6
Is the project not using a requirements file? It's highly unlikely, given that is the standard way to list dependencies.

If you want to know what you have installed, then either pip list, or pip freeze will do the job (the latter gives the output in the same format as is used in requirements files).
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I have a code which is very simple but still I cannot detect what's wrong with it max22 1 440 Nov-07-2023, 04:32 PM
Last Post: snippsat
  Running 3rd party libs on Steam Deck (Arch Linux) with restricted access metulburr 0 1,793 Jan-07-2023, 10:41 PM
Last Post: metulburr
  Avoid third party functions to wrote my python code into system debug-log? mark 9 2,139 Apr-09-2022, 08:41 PM
Last Post: mark
  How to use a function from third party library? rrowhe4d 2 1,813 Aug-31-2021, 04:30 PM
Last Post: Larz60+
  Did interpreter 'compile' all import modules(from thrid-party) jamesyuan 10 4,174 Oct-19-2020, 10:49 AM
Last Post: jamesyuan
  installing third-party modules shabux 5 3,366 Apr-13-2020, 12:41 AM
Last Post: Larz60+
  3rd Party Modules - Installing martyl 9 5,615 Jun-15-2018, 01:49 AM
Last Post: martyl
  [split] adding 3rd party libs Blue Dog 7 6,751 Oct-22-2016, 12:03 PM
Last Post: Blue Dog

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020