I installed a local module using the pyproject.toml
approach by following the great tutorial by RealPython: Packaging Your Python Code With pyproject.toml | Complete Code Conversation - YouTube
Although the module seems to be locally installed, I am unable to invoke it from outside the project directory. I have spent about two hours trying out various things, reading forums, watching videos, etc. to understand my mistake, but I have not found anything.
Can someone help me figure out the next steps I could take to figure this out?
My pyproject.toml
looks like this:
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
[project]
name ="incometax"
version = "0.0.1"
dependencies = [
"pytest",
"prospector[with_everything]",
"black",
"pandas",
]
Here’s my sys.path
: (Note the last entry matches the location in pip show
below)
C:\
(venv_incometax) λ python
Python 3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', 'C:\\WORK\\python', 'C:\\Users\\aravi\\AppData\\Local\\Programs\\Python\\Python311\\python311.zip', 'C:\\Users\\aravi\\AppData\\Local\\Programs\\Python\\Python311\\DLLs', 'C:\\Users\\aravi\\AppData\\Local\\Programs\\Python\\Python311\\Lib', 'C:\\Users\\aravi\\AppData\\Local\\Programs\\Python\\Python311', 'C:\\WORK\\dragondive\\heavens-arena\\venv_incometax', 'C:\\WORK\\dragondive\\heavens-arena\\venv_incometax\\Lib\\site-packages']
>>> exit()
Here’s the pip show
of my local module:
C:\
(venv_incometax) λ pip show incometax
Name: incometax
Version: 0.0.1
Summary:
Home-page:
Author:
Author-email:
License:
Location: C:\WORK\dragondive\heavens-arena\venv_incometax\Lib\site-packages
Requires: black, pandas, prospector, pytest
Required-by:
However, python doesn’t find the module:
C:\
(venv_incometax) λ python -m incometax
C:\WORK\dragondive\heavens-arena\venv_incometax\Scripts\python.exe: No module named incometax