Questions tagged [python-packaging]

Packages are namespaces which contain multiple packages and modules themselves.

A package is a directory containing a special file called __init__.py (which indicated that the directory contains a python package) and sub-packages and modules. The package name is determined by the name of the directory.

1369 questions
9
votes
1 answer

pipenv: How to resolve dependency conflicts

I have this dependency issue: Pipfile.lock not found, creating… Locking [dev-packages] dependencies… Locking [packages] dependencies… Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies. You can…
caliph
  • 1,389
  • 3
  • 27
  • 52
9
votes
1 answer

What is the new upload URL for the Test PyPI server?

I'm trying to package a new project and upload it to the TestPyPI server. Because of the introduction of the new PyPI.org, virtually all the instructions I've found are out of date, and trying to upload to https://testpypi.python.org/pypi now…
pbaranay
  • 585
  • 5
  • 17
9
votes
2 answers

How to tell pip to install test dependencies?

We are using pip -e . to install our package in editable/development mode, instead of using python setup.py develop. (We have to do so, because we pull packages from the public PyPi server and a private one. This did not worked for us using python…
Achim
  • 15,415
  • 15
  • 80
  • 144
8
votes
1 answer

Pip pyproject.toml: Can optional dependency groups require other optional dependency groups?

I am using the latest version of pip, 23.01. I have a pyproject.toml file with dependencies and optional dependency groups (aka "extras"). To avoid redundancies and make managing optional dependency groups easier, I would like to know how to have…
James
  • 93
  • 1
  • 4
8
votes
2 answers

Distribute shell scripts using setuptools and pyproject.toml

I'm trying to distribute a shell script along with a Python package. Ideally, the shell script is installed when I run pip install my_package. I read from this SO that, my expected behavior is exactly what the scripts keyword of setuptools.setup…
8
votes
3 answers

How to get `setup.cfg` metadata at the command line (Python)

When you have a setup.py file, you can get the name of the package via the command: C:\some\dir>python setup.py --name And this would print the name of the package to the command line. In an attempt to adhere to best practice, I'm trying to migrate…
myoungberg
  • 137
  • 6
8
votes
1 answer

What is the preferred way to develop a Python package without using setup.py?

I am developing a Python package, and I don't want to have to keep running pip install . to reinstall my package every time I change something. Using the -e or --editable doesn't seem to work unless I have a setup.py file, nor does --no-use-pep517.…
8
votes
1 answer

Hermetic / Non Hermetic Packages in Python

While going through PyTorch documentation, I came across the term hermetic packages: torch.package adds support for creating hermetic packages containing arbitrary PyTorch code. These packages can be saved, shared, used to load and execute models…
outlier229
  • 481
  • 1
  • 7
  • 18
8
votes
1 answer

Packaging PyInstaller app using Wix Toolset

I'm trying to figure out what would be the easiest way to create an Installer using Wix Toolset. I'm building my app in Python and then creating an installer using PyInstaller as a One Folder (not one file) and then want to package it into .msi…
Maksim
  • 16,635
  • 27
  • 94
  • 135
8
votes
1 answer

python: What's the rationale behind not allowing * in relative imports?

What's the rationale behind not allowing * in relative imports? e.g. from ..new_tool import * or doing a relative import directly: import ..new_tool
Claudiu
  • 224,032
  • 165
  • 485
  • 680
8
votes
1 answer

How do I read project dependencies from pyproject.toml from my setup.py, to avoid duplicating the information in both files?

We're upgrading to use BeeWare's Briefcase 0.3.1 for packaging, which uses pyproject.toml instead of setup.py to specify how to package, including which dependencies to include in a package. Here's a minimal example of a pyproject.toml for…
Dybber
  • 113
  • 1
  • 7
8
votes
3 answers

Is there a way to programmatically confirm that a python package version satisfies a requirements specifier?

I am trying to find whether there is a way to take an installed package and version and check whether it satisfies a requirements spec. For example, if I have the package pip==20.0.2, I want the program to do the…
8
votes
4 answers

How can I get files within the tests in Python?

I have the following package structure: . ├── my_app │   ├── app.py │   ├── cli.py │   ├── db.py │   └── __init__.py ├── setup.py ├── tests │   ├── data │   │   └── foobar.gz │   ├── test_app.py │   └── test_database.py └── tox.ini Within…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
8
votes
4 answers

Can't install textract on windows

I've tried lots of things but still fail when I'm trying to install textract package on my Windows by using pip command. I'm getting the following error: I have no idea what to do, so I'll be really grateful for any advice. Thank you
8
votes
0 answers

How do you compile a C library with multiple dependencies into a Python package? Cmake?

I have a Python package in python3.x I've been writing up which interacts with two C functions in a C library. At the moment, I've been using ctypes whereby I link directly to the shared library *.so, and then use the python script to interact with…
ShanZhengYang
  • 16,511
  • 49
  • 132
  • 234