Skip to content

Commit

Permalink
Merge pull request #100 from mrf345/testing
Browse files Browse the repository at this point in the history
Drop support for python 3.7, add 3.13, and replace `make` with `nox`
  • Loading branch information
mrf345 authored Jan 31, 2025
2 parents 9907839 + 7995742 commit 844db5a
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
Expand Down
22 changes: 0 additions & 22 deletions Makefile

This file was deleted.

7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,11 @@ the **default** parsers are set to `{"html": Html, "script": Jsmin, "style": Rcs


## Development:
Make sure you have [nox](https://nox.thea.codes/en/stable/) installed.

- *Tests*: `make test`
- *Style check*: `make lint`
- *Format code*: `make format`
- *Tests*: `nox -s test`
- *Style check*: `nox -s lint`
- *Format code*: `nox -s format`

## Breaking changes

Expand Down
1 change: 1 addition & 0 deletions bandit.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
exclude_dirs:
- 'tests'
- '.venv'
- '.nox'
3 changes: 2 additions & 1 deletion flask_minify/about.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
__version__ = "0.48"
__version__ = "0.49"
__doc__ = "Flask extension to minify html, css, js and less."
__license__ = "MIT"
__author__ = "Mohamed Feddad"
__email__ = "[email protected]"
__supported_versions__ = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
2 changes: 1 addition & 1 deletion flask_minify/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

try:
import minify as minify_go
except ImportError:
except Exception:
minify_go = None

from flask_minify.exceptions import FlaskMinifyException
Expand Down
62 changes: 62 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import os

import nox

nox.options.sessions = ["lint", "test"]

basedir = os.path.abspath(os.path.dirname(__file__))
about_path = os.path.join(basedir, os.path.join("flask_minify", "about.py"))
about_content = ""
test_req_path = os.path.join("requirements", "test.txt")
dev_req_path = os.path.join("requirements", "dev.txt")

with open(about_path) as f:
about_content = f.read()
exec(about_content) # nosec


@nox.session(python=__supported_versions__) # type: ignore
def test(session: nox.session):
session.install("-r", test_req_path)
session.run("python", "-m", "pytest")
session.run("python", "-m", "bandit", "-c", "bandit.yml", "-r", ".")


@nox.session
def lint(session: nox.Session):
session.install("-r", test_req_path)
session.run(
"python", "-m", "isort", "-sg", "**/.nox*", "--profile", "black", "--check", "."
)
session.run("python", "-m", "black", "--check", ".")


@nox.session
def format(session: nox.Session):
session.install("-r", test_req_path)
session.run("python", "-m", "isort", "-sg", "**/.nox*", "--profile", "black", ".")
session.run("python", "-m", "black", ".")


@nox.session
def release(session: nox.Session):
session.install("-r", dev_req_path)
session.run("python", "setup.py", "sdist", "bdist_wheel")
session.run("python", "-m", "twine", "upload", "dist/*")
session.run("rm", "-rf", "dist", "build", "Flask_Minify.egg-info", ".eggs")


@nox.session
def bump(session: nox.Session):
old_version = __version__ # type: ignore
new_version = old_version.split(".")
new_version[-1] = str(int(new_version[-1]) + 1)
new_version = ".".join(new_version)

with open(about_path, "w") as f:
f.write(about_content.replace(old_version, new_version))

session.run("git", "add", about_path, external=True)
session.run(
"git", "commit", "-m", f"chore: bump version to {new_version}", external=True
)
1 change: 1 addition & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
pytest-pudb
pudb
twine
nox
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from setuptools import setup

supported_versions = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
optional_requirements = {"go": 'tdewolff-minify>=2.20.34; platform_system == "Linux"'}
basedir = path.abspath(path.dirname(__file__))
long_description = ""
Expand Down Expand Up @@ -38,7 +37,7 @@
requirements += [line for line in f.read().split("\n") if line]

supported_python_classifiers = [
"Programming Language :: Python :: {0}".format(v) for v in supported_versions
"Programming Language :: Python :: {0}".format(v) for v in __supported_versions__
]

setup(
Expand Down

0 comments on commit 844db5a

Please sign in to comment.