1,551 questions
Tooling
0
votes
1
replies
73
views
`dnf provides` for `pip`
I do a lot of building, so package errors cause the most friction. In particular, when working with pip, the ModuleNotFoundError: after all package names can be confusing / unexpected and not ...
4
votes
2
answers
235
views
How do I set uv to index packages from a local directory?
So, I have a built python wheel at $HOME/mypackages/mypackage-1.0.0-py3-none-any.whl. I want uv to use this mypackages/ directory as its default package index, so I set:
export UV_DEFAULT_INDEX="$...
Tooling
1
vote
2
replies
84
views
Python Package - Storing Configuration/Settings and delete when package is uninstalled
My python GUI application have settings. The state of the settings are saved to the user_configs_dir into a json file by using the appdirs library.
My python application can be installed using pip ...
0
votes
0
answers
67
views
Python module built with Cpp and scikit-build-core compiles with the wrong version of Numpy
I have the following pyproject.toml
[build-system]
requires = ["scikit-build-core>=0.11", "pybind11>=3.0", "numpy>=2.0"]
build-backend = "scikit_build_core....
1
vote
0
answers
90
views
Local package randomly becomes unimportable when using `uv run` in a project created with `uv init --package`
I'm seeing non-deterministic import failures when using uv to manage a Python project created with uv init --package. After a fresh uv sync, my local package is importable, but after running a few uv ...
1
vote
1
answer
68
views
Can't Import Module with Python Package with Subpackages All as Zip Archive
I am experimenting with how to package my python code as a zip archive. I understand there are other ways to share and distribute code. Right now I am specifically interested in how to get this to ...
2
votes
0
answers
205
views
What is the documented behaviour (if any) when someone imports `pkg.__init__[ as pkg]` instead of `import pkg`?
To be clear, I'm not suggesting anyone actually should import pkg.__init__ directly. This is to understand potential pitfalls if someone decides to convert a module-only distribution into a package, ...
3
votes
1
answer
99
views
Python packaging: single-module with package data
I want to install my single file module together with its py.typed file using setuptools and pyproject.toml.
I'm packaging a Python single-module, and so far I was using a very simple pyproject.toml:
[...
2
votes
2
answers
88
views
Unable to create .whl distribution for only one Python package
My goal is to create a .whl installer file for only one given package. There are multiple packages in the directory tree.
setup.py:
from setuptools import setup
setup(
name="package1",
...
0
votes
0
answers
173
views
How to automate running Mypy stubgen on build?
I am new to PyO3. Out of the box it supports building with maturin or setuptools-rust. It does not support making Python type stub (.pyi) files by itself yet (incomplete feature). Mypy's stubgen does ...
-2
votes
1
answer
104
views
Is it possible to install submodules of a python package dynamically?
I have a very complex Python library that is used by several people/projects for different purposes.
The structure is basically the same as many Python libraries, but I would like to give the ability ...
0
votes
0
answers
111
views
Setuptools : why editable mode does not work outside of my project directory?
I don't manage to make the editable mode pip install -e . for a local installation of my project. After the installation, when I import a constructor from a module of my package within in python shell ...
1
vote
2
answers
155
views
How do you use just one folder from a repository as a submodule?
I have a repository which needs just one folder from another, but it needs to keep updating when the other repo changes, so I plan to use a submodule, but how do I take just the singular folder?
This ...
-5
votes
1
answer
168
views
simplest jinja2 template loading for one-file python script
I'm using Python only for simple scripts and every time I look into Python packaging, there is a new standard or technologie.
Now when I develop a small one-file tool and want to load a jinja2 ...
0
votes
0
answers
72
views
Why does pip install incompatible packages from Google Artifact Registry (Python repo) instead of resolving properly?
I'm using Google Artifact Registry to host Python packages, and I'm running into a serious issue with pip installing incompatible versions of packages (like numpy or scipy)
Problem:
When I run:
pip ...
2
votes
1
answer
4k
views
How to uv add git repo with subpackages
I want to use uv to install packages and add dependencies, equivalent to the following pip workflow:
git clone https://github.com/<username>/<repository>.git
cd <repository>
pip ...
0
votes
0
answers
31
views
How to manage internal dependencies within a project when using `pip install -e .`?
Detail of the Problem:
My simple project structure is as follows:
└─mris
├─mris.egg-info
├─seggms
│ ├─training
│ │ └─run_training.py
├─utilities
│ └─config.py (contains ...
2
votes
1
answer
91
views
Pyairbyte will not pick up my local changes to a source connector
I am uncertain of how to do development against an existing connector using pyairbyte. I cannot get pyairbyte to successfully load my modified source connector. I have made changes to the source-...
0
votes
0
answers
75
views
Can I specify a different directory for transient files, when invoking Python build-module?
I currently build my simple Python module with a command like:
python3 -m build --wheel --outdir /tmp .
This creates the /tmp/mypackage-0.1-py3-none-any.whl -- as one would expect. However, it also ...
1
vote
0
answers
161
views
Installing my own single-file Python project
I have a rather small package, with only the single __init__.py at the top-level, which I attempt to install with pip-3.11 install --user ..
Pip duly processes my pyproject.toml, checking all of the ...
0
votes
0
answers
66
views
How to avoid recompiling extensions with setuptools?
I’m building a Python package with a custom CUDA extension using PyTorch. My setup is managed with uv and a pyproject.toml file, and the build process is defined in setup.py, similar to the ...
0
votes
0
answers
95
views
How to automate selection of local .whl dependencies in pyproject.toml based on Python version and OS?
I'm working on a Python project that depends on several local .whl files, each built specifically for:
different Python versions (3.9, 3.10, 3.11, 3.12)
different platforms (win32, linux)
different ...
0
votes
0
answers
86
views
Is poetry support reading requirements.txt dependencies in pyproject.toml?
I have all my dependencies like below in pyproject.toml
[tool.poetry.dependencies]
python = ">=3.9,<4.0"
docutils = "0.21.2"
loguru = "0.7.3"
build = "*"
...
0
votes
0
answers
90
views
Can you include a standalone executable in a Python package with pyproject.toml?
Looking at Python packaging with pyproject.toml, I wonder whether it is possible to add a standalone executable (with #!/usr/bin/env python in the first line) to pyproject.toml, without going for a [...
0
votes
1
answer
92
views
Having secrets locally when pip installing a private github repo
I have this pipeline:
name: Build and deploy Python app to Azure Web App - app-xx-xx-api-dev
on:
push:
branches:
- dev
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
...
-2
votes
1
answer
218
views
Why is python thinking my folder is a module?
I have a project structured like this:
project+
|-folder1+
| |-__init__.py
| |-script
|
|-folder2+
| |-__init__.py
| |-...
1
vote
0
answers
177
views
Poetry: Lock Hash Mismatches with Local Wheels
We are migrating a large Python monorepo from Poetry 1.1.15 to 2.1.2 (primarily to gain support for URL dependency authentication). This migration has introduced challenges with our lock file ...
1
vote
1
answer
50
views
Poetry local package importation Module not found
I just start learning Poetry.
I am trying to import a local package in a poetry project.
This is the structure of the project:
MyProject
myproject
__init__.py
tests
__init__.py
...
2
votes
1
answer
472
views
How to specify package as an extra in poetry/pyproject.toml
I have a package with a pyproject.toml that has a core package & an optional GUI package with its own extra dependencies. This is the project structure:
.
└── my_project/
├── src/
│ └── ...
1
vote
0
answers
217
views
Adding an upstream relative path to project in pyproject.toml
I created a project with uv that has the following package structure: a src folder has all the modules and functions a data folder and a notebook and script folders where the modules in src and data ...
0
votes
0
answers
131
views
Azure Synapse REST API endpoint for workspace packages creation
I want to deploy a custom package (Python whl) to Synapse workspace using REST API (using Python request library). I need it to automate packages deployment via CI/CD (GitLab).
I managed to do it ...
0
votes
1
answer
134
views
Unable to install ydf on Docker on Python image
I want to use the ydf package in a docker image, but every time I try to build Docker Image of Python with ydf package I get this error:
1.699 ERROR: Could not find a version that satisfies the ...
0
votes
1
answer
46
views
Not able to use Smartsheet python api when packaging project using Nuitka
I wrote a python project that automates tasks and makes use of the smartsheet api but when I package this project into an executable with nuitka I get the error:
ImportError! Could not load api or ...
1
vote
0
answers
41
views
How to ask for parameter before installations with Poetry?
My package's Python version depends on one of its dependencies'. Since it integrates with Databricks, the corresponding runtime environment (DBR) sets a dependency package databricks-connect which ...
2
votes
1
answer
449
views
Why pdm-build does not include the files I have specified in the includes?
I am using PDM for virtual environment package management.
Also, I am using the pdm build backend, which is problematic.
When I was originally packaging apps with setuptools, I was able to specify non-...
1
vote
1
answer
280
views
How can I test that Python package entrypoints are correctly discovered and loaded?
I am currently writing a package that seeks to load entrypoint contributions from other installed packages using importlib.metadata.entry_points, but am unsure how I can test this properly. I am using ...
0
votes
0
answers
27
views
FileNotFoundError within Python package on a file in same directory as calling function [duplicate]
I have created a Python package, and one of the functions I have written opens a .txt file in the same directory as that function. Locally, this works fine, but when the package is built and executed ...
1
vote
0
answers
572
views
Setuptools-based pip install with no-build-isolation-package
I am trying to create a simple pyproject.toml file where I can disable disable build isolation for a specific dependency. The idea is that a the install process should install setuptools if this is ...
1
vote
1
answer
86
views
python pyproject.toml - arch dependency solved on install
In pyproject.toml we have a optional-dependencies for a windows package:
[project.optional-dependencies]
windows = [
"pywinpty>=2.0.14"
]
To install:
# on windows
pip install .[...
0
votes
1
answer
327
views
Wheel File Not Including templates Directory and Root Files in Python Package
Background:
I am new to using the standard Python packaging tools and have typically relied on custom tooling. However, I’ve decided to get a better understanding of the packaging process, but I’m ...
0
votes
1
answer
58
views
Issue with configuring python packages with poetry
I want to configure a python package with poetry for better dependency management, for some reason it connot find the any packages i mention as it should, I am new to using poetry so I want to know ...
-1
votes
1
answer
55
views
ModuleNotFoundError when referencing folder in Python [duplicate]
I have a Python3 project arranged as follows:
C:\automation\framework\constants.py
C:\automation\tests\unit-tests\test_myunittest.py
In my unit test, I'm trying to call methods in framework folder, ...
0
votes
0
answers
151
views
error: package directory 'mypackage' does not exist using pyproject.toml
Problem
Whilst running some unit tests I was presented with the following error when trying to import from absolute path:
tests/unit/test_parameter_combinations.py:3: in <module>
from ...
0
votes
0
answers
53
views
Unable to use Absolute Import to get Objects from Package __init__.py (despite PYTHONPATH Setting)
(Neither this question nor this question are duplicates - they are all resolved by setting the PYTHONPATH correctly.)
I have the basic file structure of a Python package, located in ~/github/mypackage:...
1
vote
0
answers
325
views
How to conditionally install modules using pip with pyproject.toml?
I'm trying to set different user-versions inside the same directory, so when using pip install . only the basic version module should be installed, namely only installing foo_tool. When using pip ...
0
votes
1
answer
218
views
How can I add in pyproject.toml an optional dependency driven at built by a local environment variable?
With setup.py I can do something like this :
if not os.environ.get("DO_NOT_INSTALL_THIS_PACKAGE"):
install_requires.append("this_package")
How can I do the same thing with ...
3
votes
1
answer
101
views
Build a wheel and Install package version depending on OS
I have several python packages that need to be installed on various os/environments. These packages have dependencies and some of them like Polars needs a different package depending on the OS, for ...
0
votes
3
answers
140
views
Why is pyproject-build.exe not on PATH in Anaconda, and how can I ensure both .tar.gz and .whl distributions are created with py -m build?
I am trying to package a Python project using py -m build within an Anaconda environment. However, I noticed that only the .tar.gz source distribution is being created, and the .whl (wheel) ...
-1
votes
1
answer
156
views
Create package and manually installing it as 'editable' (machine offline)
I have a project on a machine behind a firewall with PyCharm installed and I'm trying to get some structure into it. Therefore I am trying to create some kind of utility module that I want to edit/...
0
votes
0
answers
51
views
How to make a subpackage available to import without specifying the root package
My demo project structure:
project_root_directory
├── pyproject.toml
└── src/
└── root/
├── __init__.py
├── module.py
│
├── nested_a/
│ ├── __init__.py
...