diff --git a/.github/ISSUE_TEMPLATE/asking-help.md b/.github/ISSUE_TEMPLATE/asking-help.md new file mode 100644 index 0000000..0dcc0b2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/asking-help.md @@ -0,0 +1,9 @@ +--- +name: Asking for help +about: If you need help using Mesa-Viz-Tornado, you should post in https://github.com/projectmesa/mesa/discussions +--- + + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 0000000..916a88f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,21 @@ +--- +name: Bug report +about: Let us know if something is broken on Mesa-Viz-Tornado + +--- + +**Describe the bug** + + +**Expected behavior** + + +**To Reproduce** + + +**Additional context** + diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000..66b6c1e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,14 @@ +--- +name: Feature request +about: Suggest a new feature for Mesa-Viz-Tornado + +--- + +**What's the problem this feature will solve?** + + +**Describe the solution you'd like** + + +**Additional context** + \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ac27a84 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every week + interval: "weekly" diff --git a/.github/workflows/build_lint.yml b/.github/workflows/build_lint.yml new file mode 100644 index 0000000..ce1a023 --- /dev/null +++ b/.github/workflows/build_lint.yml @@ -0,0 +1,77 @@ +name: build + +on: + push: + branches: + - main + - release** + paths-ignore: + - '**.md' + - '**.rst' + pull_request: + paths-ignore: + - '**.md' + - '**.rst' + +jobs: + build: + runs-on: ${{ matrix.os }}-latest + strategy: + fail-fast: False + matrix: + os: [windows, ubuntu, macos] + python-version: ["3.11"] + include: + - os: ubuntu + python-version: "3.10" + - os: ubuntu + python-version: "3.9" + - os: ubuntu + python-version: "3.8" + # Disabled for now. See https://github.com/projectmesa/mesa/issues/1253 + #- os: ubuntu + # python-version: 'pypy-3.8' + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('Pipfile.lock') }} + - name: Install dependencies + run: pip install wheel && pip install .[dev] + # - name: Test with pytest + # run: pytest --cov=mesa_viz_tornado tests/ --cov-report=xml + - if: matrix.os == 'ubuntu' + name: Codecov + uses: codecov/codecov-action@v3 + + lint-ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - run: pip install ruff==0.0.254 + - name: Lint with ruff + # Include `--format=github` to enable automatic inline annotations. + # Use settings from pyproject.toml. + run: ruff . --format=github + + lint-black: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - run: pip install black + - name: Lint with black + run: black --check . diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2204ea3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,51 @@ +[tool.ruff] +# See https://github.com/charliermarsh/ruff#rules for error code definitions. +select = [ + # "ANN", # annotations TODO + "B", # bugbear + "C4", # comprehensions + "DTZ", # naive datetime + "E", # style errors + "F", # flakes + "I", # import sorting + "ISC", # string concatenation + "N", # naming + "PGH", # pygrep-hooks + "PIE", # miscellaneous + "PLC", # pylint convention + "PLE", # pylint error + # "PLR", # pylint refactor TODO + "PLW", # pylint warning + "Q", # quotes + "RUF", # Ruff + "S", # security + "SIM", # simplify + "T10", # debugger + "UP", # upgrade + "W", # style warnings + "YTT", # sys.version +] +# Ignore list taken from https://github.com/psf/black/blob/master/.flake8 +# E203 Whitespace before ':' +# E266 Too many leading '#' for block comment +# E501 Line too long (82 > 79 characters) +# W503 Line break occurred before a binary operator +# But we don't specify them because ruff's Black already +# checks for it. +# See https://github.com/charliermarsh/ruff/issues/1842#issuecomment-1381210185 +extend-ignore = [ + "E501", + "S101", # Use of `assert` detected + "B017", # `assertRaises(Exception)` should be considered evil TODO + "PGH004", # Use specific rule codes when using `noqa` TODO + "B905", # `zip()` without an explicit `strict=` parameter + "N802", # Function name should be lowercase + "N999", # Invalid module name. We should revisit this in the future, TODO + "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` TODO + "S310", # Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. + "S603", # `subprocess` call: check for execution of untrusted input +] +extend-exclude = ["docs", "build"] +# Hardcode to Python 3.8. +# Reminder to update mesa-examples if the value below is changed. +target-version = "py38" \ No newline at end of file diff --git a/setup.py b/setup.py index c1e4525..c773753 100644 --- a/setup.py +++ b/setup.py @@ -8,9 +8,20 @@ requires = ["tornado"] +extras_require = { + "dev": [ + "black", + "ruff==0.0.275", + # "coverage", + # "pytest >= 4.6", + # "pytest-cov", + # "sphinx", + ], +} + version = "0.1.1" -with open("README.md", "r", encoding="utf-8") as fh: +with open("README.md", encoding="utf-8") as fh: long_description = fh.read() # Ensure JS dependencies are downloaded @@ -105,6 +116,7 @@ def ensure_js_dep_single(url, out_name=None): }, include_package_data=True, install_requires=requires, + extras_require=extras_require, keywords="agent based modeling model ABM simulation multi-agent", license="Apache 2.0", zip_safe=False,