From f5164b677d758a87666b1d6c52f987d6d3511239 Mon Sep 17 00:00:00 2001 From: Michael van Tellingen Date: Mon, 19 Aug 2024 20:01:49 +0200 Subject: [PATCH] switch to rye --- .github/workflows/python-release.yml | 6 +-- pyproject.toml | 64 ++++++++++++++++++++++------ requirements-dev.lock | 44 +++++++++++++++++++ requirements.lock | 36 ++++++++++++++++ setup.py | 62 --------------------------- tests/test_aws_mysql.py | 1 - tests/test_aws_postgresql.py | 1 - 7 files changed, 133 insertions(+), 81 deletions(-) create mode 100644 requirements-dev.lock create mode 100644 requirements.lock delete mode 100644 setup.py diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index 2118806..cc06e2f 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -15,11 +15,11 @@ jobs: with: python-version: "3.12" - - name: Install build requirements - run: python -m pip install wheel + - name: Install the latest version of rye + uses: eifinger/setup-rye@v4 - name: Build package - run: python setup.py sdist bdist_wheel + run: rye build - name: Publish package uses: pypa/gh-action-pypi-publish@master diff --git a/pyproject.toml b/pyproject.toml index 26f67b8..1bdb3f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,18 +1,54 @@ -[build-system] -requires = ["setuptools>=40.6.0", "wheel"] -build-backend = "setuptools.build_meta" +[project] +name = "django-iam-dbauth" +version = "0.2.0" +description = "Django database backends to use AWS Database IAM Authentication" +readme = "README.md" +license = { text = "MIT" } +authors = [ + { name = "Lab Digital", email = "opensource@labdigital.nl" } +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Framework :: Django", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", + "Framework :: Django :: 5.1", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "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", +] +dependencies = [ + "Django>=4.2", + "boto3", + "dnspython" +] + +[project.urls] +Homepage = "https://github.com/LabD/django-iam-dbauth" -[tool.coverage.run] -branch = true -source = ["django_iam_dbauth"] +[tool.rye] +managed = true +dev-dependencies = [ + "pytest>=8.3.2", + "coverage" +] + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" -[tool.coverage.paths] -source = ["src", ".tox/*/site-packages"] +[tool.hatch.metadata] +allow-direct-references = true -[tool.coverage.report] -show_missing = true +[tool.hatch.build.targets.wheel] +packages = ["src/django_iam_dbauth"] -[tool.isort] -profile = "black" -default_section = "THIRDPARTY" -known_first_party = ["django_iam_dbauth", "tests"] +[tool.ruff] +src = ["src", "tests"] +fix = true diff --git a/requirements-dev.lock b/requirements-dev.lock new file mode 100644 index 0000000..8873d44 --- /dev/null +++ b/requirements-dev.lock @@ -0,0 +1,44 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: false +# with-sources: false +# generate-hashes: false +# universal: false + +-e file:. +asgiref==3.8.1 + # via django +boto3==1.35.0 + # via django-iam-dbauth +botocore==1.35.0 + # via boto3 + # via s3transfer +coverage==7.6.1 +django==5.1 + # via django-iam-dbauth +dnspython==2.6.1 + # via django-iam-dbauth +iniconfig==2.0.0 + # via pytest +jmespath==1.0.1 + # via boto3 + # via botocore +packaging==24.1 + # via pytest +pluggy==1.5.0 + # via pytest +pytest==8.3.2 +python-dateutil==2.9.0.post0 + # via botocore +s3transfer==0.10.2 + # via boto3 +six==1.16.0 + # via python-dateutil +sqlparse==0.5.1 + # via django +urllib3==2.2.2 + # via botocore diff --git a/requirements.lock b/requirements.lock new file mode 100644 index 0000000..352e83f --- /dev/null +++ b/requirements.lock @@ -0,0 +1,36 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: false +# with-sources: false +# generate-hashes: false +# universal: false + +-e file:. +asgiref==3.8.1 + # via django +boto3==1.35.0 + # via django-iam-dbauth +botocore==1.35.0 + # via boto3 + # via s3transfer +django==5.1 + # via django-iam-dbauth +dnspython==2.6.1 + # via django-iam-dbauth +jmespath==1.0.1 + # via boto3 + # via botocore +python-dateutil==2.9.0.post0 + # via botocore +s3transfer==0.10.2 + # via boto3 +six==1.16.0 + # via python-dateutil +sqlparse==0.5.1 + # via django +urllib3==2.2.2 + # via botocore diff --git a/setup.py b/setup.py deleted file mode 100644 index af56e35..0000000 --- a/setup.py +++ /dev/null @@ -1,62 +0,0 @@ -import re - -from setuptools import find_packages, setup - -docs_require = [] - -tests_require = [ - "coverage[toml]>=6.2,<=6.6", - "pretend==1.0.9", - "pytest>=7.0.1,<=7.3", - "pytest-cov==4.0.0", - "pytest-mock>=3.6.1,<=3.11", - "pytest-django==4.5.2", - "psycopg2==2.9.5", - "mysqlclient==1.4.6,<=2.2", -] - - -with open("README.md") as fh: - long_description = re.sub( - ".*\n", - "", - fh.read(), - flags=re.M | re.S, - ) - -setup( - name="django-iam-dbauth", - version="0.1.4", - description="Django database backends to use AWS Database IAM Authentication", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/LabD/django-iam-dbauth", - author="Lab Digital", - author_email="opensource@labdigital.nl", - install_requires=["Django>=3.2", "boto3", "dnspython"], - tests_require=tests_require, - extras_require={"docs": docs_require, "test": tests_require}, - entry_points={}, - package_dir={"": "src"}, - packages=find_packages("src"), - include_package_data=True, - license="MIT", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Environment :: Web Environment", - "Framework :: Django", - "Framework :: Django :: 3.2", - "Framework :: Django :: 4.0", - "Framework :: Django :: 4.1", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "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", - ], - zip_safe=False, -) diff --git a/tests/test_aws_mysql.py b/tests/test_aws_mysql.py index 21cb01f..49aac48 100644 --- a/tests/test_aws_mysql.py +++ b/tests/test_aws_mysql.py @@ -5,7 +5,6 @@ def test_get_connection_params(mocker): - token_kwargs = {} def generate_db_auth_token(**kwargs): diff --git a/tests/test_aws_postgresql.py b/tests/test_aws_postgresql.py index facee64..e74b1b2 100644 --- a/tests/test_aws_postgresql.py +++ b/tests/test_aws_postgresql.py @@ -5,7 +5,6 @@ def test_get_connection_params(mocker): - token_kwargs = {} def generate_db_auth_token(**kwargs):