I have a python3 distribution that has one package and also a C extension. I would like to be able to specify the version of the C extension during imports in the tell.py
script, but cannot seem to figure it out.
My directory structure looks like:
funnyjoke/
├── tell.py
├── funnyjoke
└── __init__.py
└── src
└── fastjoke.c
I can import the specific version of the funnyjoke module perfectly fine:
__requires__= 'funnyjoke==0.3'
import pkg_resources
pkg_resources.require("funnyjoke==0.3")
import funnyjoke
funnyjoke.tell()
But the fastjoke extension does not get the version from the setup.py
script
__requires__= 'fastjoke==0.3'
import pkg_resources
pkg_resources.require("fastjoke==0.3")
import fastjoke
fastjoke.tell()
and gives the error:
pkg_resources.DistributionNotFound: The 'fastjoke==0.3' distribution was not found and is required by the application
Is it possible to set/attach a version to the C extension?
setup.py
from setuptools import setup, Extension, find_packages
setup(name='funnyjoke',
version='0.3',
description='The funniest joke in the world',
author='Flying Circus',
license='MIT',
#packages=['funnyjoke'],
packages=find_packages(),
scripts=['tell.py'],
ext_modules = [Extension('fastjoke', ['src/fastjoke.c'])],
zip_safe=False)
All files can also be retrieved via pip3 install funnyjoke