build: Declarative builds via pyproject.toml
There was an attempt to switch to declarative setup, which was to use setup.cfg. However, we've made more progress in the "world of packaging" since. Also, given we're using a pyproject file already to govern certain aspects of our project maintenance, it's probably a good time to bring these things together. bye-bye to clutter and confusion in maintaining multiple files and formats. We've used setuptools to package frappe for the longest time. Maybe since the first editable installation. Howver setuptools doesn't support PEP 660 yet which supports editable installs via pyproject file. So why now? Primarily because I wanted to start tracking system dependencies for Frappe. Doing so through pyproject file made the most sense. This change seemed to be the obvious pre-requisite for the upcoming changes to our packaging systems. Sys deps tracking: https://github.com/frappe/frappe/issues/13811 Flit docs: https://flit.pypa.io/en/latest/pyproject_toml.html Previous attempt: https://github.com/frappe/frappe/pull/10773 Which build tool: https://stackoverflow.com/a/69711730/10309266 PEP 660: https://peps.python.org/pep-0660/
This commit is contained in:
parent
6dfbf7b19e
commit
9f941e9312
3 changed files with 94 additions and 133 deletions
|
|
@ -1,3 +1,97 @@
|
|||
[project]
|
||||
name = "frappe"
|
||||
authors = [
|
||||
{ name = "Frappe Technologies Pvt Ltd", email = "developers@frappe.io"}
|
||||
]
|
||||
description = "Metadata driven, full-stack low code web framework"
|
||||
requires-python = ">=3.8"
|
||||
readme = "README.md"
|
||||
dynamic = ["version"]
|
||||
dependencies = [
|
||||
# core dependencies
|
||||
"Babel~=2.9.0",
|
||||
"Click~=7.1.2",
|
||||
"GitPython~=3.1.14",
|
||||
"Jinja2~=3.1.2",
|
||||
"Pillow~=9.1.1",
|
||||
"PyJWT~=2.0.1",
|
||||
"PyMySQL~=1.0.2",
|
||||
"PyPDF2~=2.1.0",
|
||||
"PyPika~=0.48.9",
|
||||
"PyQRCode~=1.2.1",
|
||||
"PyYAML~=5.4.1",
|
||||
"RestrictedPython~=5.1",
|
||||
"WeasyPrint==52.5",
|
||||
"Werkzeug~=2.1.2",
|
||||
"Whoosh~=2.7.4",
|
||||
"beautifulsoup4~=4.9.3",
|
||||
"bleach-allowlist~=1.0.3",
|
||||
"bleach~=3.3.0",
|
||||
"cairocffi==1.2.0",
|
||||
"chardet~=4.0.0",
|
||||
"croniter~=1.3.5",
|
||||
"cryptography~=37.0.2",
|
||||
"email-reply-parser~=0.5.12",
|
||||
"git-url-parse~=1.2.2",
|
||||
"gitdb~=4.0.7",
|
||||
"gunicorn~=20.1.0",
|
||||
"html2text==2020.1.16",
|
||||
"html5lib~=1.1",
|
||||
"ipython~=8.4.0",
|
||||
"ldap3~=2.9",
|
||||
"markdown2~=2.4.0",
|
||||
"maxminddb-geolite2==2018.703",
|
||||
"num2words~=0.5.10",
|
||||
"oauthlib~=3.1.0",
|
||||
"openpyxl~=3.0.7",
|
||||
"parse~=1.19.0",
|
||||
"passlib~=1.7.4",
|
||||
"pdfkit~=1.0.0",
|
||||
"phonenumbers==8.12.40",
|
||||
"premailer~=3.8.0",
|
||||
"psutil~=5.9.1",
|
||||
"psycopg2-binary~=2.9.1",
|
||||
"pyOpenSSL~=20.0.1",
|
||||
"pyasn1~=0.4.8",
|
||||
"pycryptodome~=3.10.1",
|
||||
"pyotp~=2.6.0",
|
||||
"pypng~=0.0.20",
|
||||
"python-dateutil~=2.8.1",
|
||||
"pytz==2022.1",
|
||||
"rauth~=0.7.3",
|
||||
"redis~=3.5.3",
|
||||
"requests-oauthlib~=1.3.0",
|
||||
"requests~=2.27.1",
|
||||
"rq~=1.10.1",
|
||||
"rsa>=4.1",
|
||||
"schedule~=1.1.0",
|
||||
"semantic-version~=2.10.0",
|
||||
"sqlparse~=0.4.1",
|
||||
"tenacity~=8.0.1",
|
||||
"terminaltables~=3.1.0",
|
||||
"traceback-with-variables~=2.0.4",
|
||||
"urllib3~=1.26.4",
|
||||
"xlrd~=2.0.1",
|
||||
"zxcvbn-python~=4.4.24",
|
||||
|
||||
# integration dependencies
|
||||
"boto3~=1.17.53",
|
||||
"braintree~=4.8.0",
|
||||
"dropbox~=11.7.0",
|
||||
"google-api-python-client~=2.2.0",
|
||||
"google-auth-httplib2~=0.1.0",
|
||||
"google-auth-oauthlib~=0.4.4",
|
||||
"google-auth~=1.29.0",
|
||||
"googlemaps~=4.4.5",
|
||||
"paytmchecksum~=1.7.0",
|
||||
"razorpay~=1.2.0",
|
||||
"stripe~=2.56.0",
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["flit_core >=3.4,<4"]
|
||||
build-backend = "flit_core.buildapi"
|
||||
|
||||
[tool.black]
|
||||
line-length = 99
|
||||
|
||||
|
|
|
|||
|
|
@ -1,75 +0,0 @@
|
|||
Babel~=2.9.0
|
||||
beautifulsoup4~=4.9.3
|
||||
bleach-allowlist~=1.0.3
|
||||
bleach~=3.3.0
|
||||
boto3~=1.17.53
|
||||
braintree~=4.8.0
|
||||
chardet~=4.0.0
|
||||
Click~=7.1.2
|
||||
croniter~=1.3.5
|
||||
cryptography~=37.0.2
|
||||
dropbox~=11.7.0
|
||||
email-reply-parser~=0.5.12
|
||||
git-url-parse~=1.2.2
|
||||
gitdb~=4.0.7
|
||||
GitPython~=3.1.14
|
||||
google-api-python-client~=2.2.0
|
||||
google-auth-httplib2~=0.1.0
|
||||
google-auth-oauthlib~=0.4.4
|
||||
google-auth~=1.29.0
|
||||
googlemaps~=4.4.5
|
||||
gunicorn~=20.1.0
|
||||
html2text==2020.1.16
|
||||
html5lib~=1.1
|
||||
ipython~=8.4.0
|
||||
Jinja2~=3.1.2
|
||||
ldap3~=2.9
|
||||
markdown2~=2.4.0
|
||||
maxminddb-geolite2==2018.703
|
||||
num2words~=0.5.10
|
||||
oauthlib~=3.1.0
|
||||
openpyxl~=3.0.7
|
||||
parse~=1.19.0
|
||||
passlib~=1.7.4
|
||||
paytmchecksum~=1.7.0
|
||||
pdfkit~=1.0.0
|
||||
Pillow~=9.1.1
|
||||
premailer~=3.8.0
|
||||
psutil~=5.9.1
|
||||
psycopg2-binary~=2.9.1
|
||||
pyasn1~=0.4.8
|
||||
pycryptodome~=3.10.1
|
||||
PyJWT~=2.0.1
|
||||
PyMySQL~=1.0.2
|
||||
pyOpenSSL~=20.0.1
|
||||
pyotp~=2.6.0
|
||||
PyPDF2~=2.1.0
|
||||
PyPika~=0.48.9
|
||||
pypng~=0.0.20
|
||||
PyQRCode~=1.2.1
|
||||
python-dateutil~=2.8.1
|
||||
pytz==2022.1
|
||||
PyYAML~=5.4.1
|
||||
rauth~=0.7.3
|
||||
razorpay~=1.2.0
|
||||
redis~=3.5.3
|
||||
requests-oauthlib~=1.3.0
|
||||
requests~=2.27.1
|
||||
RestrictedPython~=5.1
|
||||
rq~=1.10.1
|
||||
rsa>=4.1 # not directly required, pinned by Snyk to avoid a vulnerability
|
||||
schedule~=1.1.0
|
||||
semantic-version~=2.10.0
|
||||
sqlparse~=0.4.1
|
||||
stripe~=2.56.0
|
||||
terminaltables~=3.1.0
|
||||
traceback-with-variables~=2.0.4
|
||||
urllib3~=1.26.4
|
||||
Werkzeug~=2.1.2
|
||||
Whoosh~=2.7.4
|
||||
xlrd~=2.0.1
|
||||
zxcvbn-python~=4.4.24
|
||||
tenacity~=8.0.1
|
||||
cairocffi==1.2.0
|
||||
WeasyPrint==52.5
|
||||
phonenumbers==8.12.40
|
||||
58
setup.py
58
setup.py
|
|
@ -1,58 +0,0 @@
|
|||
# imports - standard imports
|
||||
import ast
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
from distutils.command.clean import clean as Clean
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
# get version from __version__ variable in frappe/__init__.py
|
||||
_version_re = re.compile(r"__version__\s+=\s+(.*)")
|
||||
|
||||
with open("requirements.txt") as f:
|
||||
install_requires = f.read().strip().split("\n")
|
||||
|
||||
with open("frappe/__init__.py", "rb") as f:
|
||||
version = str(ast.literal_eval(_version_re.search(f.read().decode("utf-8")).group(1)))
|
||||
|
||||
|
||||
class CleanCommand(Clean):
|
||||
def run(self):
|
||||
Clean.run(self)
|
||||
|
||||
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
for relpath in ["build", ".cache", ".coverage", "dist", "frappe.egg-info"]:
|
||||
abspath = os.path.join(basedir, relpath)
|
||||
if os.path.exists(abspath):
|
||||
if os.path.isfile(abspath):
|
||||
os.remove(abspath)
|
||||
else:
|
||||
shutil.rmtree(abspath)
|
||||
|
||||
for dirpath, dirnames, filenames in os.walk(basedir):
|
||||
for filename in filenames:
|
||||
_, extension = os.path.splitext(filename)
|
||||
if extension in [".pyc"]:
|
||||
abspath = os.path.join(dirpath, filename)
|
||||
os.remove(abspath)
|
||||
for dirname in dirnames:
|
||||
if dirname in ["__pycache__"]:
|
||||
abspath = os.path.join(dirpath, dirname)
|
||||
shutil.rmtree(abspath)
|
||||
|
||||
|
||||
setup(
|
||||
name="frappe",
|
||||
version=version,
|
||||
description="Metadata driven, full-stack web framework",
|
||||
author="Frappe Technologies",
|
||||
author_email="info@frappe.io",
|
||||
packages=find_packages(),
|
||||
zip_safe=False,
|
||||
include_package_data=True,
|
||||
install_requires=install_requires,
|
||||
cmdclass={"clean": CleanCommand},
|
||||
python_requires=">=3.8",
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue