diff --git a/.github/workflows/ci_psycopg2.yml b/.github/workflows/ci_psycopg2.yml index fdfeb15..d32683b 100644 --- a/.github/workflows/ci_psycopg2.yml +++ b/.github/workflows/ci_psycopg2.yml @@ -62,5 +62,5 @@ jobs: - run: pip install psycopg2 - run: pip install psycogreen - run: pip install gevent - - run: python setup.py -q install + - run: pip install . - run: python runtests_psycopg2.py diff --git a/.github/workflows/ci_psycopg3.yml b/.github/workflows/ci_psycopg3.yml index 6e254c1..95eddf0 100644 --- a/.github/workflows/ci_psycopg3.yml +++ b/.github/workflows/ci_psycopg3.yml @@ -52,5 +52,5 @@ jobs: - run: pip install django==${{ matrix.django-version}} - run: pip install psycopg[binary] - run: pip install gevent - - run: python setup.py -q install + - run: pip install . - run: python runtests_psycopg3.py diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index ec70354..d3df781 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -21,19 +21,21 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install dependencies run: | python -m pip install --upgrade pip - pip install build + pip install hatch - name: Build package run: python -m build + - name: Test package + run: hatch run test - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + uses: pypa/gh-action-pypi-publish@v1 with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 324c46f..f115e2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.0.4 + +- Fix package + +## 4.0.3 + +- Support for psycopg3 + ## 4.0.2 - Fixed eventlet rlock using as context manager, issue #73, @StuBz211 diff --git a/MANIFEST.in b/MANIFEST.in index f79cea8..9e47b77 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ include LICENSE AUTHORS.rst README.md recursive-include django-db-geventpool * recursive-exclude * *.pyc *.swp -prune django_db_geventpoll/.ropeproject +prune django_db_geventpool/.ropeproject diff --git a/django_db_geventpool/__init__.py b/django_db_geventpool/__init__.py index e69de29..fbe678b 100755 --- a/django_db_geventpool/__init__.py +++ b/django_db_geventpool/__init__.py @@ -0,0 +1 @@ +version = 'v4.0.4' diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..76e8348 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,38 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "django-db-geventpool" +dynamic = ["version"] +description = "Add a DB connection pool using gevent to django" +readme = "README.md" +license = "Apache-2.0" +authors = [ + { name = "Javier Cordero Martinez", email = "j@jcmz.me" }, +] +classifiers = [ + "Environment :: Web Environment", + "Framework :: Django", + "Framework :: Django :: 3.1", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Topic :: Software Development :: Libraries :: Application Frameworks", +] +dependencies = [ + "django>=3.1", +] + +[project.urls] +Homepage = "https://github.com/jneight/django-db-geventpool" + +[tool.hatch.version] +path = "django_db_geventpool/__init__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/django_db_geventpool", +] diff --git a/setup.py b/setup.py deleted file mode 100644 index 4c0b736..0000000 --- a/setup.py +++ /dev/null @@ -1,40 +0,0 @@ -import codecs - -from setuptools import setup, find_packages - - -def long_description(): - try: - with codecs.open("README.md", "r", "utf-8") as f: - return f.read() - except Exception: - return "Error loading README.md" - - -setup( - name="django-db-geventpool", - version="4.0.3", - install_requires=[ - "django>=3.1", - ], - url="https://github.com/jneight/django-db-geventpool", - description="Add a DB connection pool using gevent to django", - long_description=long_description(), - long_description_content_type="text/markdown", - packages=find_packages(), - include_package_data=True, - license="Apache 2.0", - classifiers=[ - "Environment :: Web Environment", - "Framework :: Django", - "Framework :: Django :: 3.1", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Topic :: Software Development :: Libraries :: Application Frameworks", - ], - author="Javier Cordero Martinez", - author_email="j@jcmz.me", -) diff --git a/tests/tests.py b/tests/tests.py index fdd23e1..09f7040 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -10,7 +10,7 @@ def test_multiple_connections(count): print("Test {0} starts".format(count)) for x in range(0, 20): - assert len(TestModel.objects.all()) == 1 + assert not TestModel.objects.exists() print("Test {0} ends".format(count)) @@ -29,9 +29,8 @@ def test_model_save(self): self.assertEqual(data[key], getattr(obj, key)) def test_connections(self): - TestModel.objects.create() greenlets = [] for x in range(0, 50): greenlets.append(gevent.spawn(test_multiple_connections, x)) - gevent.joinall(greenlets) + gevent.joinall(greenlets, raise_error=True) diff --git a/tox.ini b/tox.ini deleted file mode 100644 index f17ce51..0000000 --- a/tox.ini +++ /dev/null @@ -1,9 +0,0 @@ -[tox] -envlist = py27-dj11,py{36,37,38}-dj{11,22,30,31} - -[testenv] -commands = python -Wall runtests.py -deps = - gevent - psycopg2-binary - dj31: django~=3.1