Skip to content

Commit

Permalink
Add files for PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
jarun committed Dec 21, 2019
1 parent ce05139 commit 1fc674a
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include CHANGELOG LICENSE
55 changes: 55 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env python3

import re
import shutil
import sys

from setuptools import setup, find_packages

shutil.copyfile('imgp', 'imgp.py')

with open('imgp.py', encoding='utf-8') as f:
version = re.search('_VERSION_ = \'([^\']+)\'', f.read()).group(1)

with open('README.md', encoding='utf-8') as f:
long_description = f.read()

setup(
name='imgp',
version=version,
description='High-performance CLI batch image resizer & rotator',
long_description=long_description,
long_description_content_type="text/markdown",
author='Arun Prakash Jana',
author_email='[email protected]',
url='https://github.com/jarun/imgp',
license='GPLv3',
python_requires='>=3.5', # requires pip>=9.0.0
platforms=['any'],
py_modules=['imgp'],
install_requires=['Pillow'],
include_package_data=True,
entry_points={
'console_scripts': ['imgp=imgp:main']
},
extras_require={
'packaging': ['twine']
},
keywords='image processing resize rotate optimize',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Utilities'
]
)

12 comments on commit 1fc674a

@jarun
Copy link
Owner Author

@jarun jarun commented on 1fc674a Dec 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zmwangx or @rachmadaniHaryono I have added the manifest and setup files for PyPI. Please check once. What do I do next to upload to PyPI?

@rachmadaniHaryono
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • install twine
  • twine upload --repository-url https://upload.pypi.org/legacy/ dist/imgp*.tar.gz

change the path to actual created file

@zmwangx
Copy link

@zmwangx zmwangx commented on 1fc674a Dec 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pip3 install -U wheel twine
python3 setup.py sdist
python3 setup.py bdist_wheel
# Optionally PGP-sign dist/imgp/$version{.tar.gz,-py3-none-any.whl}, producing .sig or .asc signatures which could also be uploaded, but mostly pointless.
python3 -m twine upload dist/imgp-$version{.tar.gz,-py3-none-any.whl}

@zmwangx
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw I recommend using 2FA and project-scoped API tokens with PyPI (support added earlier this year).

https://pyfound.blogspot.com/2019/07/pypi-now-supports-uploading-via-api.html

@jarun
Copy link
Owner Author

@jarun jarun commented on 1fc674a Dec 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw I recommend using 2FA and project-scoped API tokens with PyPI (support added earlier this year).

ToDo. Let me get away with this first. ;)

@zmwangx
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to mention: automatically publishing to PyPI with GitHub Actions is pretty nice. https://github.com/pypa/gh-action-pypi-publish

PyPA has an easy-to-follow guide: https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/

Here's a recent example in production from yours truly: https://github.com/zmwangx/miller-rabin/blob/master/.github/workflows/build-and-publish-distributions.yml (Way more complicated than what you need, since I'm building a statically-linked C extension there, whereas yours is just pure Python.)

@jarun
Copy link
Owner Author

@jarun jarun commented on 1fc674a Dec 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

automatically publishing to PyPI with GitHub Actions is pretty nice.

This is cool but our build service breaks and once a tag gets uploaded it gets messy. As this is only 1 package and may have a new version in 2021 I am ok to publish manually.

@zmwangx
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, but if you find yourself maintaining a dozen packages one day with a more rapid release cycle this file and forget (especially for pure Python packages) would come in handy ;)

@jarun
Copy link
Owner Author

@jarun jarun commented on 1fc674a Dec 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to Buku straight from the address bar. ;)

@jarun
Copy link
Owner Author

@jarun jarun commented on 1fc674a Dec 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ buku -p -1
511. Add files for PyPI · jarun/imgp@1fc674a · GitHub
   > https://github.com/jarun/imgp/commit/1fc674af98bcbbc7027fc208b1976550187f59f3
   + :camera_flash: High-performance CLI batch image resizer & rotator - jarun/imgp

@jarun
Copy link
Owner Author

@jarun jarun commented on 1fc674a Dec 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All done! Thanks for the help guys!

@jarun
Copy link
Owner Author

@jarun jarun commented on 1fc674a Dec 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rachmadaniHaryono I've added you as second owner on PyPI.

Please sign in to comment.