a.t.
a.t.

Reputation: 2808

How to include .tar.gz dependency in pip package?

Context

While publishing a pip package, I am experiencing some difficulties in including the lava-nc dependency in the form of a .tar.gz file. Suppose the package (here called magic) has a directory structure as follows:

snnalgocompare/
  src/
    snnalgocompare/
      __init__.py
  dependencies/
    lava-nc-v0.5.1.tar.gz
  setup.py

where the dependency can be installed with:

pip install https://github.com/a-t-0/lava/archive/refs/tags/v0.5.1.tar.gz

however, I prefer the pip package to be self-contained.

Code

The setup.py file looks like this:

"""Packaging logic for snnalgocompare."""
from __future__ import annotations

import os
import sys

import setuptools

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src"))

setuptools.setup()

and the setup.cfg contains:

[metadata]
name = snnalgocompare
version = attr: snnalgocompare.__version__
description = compares snn algorithms against neumann algorithms
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/a-t-0/snnalgocompare
author = a-t-0
author_email = [email protected]
maintainer = a-t-0
maintainer_email = [email protected]
license = AGPLv3
license_file = licence
classifiers =
    Development Status :: 2 - Pre-Alpha
    Environment :: Console
    Intended Audience :: Science/Research
    License :: OSI Approved :: GNU Affero General Public License v3
    Programming Language :: Python
    Programming Language :: Python :: 3
    Programming Language :: Python :: 3 :: Only
    Programming Language :: Python :: 3.8
    Programming Language :: Python :: 3.9
    Programming Language :: Python :: 3.10
    Programming Language :: Python :: 3.11
    Topic :: Scientific/Engineering :: Artificial Intelligence

[options]
packages = find:
package_dir =
    =src
# dependencies 
install_requires =
    jsons>=1.6.3
    matplotlib>=3.6.1
    networkx>=2.8.7
    numpy>=1.23.4
    pytest-cov>=4.0.0
python_requires = >=3.8

[options.packages.find]
where = src

[options.entry_points]
console_scripts =
    snnalgocompare = snnalgocompare:main

[bdist_wheel]
universal = 1

[mypy]
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_unused_ignores = true

[mypy-tests.*]
disallow_untyped_defs = false

I verified all other dependencies jsons, networkx etc. are automatically installed when the pip install snnalgocompare is ran.

Question

How do I include the lava-nc-v0.5.1.tar.gz file in the setup.py/cfg such that it is automatically installed when one runs: pip install snnalgocompare?

Upvotes: 0

Views: 414

Answers (0)

Related Questions