Skip to content

Commit 84ad99a

Browse files
authored
Merge pull request #17 from reecetech/feature/switch-from-setup-py-to-pyproject-toml
Switch from setup.py to pyproject.toml
2 parents 5e2fee3 + a8a647e commit 84ad99a

File tree

6 files changed

+100
-59
lines changed

6 files changed

+100
-59
lines changed

.github/workflows/test-build-release.yaml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ jobs:
2121
set -euo pipefail
2222
./test-in-docker.sh
2323
24-
release:
25-
if: ${{ github.ref == 'refs/heads/master' }}
26-
needs:
27-
- test
24+
build:
2825
runs-on: ubuntu-latest
2926
steps:
3027
- name: Checkout code
@@ -37,16 +34,45 @@ jobs:
3734
scheme: semver
3835

3936
- name: Setup Python
40-
uses: actions/setup-python@v2
37+
uses: actions/setup-python@v3
4138
with:
4239
python-version: '3.10' # Should match Pipfile / "python_version"
4340

4441
- name: Build package
4542
shell: bash
4643
run: |
4744
set -euo pipefail
48-
export VERSION="${{ steps.version.outputs.version }}"
49-
python3 setup.py build sdist
45+
VERSION="${{ steps.version.outputs.version }}"
46+
echo "VERSION = '${VERSION}'" > django_informixdb_vault/version.py
47+
pip install "setuptools>=62.2.0"
48+
python3 setup.py sdist
49+
50+
- uses: actions/upload-artifact@v3
51+
with:
52+
name: dist
53+
path: dist/
54+
retention-days: 3
55+
56+
release:
57+
if: ${{ github.ref == 'refs/heads/master' }}
58+
needs:
59+
- test
60+
- build
61+
runs-on: ubuntu-latest
62+
steps:
63+
- name: Checkout code
64+
uses: actions/checkout@v2
65+
66+
- name: Get next version
67+
uses: reecetech/version-increment@2022.2.5
68+
id: version
69+
with:
70+
scheme: semver
71+
72+
- name: Download artifact
73+
uses: actions/download-artifact@v3
74+
with:
75+
name: dist # the package from the `build` step
5076

5177
- name: Release version on GitHub
5278
uses: marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0

django_informixdb_vault/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
"""django_informixdb_vault: Vault authenticated Django Informix database driver"""
2+
from .version import VERSION

django_informixdb_vault/version.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"""Placeholder PEP 440 compliant version for tests, to be overwritten by GitHub Action"""
2+
VERSION = '0.1.dev0'

pyproject.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[build-system]
2+
requires = [
3+
"setuptools >= 62.2.0",
4+
"wheel >= 0.37.0",
5+
]
6+
build-backend = 'setuptools.build_meta'
7+
8+
[project]
9+
name = "django_informixdb_vault"
10+
description = "A database driver for Django to connect to an Informix db via ODBC, obtaining the credentials from Hashicorp Vault"
11+
keywords = [
12+
"django",
13+
"informix",
14+
"vault",
15+
]
16+
classifiers=[
17+
'Development Status :: 4 - Beta',
18+
'Intended Audience :: Developers',
19+
'Topic :: Software Development',
20+
'Topic :: Scientific/Engineering',
21+
'License :: OSI Approved :: Apache Software License',
22+
'Programming Language :: Python :: 3',
23+
'Programming Language :: Python :: 3.7',
24+
'Programming Language :: Python :: 3.8',
25+
'Programming Language :: Python :: 3.9',
26+
'Programming Language :: Python :: 3.10',
27+
]
28+
29+
dynamic = ["version", "readme"]
30+
31+
[[project.authors]]
32+
name = "Reecetech"
33+
email = "opensource@reecetech.com.au"
34+
35+
[project.urls]
36+
Homepage = "https://github.com/reecetech/django_informixdb_vault"
37+
Repository = "https://github.com/reecetech/django_informixdb_vault"
38+
39+
[project.license]
40+
text = "APLv2"
41+
42+
[tool.setuptools.dynamic]
43+
version = {attr = "django_informixdb_vault.VERSION"}
44+
readme = {file = "README.rst"}

setup.cfg

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1+
[options]
2+
packages = find:
3+
install_requires =
4+
django_informixdb
5+
hvac
6+
7+
[options.extras_require]
8+
dev =
9+
check-manifest
10+
test =
11+
coverage
12+
all =
13+
%(test)s
14+
115
[bdist_wheel]
216
universal=1
317

18+
[aliases]
19+
test=pytest
20+
421
[flake8]
522
exclude = .git, test
623
max-line-length=120

setup.py

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,4 @@
1-
import os
2-
import shlex
3-
import shutil
4-
import subprocess
1+
import setuptools
52

6-
from setuptools import setup, find_packages
7-
from codecs import open
8-
from os import path
9-
10-
here = path.abspath(path.dirname(__file__))
11-
12-
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
13-
long_description = f.read()
14-
15-
# Obtain version from env (incremented by CI), or from git (local dev)
16-
version = 'unknown'
17-
if os.environ.get('VERSION'):
18-
version = os.environ['VERSION']
19-
else:
20-
if shutil.which('git'):
21-
gitcmd = shlex.split('git rev-parse --short HEAD')
22-
gitproc = subprocess.run(gitcmd, capture_output=True, check=False)
23-
version = f"git.{gitproc.stdout.decode().strip()}"
24-
25-
setup(
26-
name='django_informixdb_vault',
27-
version=version,
28-
description='A database driver for Django to connect to an Informix db via ODBC, obtaining the credentials from Hashicorp Vault',
29-
long_description=long_description,
30-
long_description_content_type='text/x-rst',
31-
url='https://github.com/reecetech/django_informixdb_vault',
32-
author='Reecetech',
33-
author_email='opensource@reecetech.com.au',
34-
license='APLv2',
35-
classifiers=[
36-
'Development Status :: 4 - Beta',
37-
'Intended Audience :: Developers',
38-
'Topic :: Software Development',
39-
'Topic :: Scientific/Engineering',
40-
'License :: OSI Approved :: Apache Software License',
41-
'Programming Language :: Python :: 3',
42-
'Programming Language :: Python :: 3.7',
43-
'Programming Language :: Python :: 3.8',
44-
'Programming Language :: Python :: 3.9',
45-
],
46-
keywords='django informix vault',
47-
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
48-
install_requires=['django>=3.2.0,<4', 'pyodbc~=4.0.21', 'django_informixdb~=1.10.0', 'hvac~=0.10.4'],
49-
extras_require={
50-
'dev': ['check-manifest'],
51-
'test': ['coverage'],
52-
},
53-
)
3+
if __name__ == "__main__":
4+
setuptools.setup()

0 commit comments

Comments
 (0)