From e6d123a17d9323d79d4d2022c48c605e52ff5610 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Tue, 5 Sep 2023 12:48:50 -0500 Subject: [PATCH] Switch from setup.py to pyproject.toml for CLI packaging. --- pyproject.toml | 175 ++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 127 --------------------------------- version_update.py | 3 +- 3 files changed, 177 insertions(+), 128 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..fa2ba7b3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,175 @@ +[project] +# This is the name of your project. The first time you publish this +# package, this name will be registered for you. It will determine how +# users can install this project, e.g.: +# +# $ pip install sampleproject +# + +# There are some restrictions on what makes a valid project name +# specification here: +# https://packaging.python.org/specifications/core-metadata/#name +name = "FanFicFare" # Required + +# Versions should comply with PEP 440: +# https://www.python.org/dev/peps/pep-0440/ +# +# For a discussion on single-sourcing the version, see +# https://packaging.python.org/guides/single-sourcing-package-version/ +version = "4.27.1" + +# This is a one-line description or tagline of what your project does. This +# corresponds to the "Summary" metadata field: +# https://packaging.python.org/specifications/core-metadata/#summary +description = "A tool for downloading fanfiction to eBook formats" # Optional + +# This is an optional longer description of your project that represents +# the body of text which users will see when they visit PyPI. +# +# Often, this is the same as your README, so you can just read it in from +# that file directly (as we have already done above) +# +# This field corresponds to the "Description" metadata field: +# https://packaging.python.org/specifications/core-metadata/#description-optional +readme = "DESCRIPTION.rst" # Optional + +# Specify which Python versions you support. In contrast to the +# 'Programming Language' classifiers above, 'pip install' will check this +# and refuse to install the project if the version does not match. See +# https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires +requires-python = ">=3.7" + +# This is either text indicating the license for the distribution, or a file +# that contains the license +# https://packaging.python.org/en/latest/specifications/core-metadata/#license +license = {file = "LICENSE"} + +# This field adds keywords for your project which will appear on the +# project page. What does your project relate to? +# +# Note that this is a list of additional keywords, separated +# by commas, to be used to assist searching for the distribution in a +# larger catalog. +keywords = ["fanfiction", "download", "ebook", "epub", "html"] # Optional + +# This should be your name or the name of the organization who originally +# authored the project, and a valid email address corresponding to the name +# listed. +authors = [ + {name = "Jim Miller", email = "retiefjimm@gmail.com" } # Optional +] + +# This should be your name or the names of the organization who currently +# maintains the project, and a valid email address corresponding to the name +# listed. +maintainers = [ + {name = "Jim Miller", email = "retiefjimm@gmail.com" } # Optional +] + +# Classifiers help users find your project by categorizing it. +# +# For a list of valid classifiers, see https://pypi.org/classifiers/ +classifiers = [ # Optional + # How mature is this project? Common values are + # 3 - Alpha + # 4 - Beta + # 5 - Production/Stable + "Development Status :: 5 - Production/Stable", + + "Environment :: Console", + + # Indicate who your project is intended for + "Intended Audience :: End Users/Desktop", + "Topic :: Internet :: WWW/HTTP", + + # Pick your license as you wish + "License :: OSI Approved :: Apache Software License", + + # Specify the Python versions you support here. In particular, ensure + # that you indicate you support Python 3. These classifiers are *not* + # checked by "pip install". See instead "python_requires" below. + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3 :: Only", +] + +# This field lists other packages that your project depends on to run. +# Any package you put here will be installed by pip when your project is +# installed, so they must be valid existing projects. +# +# For an analysis of this field vs pip's requirements files see: +# https://packaging.python.org/discussions/install-requires-vs-requirements/ +dependencies = [ # Optional + 'beautifulsoup4', + 'chardet', + 'html5lib', + 'html2text', + 'cloudscraper', # includes requests and deps. + 'urllib3 >= 1.26.2', # for Retry(other=) + 'requests >= 2.25.1', # otherwise version issues with urllib3 + 'requests-file', + 'brotli', + 'pywin32; platform_system=="Windows"'] +# html5lib requires 'six', FFF includes it's own copy as fanficfare.six + +# List additional groups of dependencies here (e.g. development +# dependencies). Users will be able to install these using the "extras" +# syntax, for example: +# +# $ pip install sampleproject[dev] +# +# Similar to `dependencies` above, these must be valid existing +# projects. +[project.optional-dependencies] # Optional +image_processing = ['Pillow'] + +# List URLs that are relevant to your project +# +# This field corresponds to the "Project-URL" and "Home-Page" metadata fields: +# https://packaging.python.org/specifications/core-metadata/#project-url-multiple-use +# https://packaging.python.org/specifications/core-metadata/#home-page-optional +# +# Examples listed include a pattern for specifying where the package tracks +# issues, where the source is hosted, where to say thanks to the package +# maintainers, and where to support the project financially. The key is +# what's used to render the link text on PyPI. +[project.urls] # Optional +"Homepage" = "https://github.com/JimmXinu/FanFicFare" +"Bug Reports" = "https://github.com/JimmXinu/FanFicFare/issues" +"Plugin Discussion Thread" = "https://www.mobileread.com/forums/showthread.php?t=259221" + +# The following would provide a command line executable called `sample` +# which executes the function `main` from this package when invoked. +[project.scripts] # Optional +fanficfare = "fanficfare.cli:main" + +# This is configuration specific to the `setuptools` build backend. +# If you are using a different build backend, you will need to change this. +[tool.setuptools] + +# You can just specify the packages manually here if your project is +# simple. Or you can use find_packages(). +# packages=find_packages(exclude=['contrib', 'docs', 'tests*']), +packages = ['fanficfare', + 'fanficfare.adapters', + 'fanficfare.fetchers', + 'fanficfare.writers', + 'fanficfare.browsercache', + 'fanficfare.browsercache.chromagnon'] + +# for package-data +package-dir = {"fanficfare" = "fanficfare"} + +# If there are data files included in your packages that need to be +# installed, specify them here. +package-data = {"fanficfare" = ["defaults.ini", "example.ini"]} + +[build-system] +# These are the assumed default build requirements from pip: +# https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support +requires = ["setuptools>=43.0.0"] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py deleted file mode 100644 index fb181377..00000000 --- a/setup.py +++ /dev/null @@ -1,127 +0,0 @@ - - -"""A setuptools based setup module. - -See: -https://packaging.python.org/guides/distributing-packages-using-setuptools/ -https://github.com/pypa/sampleproject -""" - -# Always prefer setuptools over distutils -from setuptools import setup -# To use a consistent encoding -import codecs - -package_name="FanFicFare" - -import sys -if sys.version_info < (2,7): - sys.exit(package_name+' requires Python 2.7 or newer.') - -# Get the long description from the relevant file -with codecs.open('DESCRIPTION.rst', encoding='utf-8') as f: - long_description = f.read() - -setup( - name=package_name, - - # Versions should comply with PEP440. - version="4.27.1", - - description='A tool for downloading fanfiction to eBook formats', - long_description=long_description, - - # The project's main homepage. - url='https://github.com/JimmXinu/FanFicFare', - - # Author details - author='Jim Miller', - author_email='retiefjimm@gmail.com', - - # Choose your license - license='Apache License', - - # See https://pypi.python.org/pypi?%3Aaction=list_classifiers - classifiers=[ - # How mature is this project? Common values are - # 3 - Alpha - # 4 - Beta - # 5 - Production/Stable - 'Development Status :: 5 - Production/Stable', - - 'Environment :: Console', - - # Indicate who your project is intended for - 'Intended Audience :: End Users/Desktop', - 'Topic :: Internet :: WWW/HTTP', - - # Pick your license as you wish (should match "license" above) - 'License :: OSI Approved :: Apache Software License', - - # Specify the Python versions you support here. In particular, ensure - # that you indicate whether you support Python 2, Python 3 or both. - # Earlier py3 version may work, but I've not tested them. - 'Programming Language :: Python :: 3.7', - ], - - # What does your project relate to? - keywords='fanfiction download ebook epub html', - - # You can just specify the packages manually here if your project is - # simple. Or you can use find_packages(). - # packages=find_packages(exclude=['contrib', 'docs', 'tests*']), - packages=['fanficfare', - 'fanficfare.adapters', 'fanficfare.fetchers', 'fanficfare.writers', - 'fanficfare.browsercache','fanficfare.browsercache.chromagnon'], - - # for package_data - package_dir={'fanficfare': 'fanficfare'}, - - # List run-time dependencies here. These will be installed by pip when - # your project is installed. For an analysis of "install_requires" vs pip's - # requirements files see: - # https://packaging.python.org/en/latest/requirements.html - install_requires=['beautifulsoup4', - 'chardet', - 'html5lib', - 'html2text', - 'cloudscraper', # includes requests and deps. - 'urllib3 >= 1.26.2', # for Retry(other=) - 'requests >= 2.25.1', # otherwise version issues with urllib3 - 'requests-file', - 'brotli', - 'pywin32; platform_system=="Windows"'], - # html5lib requires 'six', FFF includes it's own copy as fanficfare.six - - # List additional groups of dependencies here (e.g. development - # dependencies). You can install these using the following syntax, - # for example: - # $ pip install -e .[dev,test] - extras_require={ - 'image_processing': ['Pillow'], - # 'dev': ['check-manifest'], - # 'test': ['coverage'], - }, - - # If there are data files included in your packages that need to be - # installed, specify them here. If using Python 2.6 or less, then these - # have to be included in MANIFEST.in as well. - package_data={ - 'fanficfare': ['defaults.ini', 'example.ini'], - }, - - # Although 'package_data' is the preferred approach, in some case you may - # need to place data files outside of your packages. See: - # http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa - # In this case, 'data_file' will be installed into '/my_data' - # data_files=[('my_data', ['data/data_file'])], - - # To provide executable scripts, use entry points in preference to the - # "scripts" keyword. Entry points provide cross-platform support and allow - # pip to create the appropriate form of executable for the target platform. - entry_points={ - 'console_scripts': [ - 'fanficfare=fanficfare.cli:main', - ], - }, -) diff --git a/version_update.py b/version_update.py index 526dad43..9b81cd90 100644 --- a/version_update.py +++ b/version_update.py @@ -26,7 +26,8 @@ from os import rename, close, unlink version_files = [ # 'version_test.sml', # 'version_test.txt', - 'setup.py', + # 'setup.py', + 'pyproject.toml', 'calibre-plugin/__init__.py', # 'webservice/app.yaml', 'fanficfare/cli.py',