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
8
votes
1 answer

Can't verify hashes for these requirements because we don't have a way to hash version control repositories

I have the following requirements file: ... sqlalchemy==1.2.3 --hash=sha256:9e9ec143e2e246f385cfb2de8daa89d2fa466279addcb7be9e102988fdf33d24 werkzeug==0.14.1 --hash=sha256:d5da73735293558eb1651ee2fddc4d0dedcfa06538b8813a2e20011583c9e49b …
Dhia
  • 10,119
  • 11
  • 58
  • 69
8
votes
1 answer

How to include examples or test programs in a package?

The Python Cookbook suggests the following tree structure for a "typical library package": projectname/ README.txt Doc/ documentation.txt projectname/ __init__.py foo.py bar.py utils/ …
George Boukeas
  • 333
  • 1
  • 11
8
votes
2 answers

How can I recreate my conda environment using yml file?

My conda export was done like this: conda env export --file environment.yml -n djangoenv The file itself looks like this: name: djangoenv channels: - bioconda - anaconda-cluster - defaults dependencies: - anaconda-cluster::python-apt=0.8.5=py27_0 -…
Muhammad Lukman Low
  • 8,177
  • 11
  • 44
  • 54
8
votes
2 answers

Install psutil without gcc

Up to now we installed psutil via our custom pypi server. Now we have a new environment where we should not install gcc. Now the old way (pip starts gcc during install) does not work any more. The context: Linux servers python inside virtualenv All…
guettli
  • 25,042
  • 81
  • 346
  • 663
7
votes
1 answer

How to use setuptools_scm?

I didn't quite understand how to use setuptools-scm. From what I understand, this tool should derive a version number according to the SCM (git in my case) history. It basically uses the distance from the latest tag in order to derive this…
YoavKlein
  • 2,005
  • 9
  • 38
7
votes
1 answer

Python poetry, install optional dependencies

I just want the poetry equivalent of this: $ pip install pydantic[email] I've read all the relevant posts. Now my pyproject.toml looks like this (I tried everything else, too): [tool.poetry.dependencies] pydantic = {version = "*", optional = true,…
Alexey Orlov
  • 2,412
  • 3
  • 27
  • 46
7
votes
2 answers

How to install multiple .whl files in the right order

I have recently found myself in the situation of having to install all dependencies (20+) of a python project on a machine without internet connection. I used pip download ... to get all the *.whl files and transferred them manually. Only now I…
Sebastian Dengler
  • 1,258
  • 13
  • 30
7
votes
1 answer

How to specify external system dependencies to a Python package?

When writing a Python package, I know how to specify other required Python packages in the setup.py file thanks to the field install_requires from setuptools.setup. However, I do not know how to specify external system dependencies that are NOT…
Odin
  • 633
  • 4
  • 11
7
votes
1 answer

How to place Spacy en_core_web_md model in Python package

I am building a python package and I am using Spacy library and Spacy model en_core_web_md. It can't be installed using pip. You can install it like this python -m spacy download en_core_web_md I have place en_core_web_md folder in my Python…
shahid hamdam
  • 751
  • 1
  • 10
  • 24
7
votes
0 answers

Installing pure C library for Python Package

I have a Python Package (3.7) in which I've made a module, which makes use of a C-library for performance issues. This C-library is interfaced to through Ctypes. Now, I have a Makefile that compiles the C-library to a .so (in Windows using Cygwin…
MRK
  • 546
  • 4
  • 6
7
votes
2 answers

My RST README is not formatted correctly on PyPi

I uploaded a package to pypi.org but my RST README isn't formatted correctly. This is what it looks like on GitHub: https://github.com/NinjaSnail1080/akinator.py This is what it looks like on PyPi: https://pypi.org/project/akinator.py/ For some…
user9727906
7
votes
1 answer

Structure of package that can also be run as command line script

I have written a package with the 'standard' minimal structure. It looks like this: my_package/ my_package/ __init__.py setup.py __init__.py contains a class and as such can simply be imported and used as one would expect. However,…
Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
7
votes
1 answer

Cannot resolve "import as" situation ("AttributeError module x has no attribute y")

I have a project with the following structure: project/ driver.py lib/ __init__.py core/ util.py common.py __init__.py # project/driver.py import lib.core.common as abc pass #…
JoaoAlby
  • 167
  • 2
  • 10
7
votes
2 answers

Multiple distributions from one source tree

I have a source tree that looks about like this: /app/backend/module.py /app/cli/module.py /app/common/module.py Now I want to build three packages, app-backend, app-cli and app-common out of this which should be distributable and be usable…
fqxp
  • 7,680
  • 3
  • 24
  • 41
7
votes
2 answers

How to install a wheel-style package using setup.py

Is there a way, using setup.py, to install a python package as a wheel/pip-style package (i.e. dist-info) instead of the egg installation that setup.py does by default (i.e. egg-info)? For example, if I have a python package with a setup.py script…
Brendan Abel
  • 35,343
  • 14
  • 88
  • 118