Questions tagged [python-packaging]
Packages are namespaces which contain multiple packages and modules themselves.
python-packaging
1,515
questions
0
votes
1
answer
22
views
Import creates unexpected references to objects depending on whether a module is a file, or when it is part of a package
I have subtle import issue that creates variables with references to objects different to what I expect, and it all depends on whether the module I'm writing is imported "as is" or as part ...
0
votes
1
answer
36
views
+500
How to use standard tools to package and install a zipped python package of pyc files and a .pth file
I have a Python package which I have zipped using zipfile.PyZipFile, so I now have a .zip containing only .pyc files and sub-packages for a particular version of Python.
I can manually place it into ...
1
vote
1
answer
53
views
Is it a good practice to import functions from __main__.py?
My __main__.py module for my package is defined like so (simplified):
def main():
... # Start my GUI
if __name__ == "__main__":
main()
It is also a package, with an __init__.py as ...
0
votes
0
answers
23
views
Why Does this Failed Import Cause Future Imports to Also Fail (which otherwise wouldn't)?
This question is really just about the "why." I'm not actually interested in a work-around. I just want to understand why this doesn't work as is.
IMPORTANT EDIT: apparently the issue ...
0
votes
0
answers
8
views
How to obtain path to a python data file using importlib without using a context manager?
My goal is to load datafiles from an installed Python package using the importlib package. To be fair, this package API seems very complex to use to me and many methods seem to be deprecated. I need ...
0
votes
1
answer
73
views
What is the difference between installing a module with pip/setup.py vs adding it to PYTHONPATH?
I have a custom Python module I want to use in another project. This module gets deployed to production as well. I have two options:
Add a setup.py and install the module locally with pip.
Add the ...
0
votes
0
answers
27
views
Python Packages . Not installing on IntelliJ Idea (Community Edition) - Attribute Error
I was on IntelliJ Idea Community 2022.2, with the JetBrains' Python Community Edition plugin. I wanted to install the mysql-connector-python package. I tried it from the IDE's own Python Package ...
1
vote
1
answer
21
views
Is it possible to make __pycache__ generate in a single centralized folder?
I have a project configured with pyproject.toml and setuptools.build_meta as build backend, developed using editable install in a venv. So far I've managed to redirect other temporary folders to a ...
0
votes
1
answer
25
views
Automatically extend all imports within python project by prefix
I am trying to convert my python 3.11.3 project into a package via a setup.py. The general structure is something like this
- project_name/
- setup.py
- project_name/
- sub_module/
- ...
0
votes
0
answers
19
views
Module with absolute Path constants within Package packaged with setuptools
I have a medium size Python package and I use setuptools to build a wheel. The package is meant to be a convenience library for a Fortran program. I now would like to define a constant which gives the ...
0
votes
1
answer
58
views
How to include .env file in my python package using pyproject.toml?
I have the following folder structure:
program_root/
- src/
- tests/
- data/
- templates/
- docs/
- build/
- dist/
- ...
1
vote
0
answers
34
views
Is there a way to isolate a specific installed library into my project and compile it with the rest of a project?
I have multiple python projects and when I compile one of them the using Python to Exe, I end up compiling all the libraries that I have downloaded. I also noticed that in my project, even though I ...
0
votes
0
answers
58
views
Python packages: Multiple subprojects
I have this directory structure:
pyproject.toml
proj1/
pyproject.toml
MANIFEST.in
proj1/
__init__.py
proj2/
pyproject.toml
MANIFEST.in
proj2/
__init__.py
What I want to do is:
...
-1
votes
0
answers
75
views
Steps to install python packages without PIP command and when there is no setup.py exists
In Organizational network we had block the installation from cmd prompt using pip for python package installations. I have downloaded the package files from pypi.org and installed using python setup....
1
vote
1
answer
98
views
Setuptools unable to read requirements.txt from pyproject.toml in python 3.12.x
I have a package structure as follows:
program_root/
- src/
- tests/
- data/
- templates/
- docs/
- pyproject.toml
- README
- requirements.txt
My ...