You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This all works nicely. However, to package and upload the software to PyPi, I have noticed that absolute imports are required as given below:
from model_checker.model_structure import (
StateSpace,
make_model_for,
)
Now the package builds just fine, but the python3 command given above now longer works. I would like to find a way to leave the absolute imports while still making use of the python3 command that I am using to test the package. I know that it is common to build the package locally in editable mode with pip but I am using NixOS, and so using pip is a pain, requiring that I enter into a virtual environment. Here is something I've tried adding without success:
current_dir = os.path.dirname(__file__) # Get the directory path of the current file
project_root = os.path.abspath(os.path.join(current_dir, "..")) # Construct the full path to your project root
sys.path.append(project_root) # Add the project root to the Python path
The hope was that by adding the project root to the path, I could leave the absolute imports and run the python3 command without issue.
The text was updated successfully, but these errors were encountered:
The
model_checker
project directory is flat, containing the following modules:Currently, module imports take the following form (viz
__main__.py
below):It is then possible to run the package with the following command:
This all works nicely. However, to package and upload the software to PyPi, I have noticed that absolute imports are required as given below:
Now the package builds just fine, but the
python3
command given above now longer works. I would like to find a way to leave the absolute imports while still making use of thepython3
command that I am using to test the package. I know that it is common to build the package locally in editable mode with pip but I am using NixOS, and so using pip is a pain, requiring that I enter into a virtual environment. Here is something I've tried adding without success:The hope was that by adding the project root to the path, I could leave the absolute imports and run the
python3
command without issue.The text was updated successfully, but these errors were encountered: