From 661b4e0bef49247e8b447a33978e8c1439119b5c Mon Sep 17 00:00:00 2001 From: abichinger Date: Sat, 28 Oct 2023 17:42:02 +0200 Subject: [PATCH] fix: migrate setup.py to pyproject.toml (#18) * chore: migrate from setup.py to pyproject.toml * chore: set major version of semantic release --- .github/workflows/release.yml | 9 ++--- .gitignore | 3 ++ .releaserc.json | 2 +- package.json | 8 +++++ pyproject.toml | 46 ++++++++++++++++++++++++ setup.cfg | 3 -- setup.py | 66 ----------------------------------- 7 files changed, 61 insertions(+), 76 deletions(-) create mode 100644 package.json delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index efdfdb3..8329f99 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -89,15 +89,12 @@ jobs: node-version: '18' - name: Setup - run: npm install -g semantic-release @semantic-release/github @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/git @semantic-release/release-notes-generator semantic-release-pypi + run: npm install - name: Set up python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: 3.8 - - - name: Install setuptools - run: python -m pip install --upgrade setuptools wheel twine + python-version: 3.11 - name: Release env: diff --git a/.gitignore b/.gitignore index aa5ed59..25638f1 100644 --- a/.gitignore +++ b/.gitignore @@ -129,3 +129,6 @@ dmypy.json # Pyre type checker .pyre/ + +# node +node_modules diff --git a/.releaserc.json b/.releaserc.json index d05ce0c..94e24cd 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -16,7 +16,7 @@ "@semantic-release/git", { "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}", - "assets": ["CHANGELOG.md", "setup.py", "setup.cfg"] + "assets": ["CHANGELOG.md", "pyproject.toml"] } ] ] diff --git a/package.json b/package.json new file mode 100644 index 0000000..20ac176 --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "devDependencies": { + "@semantic-release/changelog": "^6.0.3", + "@semantic-release/git": "^10.0.1", + "semantic-release": "^22.0.5", + "semantic-release-pypi": "^3.0.0" + } +} diff --git a/pyproject.toml b/pyproject.toml index e34796e..44328af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,48 @@ +[project] +name = "django-authorization" +version = "1.2.0" +authors = [ + {name = "JonLee", email = "leeqvip@gmail.com"}, +] +description = "An authorization library that supports access control models like ACL, RBAC, ABAC in Django" +readme = "README.md" +keywords = [ + "casbin", + "django", + "acl", + "rbac", + "abac", + "auth", + "authz", + "authorization", + "access control", + "permission", +] +dynamic = ["dependencies"] +requires-python = ">=3.6" +license = {text = "Apache 2.0"} +classifiers = [ + "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", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", +] + +[project.urls] +Home-page = "https://github.com/pycasbin/django-authorization" + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.packages.find] +exclude = ["tests"] + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.txt"]} + [tool.black] line-length = 120 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index fbe8bed..0000000 --- a/setup.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[metadata] -version = 1.2.0 - diff --git a/setup.py b/setup.py deleted file mode 100644 index 678c63b..0000000 --- a/setup.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 2021 The casbin Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from os import path - -import setuptools - -desc_file = "README.md" - -here = path.abspath(path.dirname(__file__)) - -with open(desc_file, "r", encoding="utf-8") as fh: - long_description = fh.read() - -# get the dependencies and installs -with open(path.join(here, "requirements.txt"), encoding="utf-8") as f: - all_reqs = f.read().split("\n") - -install_requires = [x.strip() for x in all_reqs if "git+" not in x] - -setuptools.setup( - name="django-authorization", - author="JonLee", - author_email="leeqvip@gmail.com", - description="An authorization library that supports access control models like ACL, RBAC, ABAC in Django", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/pycasbin/django-authorization", - keywords=[ - "casbin", - "django", - "acl", - "rbac", - "abac", - "auth", - "authz", - "authorization", - "access control", - "permission", - ], - packages=setuptools.find_packages(exclude=("tests",)), - install_requires=install_requires, - python_requires=">=3.6", - license="Apache 2.0", - classifiers=[ - "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", - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - ], - data_files=[desc_file], -)