Skip to content

Commit

Permalink
Migrate setup.py to pyproject.toml
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaochao Dong (@damnever) <[email protected]>
  • Loading branch information
damnever committed Feb 17, 2024
1 parent bbfb409 commit 94eb2fc
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 79 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ count.py
/build/
/dist/
.venv*
venv*
2 changes: 1 addition & 1 deletion pigar/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
)
Expand Down
49 changes: 49 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[build-system]
requires = ["setuptools>=69.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "pigar"
authors = [{ name = "damnever", email = "[email protected]" }]
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__" }
78 changes: 2 additions & 76 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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='[email protected]',
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()

0 comments on commit 94eb2fc

Please sign in to comment.