-1

I have already built pypi package stored on pypi server few days back. Now I want to compare source code diff between already built pypi package and recent code built today. Is there any way to this?

I want to compare already built pypi package and newly build code. And If there is any difference in source code then only create a new package and upload it to pypi server

phd
  • 82,685
  • 13
  • 120
  • 165
Yogesh
  • 23
  • 4
  • **Why do you want to do that?** Why can't you use some good enough package manager? Please [**edit**](https://stackoverflow.com/posts/55862296/edit) your question with additional motivation: it smells badly as some [XY problem](http://xyproblem.info/) – Basile Starynkevitch Apr 26 '19 at 07:27

1 Answers1

0

If you have only Python bytecodes, you cannot get the corresponding source code (that hypothetical transformation is called decompilation, and is not possible in general; read e.g. about Rice's theorem). Since any translation (such as the one done by the python program) from source code to bytecode is losing some information (e.g. name of local variables, comments explaining the intent of the code).

Equality of the behavior of functions by static analysis of their source code (and the observable behavior of your code is what you really care about) is an undecidable problem. Learn more about λ-calculus, it is deeply related to that question.

The source code (by definition, the preferred form of code on which developers work) is not only for computers, but mostly for fellow developers: in other words, most of its value and its meaning is a social one (and that is what free software is about). Read more about the semantics of programs.

For example, renaming a variable from i to x may convey the implicit hypothesis that the intended dynamic runtime type of the value of that variable was an integer, and becomes a floating point.

Maybe you want some kind of package manager (or some version control system, if you deal with source code, or some build automation tool, if you build then install software out of it). Python has something to manage packages. The scons build automation uses Python, but there are many other build automation tools, GNU make being a common one (that you could use to drive compilation from .py source files to .pyc bytecode files and their installation). For version control, I recommend git.

PS. Your question is very unclear and smells like some XY problem.

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547