File: noxfile.py

package info (click to toggle)
python-changelogd 0.1.9-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 448 kB
  • sloc: python: 1,921; makefile: 21
file content (44 lines) | stat: -rw-r--r-- 1,135 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import nox

nox.options.sessions = ["tests", "flake8", "mypy", "docs"]


@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"])
def tests(session):
    session.install(".[test]")
    session.run("pytest")


@nox.session
def flake8(session):
    session.install("flake8")
    session.run("flake8", "changelogd")


@nox.session
def mypy(session):
    session.install("mypy", "types-click", "types-jinja2")
    session.run("mypy", "changelogd")


@nox.session
def docs(session):
    session.install(".[docs]")
    session.run("sphinx-build", "-b", "html", "docs", "docs/_build", "-v", "-W")


@nox.session
def create_dist(session):
    session.install("twine")
    session.run("python", "setup.py", "sdist", "bdist_wheel")
    session.run("twine", "check", "dist/*")


@nox.session
def publish(session):
    """Publish to pypi. Run `nox publish -- prod` to publish to the official repo."""
    create_dist(session)
    twine_command = ["twine", "upload", "dist/*"]
    if "prod" not in session.posargs:
        twine_command.extend(["--repository-url", "https://test.pypi.org/legacy/"])
    session.run(*twine_command)