I am trying to create a python package that I can reuse in other projects. I did follow this tutorial: Create Your Custom, private Python Package That You Can PIP Install From Your Git Repository.
It works but when I update the code of my package and then try to update the package on a project that uses this package, it does not update.
So I have a git repo with my package at https://github.com/vincent2303/myCustomPackage with following files:
myCustomPackage/functions.py
with the following function:
def say_foo():
print('Foo')
- A
setup.py
file with:
import setuptools
setuptools.setup(
name='myCustomPackage',
version='0.0.1',
author='Vincent2303',
description='Testing installation of Package',
long_description_content_type="text/markdown",
license='MIT',
packages=['myCustomPackage'],
install_requires=[],
)
Then I created a test project, with:
- A
main.py
file:
from myCustomPackage import functions
functions.say_foo()
- A Pipfile (I did
pipenv shell
thenpipenv install git+https://github.com/vincent2303/myCustomPackage.git#egg=myCustomPackage
):
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
mycustompackage = {git = "https://github.com/vincent2303/myCustomPackage.git"}
[requires]
python_version = "3.8"
At this point it works well, I can use say_foo
.
Then I added a new function say_bar
on myCustomPackage (in myCustomPackage/functions.py
). I did increment version from 0.0.1
to 0.0.2
in setup.py
. I did commit and push.
In my project that uses myCustomPackage I did run pipenv install
, I expect pip to check version, detect that there is a new version and update it but it does not. I can't use say_bar
(I get error: AttributeError: module 'myCustomPackage.functions' has no attribute 'say_bar'
)
I tried as well to re run pipenv install git+https://github.com/vincent2303/myCustomPackage.git#egg=myCustomPackage
. It does not update.
How can I update the version of myCustomPackage
in projects that uses this package ?