Skip to content

Commit 844db5a

Browse files
authored
Merge pull request #100 from mrf345/testing
Drop support for python 3.7, add 3.13, and replace `make` with `nox`
2 parents 9907839 + 7995742 commit 844db5a

File tree

9 files changed

+74
-31
lines changed

9 files changed

+74
-31
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
runs-on: ${{ matrix.os }}
1111
strategy:
1212
matrix:
13-
os: [ubuntu-20.04, windows-latest]
14-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
13+
os: [ubuntu-latest, windows-latest]
14+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
1515

1616
steps:
1717
- uses: actions/checkout@v4

Makefile

-22
This file was deleted.

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,11 @@ the **default** parsers are set to `{"html": Html, "script": Jsmin, "style": Rcs
147147

148148

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

151-
- *Tests*: `make test`
152-
- *Style check*: `make lint`
153-
- *Format code*: `make format`
152+
- *Tests*: `nox -s test`
153+
- *Style check*: `nox -s lint`
154+
- *Format code*: `nox -s format`
154155

155156
## Breaking changes
156157

bandit.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
exclude_dirs:
22
- 'tests'
33
- '.venv'
4+
- '.nox'

flask_minify/about.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
__version__ = "0.48"
1+
__version__ = "0.49"
22
__doc__ = "Flask extension to minify html, css, js and less."
33
__license__ = "MIT"
44
__author__ = "Mohamed Feddad"
55
__email__ = "[email protected]"
6+
__supported_versions__ = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

flask_minify/parsers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
try:
1010
import minify as minify_go
11-
except ImportError:
11+
except Exception:
1212
minify_go = None
1313

1414
from flask_minify.exceptions import FlaskMinifyException

noxfile.py

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import os
2+
3+
import nox
4+
5+
nox.options.sessions = ["lint", "test"]
6+
7+
basedir = os.path.abspath(os.path.dirname(__file__))
8+
about_path = os.path.join(basedir, os.path.join("flask_minify", "about.py"))
9+
about_content = ""
10+
test_req_path = os.path.join("requirements", "test.txt")
11+
dev_req_path = os.path.join("requirements", "dev.txt")
12+
13+
with open(about_path) as f:
14+
about_content = f.read()
15+
exec(about_content) # nosec
16+
17+
18+
@nox.session(python=__supported_versions__) # type: ignore
19+
def test(session: nox.session):
20+
session.install("-r", test_req_path)
21+
session.run("python", "-m", "pytest")
22+
session.run("python", "-m", "bandit", "-c", "bandit.yml", "-r", ".")
23+
24+
25+
@nox.session
26+
def lint(session: nox.Session):
27+
session.install("-r", test_req_path)
28+
session.run(
29+
"python", "-m", "isort", "-sg", "**/.nox*", "--profile", "black", "--check", "."
30+
)
31+
session.run("python", "-m", "black", "--check", ".")
32+
33+
34+
@nox.session
35+
def format(session: nox.Session):
36+
session.install("-r", test_req_path)
37+
session.run("python", "-m", "isort", "-sg", "**/.nox*", "--profile", "black", ".")
38+
session.run("python", "-m", "black", ".")
39+
40+
41+
@nox.session
42+
def release(session: nox.Session):
43+
session.install("-r", dev_req_path)
44+
session.run("python", "setup.py", "sdist", "bdist_wheel")
45+
session.run("python", "-m", "twine", "upload", "dist/*")
46+
session.run("rm", "-rf", "dist", "build", "Flask_Minify.egg-info", ".eggs")
47+
48+
49+
@nox.session
50+
def bump(session: nox.Session):
51+
old_version = __version__ # type: ignore
52+
new_version = old_version.split(".")
53+
new_version[-1] = str(int(new_version[-1]) + 1)
54+
new_version = ".".join(new_version)
55+
56+
with open(about_path, "w") as f:
57+
f.write(about_content.replace(old_version, new_version))
58+
59+
session.run("git", "add", about_path, external=True)
60+
session.run(
61+
"git", "commit", "-m", f"chore: bump version to {new_version}", external=True
62+
)

requirements/dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
pytest-pudb
44
pudb
55
twine
6+
nox

setup.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from setuptools import setup
44

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

4039
supported_python_classifiers = [
41-
"Programming Language :: Python :: {0}".format(v) for v in supported_versions
40+
"Programming Language :: Python :: {0}".format(v) for v in __supported_versions__
4241
]
4342

4443
setup(

0 commit comments

Comments
 (0)