decalage2 / olefile

olefile is a Python package to parse, read and write Microsoft OLE2 files (also called Structured Storage, Compound File Binary Format or Compound Document File Format), such as Microsoft Office 97-2003 documents, vbaProject.bin in MS Office 2007+ files, Image Composer and FlashPix files, Outlook messages, StickyNotes, several Microscopy file formats, McAfee antivirus quarantine files, etc.
http://www.decalage.info/olefile
Other
225 stars 76 forks source link

Remove discouraged PyPI commands #130

Closed hugovk closed 4 years ago

hugovk commented 4 years ago

Warning: In other resources you may encounter references to using python setup.py register and python setup.py upload. These methods of registering and uploading a package are strongly discouraged as it may use a plaintext HTTP or unverified HTTPS connection on some Python versions, allowing your username and password to be intercepted during transmission.

https://packaging.python.org/guides/distributing-packages-using-setuptools/#uploading-your-project-to-pypi

Twine is recommended for upload, do pip install -U twine first:

https://packaging.python.org/guides/distributing-packages-using-setuptools/#upload-your-distributions

You may want to be a bit more specific with the filename spec each time, for example:

twine upload dist/olefile-0.47*

Actually, I guess you're not using either of make_dist*.py, as they create gztar and zip, but only zip has been uploaded: https://pypi.org/project/olefile/0.46/#files (I think PyPI only allows one zip format).

hugovk commented 4 years ago

I also recommend creating and uploading wheels. For example:

$ python setup.py sdist --format zip bdist_wheel
<class 'type'>
<class 'type'>
running sdist
running egg_info
writing olefile.egg-info/PKG-INFO
writing dependency_links to olefile.egg-info/dependency_links.txt
writing top-level names to olefile.egg-info/top_level.txt
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'doc/_build'
writing manifest file 'olefile.egg-info/SOURCES.txt'
running check
creating olefile-0.47.dev3
creating olefile-0.47.dev3/.github
creating olefile-0.47.dev3/.github/ISSUE_TEMPLATE
creating olefile-0.47.dev3/doc
creating olefile-0.47.dev3/doc/__pycache__
creating olefile-0.47.dev3/olefile
creating olefile-0.47.dev3/olefile.egg-info
creating olefile-0.47.dev3/tests
creating olefile-0.47.dev3/tests/__pycache__
creating olefile-0.47.dev3/tests/images
creating olefile-0.47.dev3/winbuild
copying files to olefile-0.47.dev3...
copying .coveragerc -> olefile-0.47.dev3
copying .editorconfig -> olefile-0.47.dev3
copying .gitignore -> olefile-0.47.dev3
copying .travis.yml -> olefile-0.47.dev3
copying CHANGELOG.md -> olefile-0.47.dev3
copying CONTRIBUTORS.txt -> olefile-0.47.dev3
copying LICENSE.txt -> olefile-0.47.dev3
copying MANIFEST.in -> olefile-0.47.dev3
copying README.md -> olefile-0.47.dev3
copying appveyor.yml -> olefile-0.47.dev3
copying install.bat -> olefile-0.47.dev3
copying make_dist.py -> olefile-0.47.dev3
copying make_dist_upload.py -> olefile-0.47.dev3
copying register_pypi.py -> olefile-0.47.dev3
copying setup.cfg -> olefile-0.47.dev3
copying setup.py -> olefile-0.47.dev3
copying .github/ISSUE_TEMPLATE/bug_report.md -> olefile-0.47.dev3/.github/ISSUE_TEMPLATE
copying .github/ISSUE_TEMPLATE/feature_request.md -> olefile-0.47.dev3/.github/ISSUE_TEMPLATE
copying doc/Contribute.rst -> olefile-0.47.dev3/doc
copying doc/FAQ.rst -> olefile-0.47.dev3/doc
copying doc/Features.rst -> olefile-0.47.dev3/doc
copying doc/History.rst -> olefile-0.47.dev3/doc
copying doc/Howto.rst -> olefile-0.47.dev3/doc
copying doc/Install.rst -> olefile-0.47.dev3/doc
copying doc/License.rst -> olefile-0.47.dev3/doc
copying doc/Makefile -> olefile-0.47.dev3/doc
copying doc/OLE_Overview.rst -> olefile-0.47.dev3/doc
copying doc/OLE_VBA_sample.png -> olefile-0.47.dev3/doc
copying doc/conf.py -> olefile-0.47.dev3/doc
copying doc/index.rst -> olefile-0.47.dev3/doc
copying doc/make.bat -> olefile-0.47.dev3/doc
copying doc/olefile.rst -> olefile-0.47.dev3/doc
copying doc/__pycache__/conf.cpython-38.pyc -> olefile-0.47.dev3/doc/__pycache__
copying olefile/__init__.py -> olefile-0.47.dev3/olefile
copying olefile/olefile.py -> olefile-0.47.dev3/olefile
copying olefile.egg-info/PKG-INFO -> olefile-0.47.dev3/olefile.egg-info
copying olefile.egg-info/SOURCES.txt -> olefile-0.47.dev3/olefile.egg-info
copying olefile.egg-info/dependency_links.txt -> olefile-0.47.dev3/olefile.egg-info
copying olefile.egg-info/top_level.txt -> olefile-0.47.dev3/olefile.egg-info
copying tests/__init__.py -> olefile-0.47.dev3/tests
copying tests/__init__.pyc -> olefile-0.47.dev3/tests
copying tests/test_olefile.py -> olefile-0.47.dev3/tests
copying tests/test_olefile.pyc -> olefile-0.47.dev3/tests
copying tests/__pycache__/__init__.cpython-38.pyc -> olefile-0.47.dev3/tests/__pycache__
copying tests/__pycache__/test_olefile.cpython-38.pyc -> olefile-0.47.dev3/tests/__pycache__
copying tests/images/flower.jpg -> olefile-0.47.dev3/tests/images
copying tests/images/test-ole-file.doc -> olefile-0.47.dev3/tests/images
copying winbuild/appveyor_install_pypy.cmd -> olefile-0.47.dev3/winbuild
Writing olefile-0.47.dev3/setup.cfg
creating 'dist/olefile-0.47.dev3.zip' and adding 'olefile-0.47.dev3' to it
adding 'olefile-0.47.dev3'
adding 'olefile-0.47.dev3/olefile'
adding 'olefile-0.47.dev3/winbuild'
adding 'olefile-0.47.dev3/tests'
adding 'olefile-0.47.dev3/.github'
adding 'olefile-0.47.dev3/doc'
adding 'olefile-0.47.dev3/olefile.egg-info'
adding 'olefile-0.47.dev3/PKG-INFO'
adding 'olefile-0.47.dev3/CHANGELOG.md'
adding 'olefile-0.47.dev3/MANIFEST.in'
adding 'olefile-0.47.dev3/.coveragerc'
adding 'olefile-0.47.dev3/make_dist_upload.py'
adding 'olefile-0.47.dev3/.editorconfig'
adding 'olefile-0.47.dev3/README.md'
adding 'olefile-0.47.dev3/appveyor.yml'
adding 'olefile-0.47.dev3/setup.py'
adding 'olefile-0.47.dev3/make_dist.py'
adding 'olefile-0.47.dev3/install.bat'
adding 'olefile-0.47.dev3/.gitignore'
adding 'olefile-0.47.dev3/setup.cfg'
adding 'olefile-0.47.dev3/register_pypi.py'
adding 'olefile-0.47.dev3/LICENSE.txt'
adding 'olefile-0.47.dev3/CONTRIBUTORS.txt'
adding 'olefile-0.47.dev3/.travis.yml'
adding 'olefile-0.47.dev3/olefile/olefile.py'
adding 'olefile-0.47.dev3/olefile/__init__.py'
adding 'olefile-0.47.dev3/winbuild/appveyor_install_pypy.cmd'
adding 'olefile-0.47.dev3/tests/images'
adding 'olefile-0.47.dev3/tests/__pycache__'
adding 'olefile-0.47.dev3/tests/test_olefile.py'
adding 'olefile-0.47.dev3/tests/__init__.py'
adding 'olefile-0.47.dev3/tests/__init__.pyc'
adding 'olefile-0.47.dev3/tests/test_olefile.pyc'
adding 'olefile-0.47.dev3/tests/images/test-ole-file.doc'
adding 'olefile-0.47.dev3/tests/images/flower.jpg'
adding 'olefile-0.47.dev3/tests/__pycache__/test_olefile.cpython-38.pyc'
adding 'olefile-0.47.dev3/tests/__pycache__/__init__.cpython-38.pyc'
adding 'olefile-0.47.dev3/.github/ISSUE_TEMPLATE'
adding 'olefile-0.47.dev3/.github/ISSUE_TEMPLATE/feature_request.md'
adding 'olefile-0.47.dev3/.github/ISSUE_TEMPLATE/bug_report.md'
adding 'olefile-0.47.dev3/doc/__pycache__'
adding 'olefile-0.47.dev3/doc/Install.rst'
adding 'olefile-0.47.dev3/doc/index.rst'
adding 'olefile-0.47.dev3/doc/Contribute.rst'
adding 'olefile-0.47.dev3/doc/Features.rst'
adding 'olefile-0.47.dev3/doc/Makefile'
adding 'olefile-0.47.dev3/doc/conf.py'
adding 'olefile-0.47.dev3/doc/OLE_Overview.rst'
adding 'olefile-0.47.dev3/doc/olefile.rst'
adding 'olefile-0.47.dev3/doc/make.bat'
adding 'olefile-0.47.dev3/doc/History.rst'
adding 'olefile-0.47.dev3/doc/License.rst'
adding 'olefile-0.47.dev3/doc/OLE_VBA_sample.png'
adding 'olefile-0.47.dev3/doc/FAQ.rst'
adding 'olefile-0.47.dev3/doc/Howto.rst'
adding 'olefile-0.47.dev3/doc/__pycache__/conf.cpython-38.pyc'
adding 'olefile-0.47.dev3/olefile.egg-info/PKG-INFO'
adding 'olefile-0.47.dev3/olefile.egg-info/SOURCES.txt'
adding 'olefile-0.47.dev3/olefile.egg-info/top_level.txt'
adding 'olefile-0.47.dev3/olefile.egg-info/dependency_links.txt'
removing 'olefile-0.47.dev3' (and everything under it)
running bdist_wheel
running build
running build_py
installing to build/bdist.macosx-10.9-x86_64/wheel
running install
running install_lib
creating build/bdist.macosx-10.9-x86_64/wheel
creating build/bdist.macosx-10.9-x86_64/wheel/olefile
copying build/lib/olefile/olefile.py -> build/bdist.macosx-10.9-x86_64/wheel/olefile
copying build/lib/olefile/__init__.py -> build/bdist.macosx-10.9-x86_64/wheel/olefile
running install_egg_info
Copying olefile.egg-info to build/bdist.macosx-10.9-x86_64/wheel/olefile-0.47.dev3-py3.8.egg-info
running install_scripts
creating build/bdist.macosx-10.9-x86_64/wheel/olefile-0.47.dev3.dist-info/WHEEL
creating 'dist/olefile-0.47.dev3-py2.py3-none-any.whl' and adding 'build/bdist.macosx-10.9-x86_64/wheel' to it
adding 'olefile/__init__.py'
adding 'olefile/olefile.py'
adding 'olefile-0.47.dev3.dist-info/LICENSE.txt'
adding 'olefile-0.47.dev3.dist-info/METADATA'
adding 'olefile-0.47.dev3.dist-info/WHEEL'
adding 'olefile-0.47.dev3.dist-info/top_level.txt'
adding 'olefile-0.47.dev3.dist-info/RECORD'
removing build/bdist.macosx-10.9-x86_64/wheel
$ ls -l dist
total 328
-rw-r--r--  1 hugo  staff   38373 12 Mar 11:36 olefile-0.47.dev3-py2.py3-none-any.whl
-rw-r--r--  1 hugo  staff  123950 12 Mar 11:36 olefile-0.47.dev3.zip
$

The main advantage here is the installation file is 30% of the size, plus the reasons given at https://pythonwheels.com.

A source distribution (eg. zip) should still be uploaded for people who need to inspect that.

For local testing, you can do pip install dist/olefile-0.47.dev3-py2.py3-none-any.whl

decalage2 commented 4 years ago

Hi @hugovk, you're right I have not used those scripts for a while as they didn't work anymore, and I'm using twine instead to upload packages to PyPI. And so far I was not producing wheels because I thought zip was the most supported solution to cover any platform. I'll make a wheel distribution for the next version, then.

hugovk commented 4 years ago

Sounds good, I've updated this PR to remove make_dist* too.

decalage2 commented 4 years ago

Well, I actually use make_dist.py, and then twine to upload the result to PyPI. Maybe make_dist can be improved to create both the zip and the wheel distributions?

hugovk commented 4 years ago

Good idea, updated!