Differences

This shows you the differences between two versions of the page.

Link to this comparison view

public:gsoc:python_extension_module_compilation_documentation_gsoc_17 [2017/09/04 18:04]
skrill created
public:gsoc:python_extension_module_compilation_documentation_gsoc_17 [2017/09/04 18:14] (current)
skrill [PyPI module]
Line 33: Line 33:
  
 ===== PyPI module ===== ===== PyPI module =====
-(This section is for contributors who want to upload the package to PyPI) +//(This section is for contributors who want to upload the package to PyPI)// 
-The PyPI module that has been uploaded has many things added to the CCExtractor code tree and all of this can be found here (branch - manifest_file). +  ​* ​The PyPI module that has been uploaded has many things added to the CCExtractor code tree and all of this can be found [[https://​github.com/​Diptanshu8/​ccextractor/​tree/​manifest_file|here]] (branch - manifest_file). 
-The contributor is advised to use the documentation at ‘An Introduction to Distutils’ and its subsequent parts to understand this section. +  ​* ​The contributor is advised to use the documentation at [[https://​docs.python.org/​2/​distutils/​introduction.html|//​‘An Introduction to Distutils’//]] and its subsequent parts to understand this section. 
-The overall strategy or steps that have been followed to generate the distribution for being uploaded to PyPI is as follows: +  ​* ​The overall strategy or steps that have been followed to generate the distribution for being uploaded to PyPI is as follows:
-Adding files to distribution and generating the distribution +
-All the files that are needed to be included in the package distribution are to be added the MANIFEST file as done here. For understanding the syntax used in MANIFEST file the user can check this documentation. +
-After the MANIFEST file has been written properly, the user can generate the distribution package by the command +
-python setup.py sdist +
-This command would generate the distribution on the basis of MANIFEST file and place in the dist/ directory as a .tar.gz file until specified otherwise by the user. +
-One thing to mention about the MANIFEST file is that it can only include files/​folders from the folder it is defined within. It cannot include directories/​files from parent directory or any other child directory. However, in the MANIFEST file I used, I have added the symlink to src main src directory so that the source code can be added to the package distribution via the MANIFEST file.+
  
-An analysis of the setup.py file used +=== Adding files to distribution and generating ​the distribution === 
-The setup.py has been used to install ​the Python module on the user systemTo understand what all the parameters mean in setup the user must refer to this documentation. +  * All the files that are needed ​to be included in the package distribution are to be added the MANIFEST file as done [[https://​github.com/​Diptanshu8/​ccextractor/​blob/​manifest_file/​api/​MANIFEST.in|here]]. For understanding ​the syntax used in MANIFEST file the user can check this [[https://​docs.python.org/​2/​distutils/​sourcedist.html#​specifying-the-files-to-distribute|documentation]]. 
-The cmdclass defined at line is a very important part of the script as it internally makes call to the scripts included in package_build_scriptsA point to note is that this directory is used to include ​the scripts into the package ​distribution ​via the MANIFEST file+  * After the MANIFEST file has been written properly, the user can generate ​the distribution ​package by the command 
-The scripts in package_build_scripts are the scripts which do the actual compilation ​of the source code to required python module ​and shared object. The user is advised to refer to build_library_package and build_api_package to understand how to compilation process takes place. ​The user may also refer to this documentation for understanding how the build scripts work+<​code>​python setup.py sdist</​code>​ 
-For any modifications made to the build scripts, viz, build_library and build_api corresponding modifications are to be made to the scripts included in package_build_scripts so that the compilation does not fail while installing the Python extension module. +  * This command would generate ​the distribution on the basis of MANIFEST file and place in the dist/ directory as a .tar.gz file until specified otherwise by the user. 
-The ccextractor.i used in the package_build_scripts is an interface ​file used by SWIG to generate ​the wrapper codesThis is an essential part and should always ​be present with the distribution.+  * One thing to mention about the MANIFEST file is that it can only include files/​folders from the folder it is defined withinIt cannot include directories/​files from parent directory or any other child directoryHowever, ​in the MANIFEST ​file used, I have added the symlink to [[https://​github.com/​Diptanshu8/​ccextractor/​blob/​manifest_file/​api/​src|src]] main [[https://​github.com/​Diptanshu8/​ccextractor/​tree/​manifest_file/​src|src directory]] so that the source code can be added to the package ​distribution ​via the MANIFEST file.
  
-Uploading to PyPI +=== An analysis of the setup.py file used === 
-For uploading the extension module to Python, I have followed the exact steps mentioned at here. +  * The [[https://​github.com/​Diptanshu8/​ccextractor/​blob/​manifest_file/​api/​setup.py|setup.py]] has been used to install the Python module on the user system. To understand what all the parameters mean in [[https://​github.com/​Diptanshu8/​ccextractor/​blob/​manifest_file/​api/​setup.py#​L22|setup]] the user must refer to [[https://​docs.python.org/​2/​distutils/​setupscript.html|this documentation]]. 
-The GitHub repository which I used to host the tar as mentioned in the above link could be found here. +  * The cmdclass defined at [[https://​github.com/​Diptanshu8/​ccextractor/​blob/​manifest_file/​api/​setup.py#​L33|line]] is a very important part of the script as it internally makes call to the scripts included in [[https://​github.com/​Diptanshu8/​ccextractor/​blob/​manifest_file/​api/​package_build_scripts|package_build_scripts]]. A point to note is that this directory is used to include the scripts into the package distribution via the MANIFEST file. 
-However, there is no mandatory rule to continue hosting the source distribution from the same repository. If a user feels that a newer version for CCExtractor’s extension module is ready to be shipped, then he can follow the same steps from the link mentioned in first point of this section. In those steps, he can create a self-owned public repository and upload the module to PyPI.+  * The scripts in package_build_scripts are the scripts which do the actual compilation of the source code to required python module and shared object. The user is advised to refer to [[https://​github.com/​Diptanshu8/​ccextractor/​blob/​manifest_file/​api/​package_build_scripts/​build_library_package|build_library_package]] and [[https://​github.com/​Diptanshu8/​ccextractor/​blob/​manifest_file/​api/​package_build_scripts/​build_api_package|build_api_package]] to understand how to compilation process takes place. The user may also refer to this [[public:​gsoc:​python_extension_module_technical_documentation_gsoc_17|documentation]] for understanding how the build scripts work. 
 +  * For any modifications made to the build scripts, viz, [[https://​github.com/​Diptanshu8/​ccextractor/​blob/​manifest_file/​api/​build_library|build_library]] and [[https://​github.com/​Diptanshu8/​ccextractor/​blob/​manifest_file/​api/​build_api|build_api]] corresponding modifications are to be made to the scripts included in package_build_scripts so that the compilation does not fail while installing the Python extension module. 
 +  * The [[https://​github.com/​Diptanshu8/​ccextractor/​blob/​manifest_file/​api/​package_build_scripts/​ccextractor.i|ccextractor.i]] used in the package_build_scripts is an interface file used by SWIG to generate the wrapper codes. This is an essential part and should always be present with the distribution. 
 + 
 +===== Uploading to PyPI ===== 
 +  ​* ​For uploading the extension module to Python, I have followed the exact steps mentioned at [[http://​peterdowns.com/​posts/​first-time-with-pypi.html|here]]
 +  ​* ​The GitHub repository which I used to host the tar as mentioned in the above link could be found [[https://​github.com/​Diptanshu8/​CCExtractor-extension-module|here]]
 +  ​* ​However, there is no mandatory rule to continue hosting the source distribution from the same repository. If a user feels that a newer version for CCExtractor’s extension module is ready to be shipped, then he can follow the same steps from the link mentioned in first point of this section. In those steps, he can create a self-owned public repository and upload the module to PyPI.
  
  
  • public/gsoc/python_extension_module_compilation_documentation_gsoc_17.txt
  • Last modified: 2017/09/04 18:14
  • by skrill