diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 6756a211a..d163b26a9 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -18,10 +18,10 @@ jobs: python-version: 3.12 - name: Install pip - run: pip install -r requirements/pip.txt + run: pip install -r requirements/pip.txt build - name: Build the package (openedx-core) - run: python setup.py sdist bdist_wheel + run: python -m build - name: Publish openedx-core to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/MANIFEST.in b/MANIFEST.in index 03537f8a8..0e0586496 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,4 @@ include CHANGELOG.rst include LICENSE.txt include README.rst -include requirements/base.in recursive-include src *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.py *.yaml *.json *.csv diff --git a/Makefile b/Makefile index 21c31db3d..1f14a90ec 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ compile-requirements: ## update the requirements/*.txt files with the latest pac $(PIP_COMPILE) -o requirements/pip-tools.txt requirements/pip-tools.in pip install -qr requirements/pip.txt pip install -qr requirements/pip-tools.txt - $(PIP_COMPILE) -o requirements/base.txt requirements/base.in + $(PIP_COMPILE) -o requirements/base.txt -c requirements/constraints.txt pyproject.toml $(PIP_COMPILE) -o requirements/test.txt requirements/test.in $(PIP_COMPILE) -o requirements/doc.txt requirements/doc.in $(PIP_COMPILE) -o requirements/quality.txt requirements/quality.in diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..6b4c80013 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,53 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "openedx-core" +description = "Open edX Core: Foundational Packages for a Teaching & Learning Platform" +authors = [{name = "David Ormsbee", email = "dave@axim.org"}] +readme = {file = "README.rst", content-type = "text/x-rst"} +license = "AGPL-3.0-only" +license-files = ["LICENSE.txt"] +requires-python = ">=3.12" +keywords = ["Python", "edx"] +classifiers = [ + "Development Status :: 4 - Beta", + "Framework :: Django", + "Framework :: Django :: 5.2", + "Intended Audience :: Developers", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.12", +] +dependencies = [ + "attrs", # Reduces boilerplate code involving class attributes + "celery", # Asynchronous task execution library + "Django", # Web application framework + "djangorestframework<4.0", # REST API + "edx-drf-extensions", # Extensions to the Django REST Framework used by Open edX + "openedx-events", # For sending events to the openedx event bus + "rules<4.0", # Django extension for rules-based authorization checks + "tomlkit", # Parses and writes TOML configuration files + "edx-organizations", # Implements the "Organization" model that CatalogCourse/CourseRun key to +] +dynamic = ["version"] + +[project.urls] +Homepage = "https://github.com/openedx/openedx-core" + +[tool.setuptools] +zip-safe = false +include-package-data = true + +[tool.setuptools.dynamic] +version = {attr = "openedx_core.__version__"} + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.isort] +include_trailing_comma = true +indent = " " +line_length = 120 +multi_line_output = 3 diff --git a/requirements/base.in b/requirements/base.in deleted file mode 100644 index 626a551be..000000000 --- a/requirements/base.in +++ /dev/null @@ -1,19 +0,0 @@ -# Core requirements for using this application --c constraints.txt - -attrs # Reduces boilerplate code involving class attributes - -celery # Asynchronous task execution library - -Django # Web application framework - -djangorestframework<4.0 # REST API -edx-drf-extensions # Extensions to the Django REST Framework used by Open edX - -openedx-events # For sending events to the openedx event bus - -rules<4.0 # Django extension for rules-based authorization checks - -tomlkit # Parses and writes TOML configuration files - -edx-organizations # Implemented the "Organization" model that CatalogCourse/CourseRun are keyed to diff --git a/requirements/base.txt b/requirements/base.txt index 7c8e479b5..4d39a39d2 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -10,12 +10,12 @@ asgiref==3.11.1 # via django attrs==26.1.0 # via - # -r requirements/base.in + # openedx-core (pyproject.toml) # openedx-events billiard==4.2.4 # via celery celery==5.6.3 - # via -r requirements/base.in + # via openedx-core (pyproject.toml) certifi==2026.4.22 # via requests cffi==2.0.0 @@ -42,7 +42,6 @@ cryptography==48.0.0 django==5.2.14 # via # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt - # -r requirements/base.in # django-crum # django-model-utils # django-simple-history @@ -52,6 +51,7 @@ django==5.2.14 # edx-django-utils # edx-drf-extensions # edx-organizations + # openedx-core (pyproject.toml) # openedx-events django-crum==0.7.9 # via edx-django-utils @@ -65,10 +65,10 @@ django-waffle==5.0.0 # edx-drf-extensions djangorestframework==3.17.1 # via - # -r requirements/base.in # drf-jwt # edx-drf-extensions # edx-organizations + # openedx-core (pyproject.toml) dnspython==2.8.0 # via pymongo drf-jwt==1.19.2 @@ -81,8 +81,8 @@ edx-django-utils==8.0.1 # openedx-events edx-drf-extensions==10.6.0 # via - # -r requirements/base.in # edx-organizations + # openedx-core (pyproject.toml) edx-opaque-keys[django]==4.0.0 # via # edx-ccx-keys @@ -90,7 +90,7 @@ edx-opaque-keys[django]==4.0.0 # edx-organizations # openedx-events edx-organizations==8.0.0 - # via -r requirements/base.in + # via openedx-core (pyproject.toml) fastavro==1.12.2 # via openedx-events idna==3.15 @@ -98,7 +98,7 @@ idna==3.15 kombu==5.6.2 # via celery openedx-events==11.2.0 - # via -r requirements/base.in + # via openedx-core (pyproject.toml) packaging==26.2 # via kombu pillow==12.2.0 @@ -122,7 +122,7 @@ python-dateutil==2.9.0.post0 requests==2.34.2 # via edx-drf-extensions rules==3.5 - # via -r requirements/base.in + # via openedx-core (pyproject.toml) semantic-version==2.10.0 # via edx-drf-extensions six==1.17.0 @@ -136,7 +136,7 @@ stevedore==5.7.0 # edx-django-utils # edx-opaque-keys tomlkit==0.15.0 - # via -r requirements/base.in + # via openedx-core (pyproject.toml) typing-extensions==4.15.0 # via edx-opaque-keys tzdata==2026.2 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 9a902de5c..000000000 --- a/setup.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[isort] -include_trailing_comma = True -indent = ' ' -line_length = 120 -multi_line_output = 3 - -[wheel] -universal = 1 diff --git a/setup.py b/setup.py deleted file mode 100755 index ea3e2478d..000000000 --- a/setup.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -""" -Package metadata for openedx-core. -""" -import os -import re -import sys - -from setuptools import find_packages, setup - - -def get_version(*file_paths): - """ - Extract the version string from the file. - - Input: - - file_paths: relative path fragments to file with - version string - """ - filename = os.path.join(os.path.dirname(__file__), *file_paths) - version_file = open(filename).read() - version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", - version_file, re.M) - if version_match: - return version_match.group(1) - raise RuntimeError('Unable to find version string.') - - -def load_requirements(*requirements_paths): - """ - Load all requirements from the specified requirements files. - - Returns: - list: Requirements file relative path strings - """ - requirements = set() - for path in requirements_paths: - requirements.update( - line.split('#')[0].strip() for line in open(path).readlines() - if is_requirement(line.strip()) - ) - return list(requirements) - - -def is_requirement(line): - """ - Return True if the requirement line is a package requirement. - - Returns: - bool: True if the line is not blank, a comment, a URL, or - an included file - """ - return line and not line.startswith(('-r', '#', '-e', 'git+', '-c')) - - -VERSION = get_version('src', 'openedx_core', '__init__.py') - -if sys.argv[-1] == 'tag': - print("Tagging the version on github:") - os.system("git tag -a %s -m 'version %s'" % (VERSION, VERSION)) - os.system("git push --tags") - sys.exit() - -README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() - -setup( - name='openedx-core', - version=VERSION, - description="Open edX Core: Foundational Packages for a Teaching & Learning Platform""", - long_description=README, - author='David Ormsbee', - author_email='dave@axim.org', - url='https://github.com/openedx/openedx-core', - package_dir={"": "src"}, - packages=find_packages("src"), - include_package_data=True, - install_requires=load_requirements('requirements/base.in'), - python_requires=">=3.12", - license="AGPL-3.0-only", - zip_safe=False, - keywords='Python edx', - classifiers=[ - 'Development Status :: 4 - Beta', - 'Framework :: Django', - 'Framework :: Django :: 5.2', - 'Intended Audience :: Developers', - 'Natural Language :: English', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.12', - ], -) diff --git a/tox.ini b/tox.ini index ad8736086..7b359f50b 100644 --- a/tox.ini +++ b/tox.ini @@ -67,7 +67,7 @@ commands = rm -f docs/modules.rst make -e -C docs clean make -e -C docs html - python setup.py check --restructuredtext --strict + python -m readme_renderer README.rst -o /dev/null [testenv:quality] usedevelop = True # install -e . @@ -79,11 +79,11 @@ deps = setuptools -r{toxinidir}/requirements/quality.txt commands = - pylint src tests test_utils setup.py manage.py test_settings.py mysql_test_settings.py + pylint src tests test_utils manage.py test_settings.py mysql_test_settings.py mypy --show-traceback - pycodestyle src tests test_utils setup.py manage.py test_settings.py mysql_test_settings.py + pycodestyle src tests test_utils manage.py test_settings.py mysql_test_settings.py pydocstyle src # don't need to lint docs for tests & utils - isort --check-only --diff src tests test_utils setup.py manage.py test_settings.py mysql_test_settings.py + isort --check-only --diff src tests test_utils manage.py test_settings.py mysql_test_settings.py make selfcheck [testenv:pii_check]