This week I was doing more of some research work while trying to come up with some innovative ways to solve a certain problem I encountered while working on this pull request. Now let me give a brief explanation of what the problem is.
WHAT DID I RESEARCH ON THIS WEEK?
The problem: Now I am working with a python package which will soon be deployed to Pypi. But the project has dependencies like every other python project out there. And If I want PyAfipWs to be installed with the same packages as we use in the development phase, we have to freeze the requirements.txt. But our project uses setup.py and it has a key word called install_requires which indicates which dependencies are required for the project to run smoothly. Now what the requirements.txt those is it freezes core packages but it doesn't explicitly declare what dependency versions that are used by the core packages are actually stable with our current code for PyAfipWs. Now here are some constraints that guide how the dependecy pinning should work
- packages version should be relaxed (>= or ~) to avoid diamond dependency issue (avoid conflicts or forcing other project with our versions)
- we should test latest versions this instead the pinned dependencies in the requirements.txt
- we would need to use pip-tools or similar to freeze requirements.txt
There are many ways to solve it. One way is to manually specify the dependencies that will be used. While this is good but in the long run becomes hard to maintain. Pip-tools is a great module as it integrates directly with pip itself. We can use it to generate a requirements-dependencies.txt from a requirements.in file and create GH action that can automatically generate the new requirements.txt file and then read the file from the setup.py file so it always has the pinned versions like we had in our development environment.
WHAT I PLAN DOING THIS WEEK?
Implementing the above solution and working with my mentors to ensure it works well and then proceed to setting up the deployment to PyPi
Until next week, see ya