1,554 questions
0
votes
0
answers
44
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
64
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
172
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, ...
2
votes
1
answer
66
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
69
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
127
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
93
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
100
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
126
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
112
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
57
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
3k
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
30
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
75
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
64
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
137
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
60
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
70
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
61
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
75
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
85
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
...
0
votes
0
answers
32
views
rez-env -c which python 17:14:32 ERROR PackageCommandError: Error in post_commands in package
I'm new to rez. I ran rez bind --quickstart
and got the following:
PS C:\WINDOWS\system32> rez-bind python
searching d:\opt\rez\Lib\site-packages\rez\bind...
creating package 'python' in C:\Users\...
-2
votes
1
answer
189
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
157
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 ...
0
votes
0
answers
33
views
How to include Python application in conda constructor output?
I'm working on a Python CLI application that deals with climate data, using conda as a package manager.
To run the tool locally, I create and activate a conda environment (conda env create --file ...
1
vote
1
answer
46
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
...
0
votes
0
answers
40
views
Package not found when reverting conda environment
I'd like to revert my conda environment back a few stages. I see this can be done with conda activate envname then conda install --revision #. This fails with the error message: PackagesNotFoundError: ...
2
votes
1
answer
368
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
188
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
117
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
120
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
0
answers
103
views
Python custom src-layout: How to add another subpackage layer?
I have my Python package structured in src-layout. I run multiple github repositories with each the same super-package-name, structured as follows:
package-subpackage1
├── .git/
├── src/
│ └── ...
0
votes
1
answer
44
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
36
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 ...
1
vote
1
answer
395
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-...
0
votes
1
answer
210
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 ...
0
votes
0
answers
51
views
How to prevent users from installing my Python package on Windows?
I have a Python package that I publish to PyPI.
However, it does not support Windows, and I want to prevent that users install it on Windows.
Can this be done using just pyproject.toml?
Note:
I am ...
1
vote
0
answers
458
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
71
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
277
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
57
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
50
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
128
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
51
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
257
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
206
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
88
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
123
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
132
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/...