diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 6cc0e80..2b453ef 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -3,7 +3,7 @@ github: damnever patreon: # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username +ko_fi: damnever tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry liberapay: # Replace with a single Liberapay username diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 489dba6..91dbc4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,6 @@ jobs: strategy: matrix: python-version: - - "3.7" - "3.8" - "3.9" - "3.10" diff --git a/.gitignore b/.gitignore index de4f928..26e8d1a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ count.py /build/ /dist/ .venv* +venv* diff --git a/pigar/tests/test_cli.py b/pigar/tests/test_cli.py index d246c16..dc0bb58 100644 --- a/pigar/tests/test_cli.py +++ b/pigar/tests/test_cli.py @@ -36,7 +36,7 @@ def test_generate(self): 'gen', '--with-referenced-comments', '--dont-show-differences', '--exclude-glob', '**/tests/data/*', '--exclude-glob', - '**/_vendor/pip/_vendor/*', '-f', + '**/_vendor/pip/*', '-f', generated_requirement_file, project_path ] ) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..cb635d8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,49 @@ +[build-system] +requires = ["setuptools>=69.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "pigar" +authors = [{ name = "damnever", email = "the.xcdong@gmail.com" }] +description = "A tool to generate requirements.txt for Python project." +readme = "README.md" +keywords = ["requirements.txt", "automation", "tool", "module-search"] +license = { text = "BSD 3-Clause License" } +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Topic :: Utilities", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] +requires-python = ">=3.8" +dependencies = ["click>=8.1", "nbformat>=5.7", "aiohttp>=3.9"] +dynamic = ["version"] + +[project.scripts] +pigar = "pigar.__main__:main" + +[project.gui-scripts] +pigar = "pigar.__main__:main" + +[project.urls] +Documentation = "https://github.com/damnever/pigar" +Source = "https://github.com/damnever/pigar" + +[tool.setuptools] +package-dir = { "pigar" = "pigar" } +include-package-data = true +license-files = ["LICENSE", "pigar/_vendor/pip/LICENSE.txt"] + +[tool.setuptools.packages.find] +where = ["pigar"] +exclude = ["*.tests", "*.tests.*", "tests.*", "tests"] + +[tool.setuptools.dynamic] +version = { attr = "pigar.version.__version__" } diff --git a/setup.py b/setup.py index ba71a92..6068493 100644 --- a/setup.py +++ b/setup.py @@ -1,77 +1,3 @@ -import re -import codecs +from setuptools import setup -from setuptools import setup, find_packages - -version = '' -with open('pigar/version.py', 'r') as f: - version = re.search( - r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.M - ).group(1) - -if not version: - raise RuntimeError('Cannot find version information') - -long_description = """ -- Generating requirements.txt for Python project. - - Handling the difference between different Python versions. - - Jupyter notebook (`*.ipynb`) support. - - Including the import statements/magic from ``exec``/``eval``/``importlib``, doctest of docstring, etc. -- Searching ditributions(packages) by the top level import/module names. -- Checking the latest versions of requirements. - -Note that pigar is not a package management tool. - -You can find more information on [GitHub](https://github.com/damnever/pigar). -""" # noqa - -with codecs.open('CHANGELOG.md', encoding='utf-8') as f: - change_logs = f.read() - -install_requires = [ - 'click>=8.1', - 'nbformat>=5.7', - 'aiohttp>=3.8', -] - -setup( - name='pigar', - version=version, - description=( - 'A fantastic tool to generate requirements for your' - ' Python project, and more than that.' - ), - long_description=long_description + '\n\n' + change_logs, - long_description_content_type="text/markdown", - project_urls={ - 'Documentation': 'https://github.com/damnever/pigar', - 'Source': 'https://github.com/damnever/pigar', - }, - author='damnever', - author_email='the.xcdong@gmail.com', - url="https://github.com/damnever/pigar", - license='The BSD 3-Clause License', - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Topic :: Utilities', - 'License :: OSI Approved :: BSD License', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: 3 :: Only', - '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', - ], - keywords='requirements.txt,automation,tool,module-search', - packages=find_packages( - exclude=["*.tests", "*.tests.*", "tests.*", "tests"] - ), - python_requires='>=3.7', - install_requires=install_requires, - include_package_data=True, - entry_points={'console_scripts': [ - 'pigar=pigar.__main__:main', - ]}, -) +setup()