Skip to content

Commit

Permalink
Py 312 pytoml (#10)
Browse files Browse the repository at this point in the history
* project configuration process

The commit includes the replacement of the older, scattered project configuration and dependency files (like setup.py, requirements.txt, and setup.cfg) with the pyproject.toml file for centralizing project configuration and dependency management. This makes the project comply with the newer Python packaging standards, simplifies the setup for new developers, and e


---------

Signed-off-by: Steven K <[email protected]>
  • Loading branch information
rh0dium authored Dec 28, 2023
1 parent c9a0155 commit d286249
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 161 deletions.
10 changes: 0 additions & 10 deletions .coveragerc

This file was deleted.

82 changes: 32 additions & 50 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This is used for app search.

name: App Search Tests

Expand All @@ -22,17 +23,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 @@ -44,17 +42,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]
- name: Black
run: black --check .
Expand All @@ -66,17 +61,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 @@ -89,19 +81,16 @@ 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 appsearch -x appsearch/tests -s B308,B703,B303,B324 -f json -o report.json
run: bandit -c pyproject.toml -r -f json -o report.json .

- name: Show report
if: ${{ success() || failure() }}
Expand All @@ -117,13 +106,13 @@ jobs:
tests:
name: Python ${{ matrix.python-version }} / ${{ matrix.db }} / Django ${{ matrix.django-version}}
runs-on: ubuntu-latest
# continue-on-error: ${{ matrix.django-version == '~=4.2.0' }}
# continue-on-error: ${{ matrix.django-version == '~=5.0' }}
strategy:
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 @@ -151,15 +140,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 @@ -168,8 +153,7 @@ jobs:
PYTHONWARNINGS: once::DeprecationWarning
TASK_ALWAYS_EAGER: 1
DB_TYPE: ${{ matrix.db }}
run: |
coverage run demo_app/manage.py test --noinput --settings=demo_app.settings_test appsearch
run: export PYTHONPATH=`pwd` && coverage run
- name: "Upload Coverage Results for PY:${{ matrix.python-version }} DB:${{ matrix.db}} DJ:${{ matrix.django-version }}"
uses: actions/upload-artifact@v3
with:
Expand All @@ -178,8 +162,7 @@ jobs:
retention-days: 1

- name: Django Check
run: |
python demo_app/manage.py check
run: python demo_app/manage.py check

coverage:
name: Upload Coverage to Codecov
Expand All @@ -189,10 +172,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 All @@ -201,7 +186,7 @@ jobs:
- name: Combine Report Coverage
run: |
coverage combine coverage-*/.coverage
coverage report --precision=1 --sort=cover --skip-covered --skip-empty
coverage report
coverage xml
- name: Upload coverage to Codecov
Expand All @@ -226,20 +211,17 @@ 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
- name: Release
id: release
env:
PYTHONWARNINGS: once::DeprecationWarning
TASK_ALWAYS_EAGER: 1
GITHUB_TOKEN: ${{ secrets.ORGANIZATIONAL_REPO_TOKEN }}
run: |
bumper.py --directory . --exclude=.github,demo_app \
--version_files appsearch/__init__.py \
--repo=pivotal-energy-solutions/django-appsearch > out.json
bumper -P
echo "bumped=$(jq '.bumped' out.json)" >> $GITHUB_OUTPUT
echo "bump_version=$(jq '.bump_version' out.json)" >> $GITHUB_OUTPUT
echo "bump_sha=$(jq '.bump_sha' out.json)" >> $GITHUB_OUTPUT
9 changes: 0 additions & 9 deletions MANIFEST.in

This file was deleted.

108 changes: 102 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,79 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "django-appsearch"
dynamic = ["version"]
description = "Framework and generic app for cross-model searches on a single page"
readme = "README.md"
requires-python = ">=3.9"
authors = [
{ name = "Pivotal Energy Solutions", email = "[email protected]" },
]
keywords = [
"django",
"search",
]
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 :: Apache Software 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",
"python-dateutil",
]

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

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

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

[tool.hatch.build.targets.sdist]
include = [
"/appsearch",
"/appsearch/templates/**/*",
]

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

[tool.black]
line-length = 100
target-version = ['py310']
target-version = ['py311']
include = '\.pyi?$'
exclude = '''
/(
Expand All @@ -13,8 +86,31 @@ exclude = '''
| dist
)/
'''
extend-exclude = '''
# A regex preceded with ^/ will apply only to files and directories
# 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.bandit]
targets = ['appsearch']
exclude_dirs = ["appsearch/tests", "demo_app"]
skips = ["B308", "B703", "B303", "B324"]

[tool.coverage.run]
branch = true
command_line = "demo_app/manage.py test --noinput --settings=demo_app.settings_test appsearch"
omit = [
"*/demo_app/**",
"*/migrations/*",
"*/tests/**",
]

[tool.coverage.report]
fail_under = 77
precision = 1
skip_covered = true
skip_empty = true
ignore_errors = true
sort = "cover"

[tool.bumper]
exclude = [".idea", ".github", "demo_app"]
version_files = ["appsearch/__init__.py"]
repo = "pivotal-energy-solutions/django-appsearch"
report = "out.json"
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 d286249

Please sign in to comment.