From acb5e78a6a239a1046b3170ec503646db3837b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C3=A4hr?= Date: Wed, 20 Mar 2024 16:54:26 +0300 Subject: [PATCH] convert build setup to pyproject.toml --- .github/workflows/strings.yml | 4 +- .github/workflows/style.yml | 4 +- .github/workflows/tests.yml | 2 +- .gitlab-ci.yml | 4 +- Dockerfile | 10 +-- MANIFEST.in | 30 +++++++ doc/development/setup.rst | 4 +- doc/requirements.txt | 2 +- pyproject.toml | 145 ++++++++++++++++++++++++++++++++++ setup.py | 4 + src/MANIFEST.in | 30 ------- 11 files changed, 193 insertions(+), 46 deletions(-) create mode 100644 MANIFEST.in create mode 100644 pyproject.toml create mode 100644 setup.py delete mode 100644 src/MANIFEST.in diff --git a/.github/workflows/strings.yml b/.github/workflows/strings.yml index dcb7cd06c..300e54938 100644 --- a/.github/workflows/strings.yml +++ b/.github/workflows/strings.yml @@ -31,7 +31,7 @@ jobs: - name: Install system packages run: sudo apt update && sudo apt install gettext - name: Install Dependencies - run: pip3 install -Ur src/requirements.txt + run: pip3 install -e ".[dev]" - name: Compile messages run: python manage.py compilemessages working-directory: ./src @@ -56,7 +56,7 @@ jobs: - name: Install system packages run: sudo apt update && sudo apt install enchant hunspell hunspell-de-de aspell-en aspell-de - name: Install Dependencies - run: pip3 install -Ur src/requirements/dev.txt + run: pip3 install -e ".[dev]" - name: Spellcheck translations run: potypo working-directory: ./src diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index ea65dbba7..1b4bab4ab 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -29,7 +29,7 @@ jobs: restore-keys: | ${{ runner.os }}-pip- - name: Install Dependencies - run: pip3 install -Ur src/requirements/dev.txt + run: pip3 install -e ".[dev]" psycopg2-binary - name: Run isort run: isort -c . working-directory: ./src @@ -49,7 +49,7 @@ jobs: restore-keys: | ${{ runner.os }}-pip- - name: Install Dependencies - run: pip3 install -r src/requirements.txt -Ur src/requirements/dev.txt + run: pip3 install -e ".[dev]" psycopg2-binary - name: Run flake8 run: flake8 . working-directory: ./src diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3657072cb..6a315efd0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -53,7 +53,7 @@ jobs: - name: Install system dependencies run: sudo apt update && sudo apt install gettext mysql-client - name: Install Python dependencies - run: pip3 install -r src/requirements.txt -Ur src/requirements/dev.txt mysqlclient psycopg2-binary + run: pip3 install -e ".[dev]" psycopg2-binary - name: Run checks run: python manage.py check working-directory: ./src diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6b93f3e4c..e00ffe9b3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ tests: - virtualenv env - source env/bin/activate - pip install -U pip wheel setuptools - - XDG_CACHE_HOME=/cache pip3 install -r src/requirements.txt --no-use-pep517 -Ur src/requirements/dev.txt + - XDG_CACHE_HOME=/cache pip3 install -e ".[dev]" - cd src - python manage.py check - make all compress @@ -21,7 +21,7 @@ pypi: - virtualenv env - source env/bin/activate - pip install -U pip wheel setuptools check-manifest twine - - XDG_CACHE_HOME=/cache pip3 install -Ur src/requirements.txt -r src/requirements/dev.txt + - XDG_CACHE_HOME=/cache pip3 install -e ".[dev]" - cd src - python setup.py sdist - pip install dist/pretix-*.tar.gz diff --git a/Dockerfile b/Dockerfile index 79698d1c0..0fa2500df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ FROM python:3.8 +working-directory: ./src RUN apt-get update && \ apt-get install -y --no-install-recommends \ @@ -40,17 +41,14 @@ ENV LC_ALL=C.UTF-8 \ DJANGO_SETTINGS_MODULE=production_settings # To copy only the requirements files needed to install from PIP -COPY src/requirements /pretix/src/requirements -COPY src/requirements.txt /pretix/src +COPY src/setup.py /pretix/src/setup.py RUN pip3 install -U \ pip \ setuptools \ wheel && \ cd /pretix/src && \ - pip3 install \ - -r requirements.txt \ - -r requirements/memcached.txt \ - gunicorn django-extensions ipython && \ + PRETIX_DOCKER_BUILD=TRUE pip3 install \ + -e ".[memcached]" \ rm -rf ~/.cache/pip COPY deployment/docker/pretix.bash /usr/local/bin/pretix diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..f63a1f119 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,30 @@ +include LICENSE +include README.rst +global-include *.proto +recursive-include src/pretix/static * +recursive-include src/pretix/static.dist * +recursive-include src/pretix/locale * +recursive-include src/pretix/helpers/locale * +recursive-include src/pretix/base/templates * +recursive-include src/pretix/control/templates * +recursive-include src/pretix/presale/templates * +recursive-include src/pretix/plugins/banktransfer/templates * +recursive-include src/pretix/plugins/banktransfer/static * +recursive-include src/pretix/plugins/manualpayment/templates * +recursive-include src/pretix/plugins/manualpayment/static * +recursive-include src/pretix/plugins/paypal/templates * +recursive-include src/pretix/plugins/pretixdroid/templates * +recursive-include src/pretix/plugins/pretixdroid/static * +recursive-include src/pretix/plugins/sendmail/templates * +recursive-include src/pretix/plugins/statistics/templates * +recursive-include src/pretix/plugins/statistics/static * +recursive-include src/pretix/plugins/stripe/templates * +recursive-include src/pretix/plugins/stripe/static * +recursive-include src/pretix/plugins/ticketoutputpdf/templates * +recursive-include src/pretix/plugins/ticketoutputpdf/static * +recursive-include src/pretix/plugins/badges/templates * +recursive-include src/pretix/plugins/badges/static * +recursive-include src/pretix/plugins/returnurl/templates * +recursive-include src/pretix/plugins/returnurl/static * +recursive-include src/pretix/plugins/webcheckin/templates * +recursive-include src/pretix/plugins/webcheckin/static * diff --git a/doc/development/setup.rst b/doc/development/setup.rst index a48be06c9..e61269b0e 100644 --- a/doc/development/setup.rst +++ b/doc/development/setup.rst @@ -55,11 +55,11 @@ Working with the code --------------------- The first thing you need are all the main application's dependencies:: - cd src/ - pip3 install -r requirements.txt -r requirements/dev.txt + pip3 install -e ".[dev]" Next, you need to copy the SCSS files from the source folder to the STATIC_ROOT directory:: + cd src/ python manage.py collectstatic --noinput Then, create the local database:: diff --git a/doc/requirements.txt b/doc/requirements.txt index fc47fa5a8..f31a0cdf8 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,4 +1,4 @@ --r ../src/requirements.txt +-e ../ sphinx==2.3.* sphinx-rtd-theme sphinxcontrib-httpdomain diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..b31722cac --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,145 @@ +[project] +name = "eventyay" +dynamic = ["version"] +description = "the open source event solution" +readme = "README.rst" +requires-python = ">=3.8" +license = {file = "LICENSE"} +keywords = ["tickets", "events", "web", "shop", "ecommerce"] +authors = [ {name = "eventyay", email = "info@eventyay.com"}, ] +maintainers = [ {name = "eventyay", email = "info@eventyay.com"}, ] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: Other Audience", + "Topic :: Internet :: WWW/HTTP :: Dynamic Content", + "Environment :: Web Environment", + "License :: OSI Approved :: Apache License, Version 2.0", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Framework :: Django :: 3.2", +] +dependencies = [ + 'Django==3.2.*', + 'djangorestframework==3.12.*', + 'python-dateutil==2.8.*', + 'isoweek', + 'requests==2.25.0', + 'pytz', + 'django-bootstrap3==15.0.*', + 'django-formset-js-improved==0.5.0.2', + 'django-compressor==2.4.*', + 'django-hierarkey==1.0.*,>=1.0.4', + 'django-filter==2.4.*', + 'django-scopes==1.2.*', + 'django-localflavor==3.0.*', + 'reportlab>=3.5.65', + 'Pillow==8.*', + 'PyPDF2==1.26.*', + 'django-libsass==0.8', + 'libsass==0.20.*', + 'django-otp==0.7.*,>=0.7.5', + 'webauthn==0.4.*', + 'python-u2flib-server==4.*', + 'django-formtools==2.3', + 'celery==4.4.*', + 'kombu==4.6.*', + 'django-statici18n==1.9.*', + 'inlinestyler==0.2.*', + 'BeautifulSoup4==4.8.*', + 'slimit', + 'lxml', + 'static3==0.7.*', + 'dj-static', + 'csscompressor', + 'django-markup', + 'markdown==3.3.*', + 'bleach==3.3.*', + 'sentry-sdk==0.14.*', + 'babel', + 'paypalrestsdk==1.13.*', + 'pycparser==2.13', # https://github.com/eliben/pycparser/issues/147 + 'django-redis==4.11.*', + 'redis==3.4.*', + 'stripe==2.42.*', + 'chardet<3.1.0,>=3.0.2', + 'mt-940==3.2', + 'django-i18nfield==1.9.*,>=1.9.1', + 'psycopg2-binary', + 'tqdm==4.*', + 'vobject==0.9.*', + 'pycountry', + 'django-countries>=6.0', + 'pyuca', # for better sorting of country names in django-countries + 'defusedcsv>=1.1.0', + 'vat_moss_forked==2020.3.20.0.11.0', + 'jsonschema', + 'django-hijack>=2.1.10,<2.2.0', + 'openpyxl==3.0.*', + 'django-oauth-toolkit==1.2.*', + 'oauthlib==3.1.*', + 'django-phonenumber-field==4.0.*', + 'phonenumberslite==8.11.*', + 'python-bidi==0.4.*', # Support for Arabic in reportlab + 'arabic-reshaper==2.0.15', # Support for Arabic in reportlab + 'packaging', + 'tlds>=2020041600', + 'text-unidecode==1.*', + 'protobuf==3.15.*', + 'cryptography>=3.4.2', + 'sepaxml==2.4.*,>=2.4.1', +] + +[project.optional-dependencies] +memcached = ["pylibmc"] +dev = [ + 'django-debug-toolbar==3.2', + 'pycodestyle==2.5.*', + 'pyflakes==2.1.*', + 'flake8==3.7.*', + 'pep8-naming', + 'coveralls', + 'coverage', + 'pytest==6.*', + 'pytest-django==4.*', + 'pytest-xdist==1.31.*', + 'isort', + 'pytest-mock==2.0.*', + 'pytest-rerunfailures==9.*', + 'responses==0.23.0', + 'potypo', + 'freezegun', + 'pytest-cache', + 'pytest-cov', + 'pytest-sugar', +] + +[project.entry-points."distutils.commands"] +build = "setup:CustomBuild" +build_ext = "setup:CustomBuildExt" + + +[build-system] +requires = [ + 'setuptools', + 'setuptools-rust', + 'wheel', + 'importlib_metadata', +] + +[project.urls] +homepage = "https://eventyay.com" +repository = "https://github.com/fossasia/eventyay-tickets.git" +documentation = "https://eventyay.com" +changelog = "https://eventyay.com" + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.dynamic] +version = {attr = "pretix.__version__"} + +[tool.setuptools.packages.find] +where = ["src"] +include = ["pretix*"] +namespaces = false diff --git a/setup.py b/setup.py new file mode 100644 index 000000000..1abbd068c --- /dev/null +++ b/setup.py @@ -0,0 +1,4 @@ +import setuptools + +if __name__ == "__main__": + setuptools.setup() diff --git a/src/MANIFEST.in b/src/MANIFEST.in deleted file mode 100644 index 7b2b8bf9e..000000000 --- a/src/MANIFEST.in +++ /dev/null @@ -1,30 +0,0 @@ -include LICENSE -include README.rst -global-include *.proto -recursive-include pretix/static * -recursive-include pretix/static.dist * -recursive-include pretix/locale * -recursive-include pretix/helpers/locale * -recursive-include pretix/base/templates * -recursive-include pretix/control/templates * -recursive-include pretix/presale/templates * -recursive-include pretix/plugins/banktransfer/templates * -recursive-include pretix/plugins/banktransfer/static * -recursive-include pretix/plugins/manualpayment/templates * -recursive-include pretix/plugins/manualpayment/static * -recursive-include pretix/plugins/paypal/templates * -recursive-include pretix/plugins/pretixdroid/templates * -recursive-include pretix/plugins/pretixdroid/static * -recursive-include pretix/plugins/sendmail/templates * -recursive-include pretix/plugins/statistics/templates * -recursive-include pretix/plugins/statistics/static * -recursive-include pretix/plugins/stripe/templates * -recursive-include pretix/plugins/stripe/static * -recursive-include pretix/plugins/ticketoutputpdf/templates * -recursive-include pretix/plugins/ticketoutputpdf/static * -recursive-include pretix/plugins/badges/templates * -recursive-include pretix/plugins/badges/static * -recursive-include pretix/plugins/returnurl/templates * -recursive-include pretix/plugins/returnurl/static * -recursive-include pretix/plugins/webcheckin/templates * -recursive-include pretix/plugins/webcheckin/static *