Skip to content

Commit

Permalink
Update project configuration and update Python version
Browse files Browse the repository at this point in the history
Obsolete configuration files have been removed and replaced with a modern pyproject.toml file. The Python version for GitHub workflows has been updated to use Python 3.12. This commit also includes the migration of the project's dependencies from requirements.txt and setup.py to pyproject.toml. Python setuptools and requirements files have been replaced with a simpler build process using hatch.

Signed-off-by: Steven K <[email protected]>
  • Loading branch information
rh0dium committed Dec 28, 2023
1 parent 086bdd5 commit 181f1ba
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 285 deletions.
10 changes: 0 additions & 10 deletions .coveragerc

This file was deleted.

70 changes: 27 additions & 43 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,14 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.12"
cache: 'pip'
cache-dependency-path: |
setup.py
requirements*.txt

- name: Install dependencies
run: |
python setup.py install
python -m pip install --upgrade pip
pip install -r requirements.txt --user
pip install -r requirements_dev.txt --user
pip install .
pip install .[test]
- name: outdated
run: pip list --outdated --not-required --user | grep . && echo "There are outdated packages" && exit 1 || echo "All packages up to date"
Expand All @@ -43,17 +40,15 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.12"
cache: 'pip'
cache-dependency-path: |
setup.py
requirements*.txt

- name: Install dependencies
run: |
python setup.py install
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_dev.txt
pip install hatch
pip install .
pip install .[test]
- name: Black
run: black --check .
Expand All @@ -65,17 +60,14 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.12"
cache: 'pip'
cache-dependency-path: |
setup.py
requirements*.txt

- name: Install dependencies
run: |
python setup.py install
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_dev.txt
pip install .
pip install .[test]
pre-commit install
- name: Pre-Commit
Expand All @@ -88,16 +80,13 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.12"
cache: 'pip'
cache-dependency-path: |
setup.py
requirements*.txt

- name: Install dependencies
run: |
python setup.py install
pip install bandit
pip install .
pip install .[test]
- name: Bandit
run: bandit -r django_states -x django_states/tests -s B101 -f json -o report.json
Expand All @@ -121,8 +110,8 @@ jobs:
max-parallel: 4
matrix:
db: [ sqlite, mariadb ]
django-version: [ "~=4.2.0" ]
python-version: [ "3.10" ]
django-version: ["~=4.2.0", "~=5.0"]
python-version: [ "3.12" ]

services:
mariadb:
Expand Down Expand Up @@ -150,15 +139,11 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
setup.py
requirements*.txt

- name: Install dependencies
run: |
python setup.py install
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_dev.txt
pip install .
pip install .[test]
pip uninstall -y Django
pip install Django${{ matrix.django-version }}
Expand All @@ -169,9 +154,7 @@ jobs:
DB_TYPE: ${{ matrix.db }}
GOOGLE_MAPS_CLIENT_ID: ${{ secrets.GOOGLE_MAPS_CLIENT_ID }}
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
run: |
export PYTHONPATH=`pwd`
coverage run demo_app/manage.py test --noinput --settings=demo_app.settings_test django_states.tests
run: export PYTHONPATH=`pwd` && coverage run demo_app/manage.py test --noinput --settings=demo_app.settings_test django_states.tests

- name: "Upload Coverage Results for PY:${{ matrix.python-version }} DB:${{ matrix.db}} DJ:${{ matrix.django-version }}"
uses: actions/upload-artifact@v3
Expand All @@ -182,7 +165,6 @@ jobs:

- name: Django Check
run: |
export PYTHONPATH=`pwd`
python demo_app/manage.py check
coverage:
Expand All @@ -193,10 +175,12 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.12"

- name: Install dependencies
run: pip install -q coverage
run: |
pip install .
pip install .[test]
- uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -230,7 +214,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.12"
- name: Install dependencies
run: |
pip install git+https://${{ secrets.ORGANIZATIONAL_REPO_TOKEN }}@github.com/pivotal-energy-solutions/tensor-infrastructure@master#egg=infrastructure
Expand Down
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

19 changes: 0 additions & 19 deletions Makefile

This file was deleted.

84 changes: 83 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,76 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "pivotal-django-states"
dynamic = ["version"]
description = "State machine for django models"
readme = "README.md"
requires-python = ">=3.9"
authors = [
{ name = "Pivotal Energy Solutions", email = "[email protected]" },
]
keywords = [
"django",
"state-machine",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Utilities",
]
dependencies = [
"Django>=4.2",
]

[project.optional-dependencies]
test = [
"django-environ",
"mysqlclient",
"flake8",
"coverage",
"pre-commit",
"black",
"bandit"
]

[project.urls]
Issues = "https://github.com/pivotal-energy-solutions/django-states2/issues"
Download = "https://github.com/pivotal-energy-solutions/django-states2/archive/1.7.30.tar.gz"
Homepage = "https://github.com/pivotal-energy-solutions/django-states2"
"Original Source" = "https://github.com/vikingco/django-states2"
Thanks = "https://saythanks.io/to/rh0dium"

[tool.hatch.version]
path = "django_states/__init__.py"

[tool.hatch.build.targets.sdist]
include = [
"/django_states",
]

[tool.hatch.build.targets.wheel]
packages = ['django_states']
include = [
"/django_input_collection/templates/**/*",
]

[tool.black]
line-length = 100
target-version = ['py310']
target-version = ['py311']
include = '\.pyi?$'
exclude = '''
/(
Expand All @@ -18,3 +88,15 @@ extend-exclude = '''
# in the root of the project.
/static/.py # exclude a file named foo.py in the root of the project (in addition to the defaults)
'''

[tool.coverage.run]
branch = true
omit = [
"*/demo_app/**",
"*/migrations/*",
"*/tests/**",
]

[tool.coverage.report]
fail_under = 70
ignore_errors = true
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

8 changes: 0 additions & 8 deletions requirements_dev.txt

This file was deleted.

10 changes: 0 additions & 10 deletions setup.cfg

This file was deleted.

Loading

0 comments on commit 181f1ba

Please sign in to comment.