From d4bc8f0197ae250e5578eee7706264df01d924d3 Mon Sep 17 00:00:00 2001 From: Reinout van Rees Date: Tue, 12 Mar 2024 11:40:58 +0100 Subject: [PATCH] Generating pre-commit config and pyproject with nens-meta --- .editorconfig | 24 +++++ .github/dependabot.yml | 9 ++ .github/workflows/nens-meta.yml | 36 +++++++ .gitignore | 186 ++++++-------------------------- .nens.toml | 6 ++ .pre-commit-config.yaml | 23 ++++ pyproject.toml | 43 ++++++++ requirements.txt | 6 +- 8 files changed, 181 insertions(+), 152 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/nens-meta.yml create mode 100644 .nens.toml create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b0d4104 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,24 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +charset = utf-8 +indent_style = space +indent_size = 4 +max_line_length = 88 + +[*.{toml,yaml,yml}] +indent_size = 2 + +[*.{json,geojson,jsonl,js,jsx,ts,tsx,css,less,scss,html,xml}] +indent_size = 2 + +[*.md] +max_line_length = off + +[Makefile] +indent_style = tab + +### Extra lines below are preserved ### diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..9aa6eb9 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + +### Extra lines below are preserved ### diff --git a/.github/workflows/nens-meta.yml b/.github/workflows/nens-meta.yml new file mode 100644 index 0000000..773d62b --- /dev/null +++ b/.github/workflows/nens-meta.yml @@ -0,0 +1,36 @@ +# Generated by nens-meta. +# See https://nens-meta.readthedocs.io/en/latest/config-files.html for info. +# If you want this file to be left alone, add "nens_meta_leave_alone" in +# all caps somewhere in this file in a comment. +# + +name: nens-meta +on: + push: + branches: + - master + - main + pull_request: + branches: + - master + - main + + workflow_dispatch: + +jobs: + nens-meta: + name: nens-meta + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.11 + - uses: pre-commit/action@v3.0.1 + - name: Install dependencies + run: python -m pip install -r requirements.txt + - name: Test + run: pytest + +### Extra lines below are preserved ### diff --git a/.gitignore b/.gitignore index 6769e21..cef8f07 100644 --- a/.gitignore +++ b/.gitignore @@ -1,160 +1,44 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ +# Pyc/pyo/backup files. +*.py[co] +*~ +*.swp +*.pyc +.DS_Store + +# Packages/buildout/pip/pipenv +*.egg +*.egg-info +sdist +pip-log.txt +bower_components/ +node_modules/ +doc/build/ +ansible/*.retry +.venv +venv +bin/ lib/ -lib64/ -parts/ -sdist/ +pyvenv.cfg +dist/ var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST +*.suggestion -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt +# Our generated files +for_step_summary.md # Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ .coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - -# pdm -# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. -#pdm.lock -# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it -# in version control. -# https://pdm.fming.dev/#use-with-ide -.pdm.toml - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ +.tox +htmlcov +.codeintel +coverage.* +.pytest_cache -# pytype static type analyzer -.pytype/ +# Pycharm, visual studio +.idea +.vscode -# Cython debug symbols -cython_debug/ +# Docker +docker-compose.override.yml -# PyCharm -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ \ No newline at end of file +### Extra lines below are preserved ### diff --git a/.nens.toml b/.nens.toml new file mode 100644 index 0000000..7349452 --- /dev/null +++ b/.nens.toml @@ -0,0 +1,6 @@ +[meta] +is_python_project = true +uses_ansible = false +meta_version = "0.5.dev0" +project_name = "bro-hub" +package_name = "bro_hub" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..4aa6b81 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,23 @@ +default_language_version: + python: python3 + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-toml + - id: check-added-large-files + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.1.13 + hooks: + # Run the linter. + - id: ruff + args: ["--fix"] + # Run the formatter. + - id: ruff-format + +### Extra lines below are preserved ### diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3eed7c2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +# Initially generated by nens-meta + +[build-system] +requires = ["setuptools>=69"] + +[project] +name = "bro-hub" +requires-python = ">=3.11" +dependencies = [] +description = "Simplify data management for BRO" +authors = [] +readme = "README.md" + +[project.optional-dependencies] +test = ["pytest"] # pytest added by nens-meta + +[tool.setuptools] +packages = ["bro_hub"] + +[tool.pytest.ini_options] +testpaths = ["bro_hub"] +log_level = "DEBUG" + +[tool.coverage.run] +source = ["bro_hub"] + +[tool.coverage.report] +show_missing = true +skip_empty = true + +[tool.ruff] +target-version = "py311" + +[tool.ruff.lint] +select = ["E4", "E7", "E9", "F", "I", "UP", "C901"] + +[tool.zest-releaser] +release = false + +[tool.pyright] +include = ["bro_hub"] +venvPath = "." +venv = ".venv" diff --git a/requirements.txt b/requirements.txt index be02447..ae2912e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,6 @@ +-e .[test] + +# TODO: dependencies django == 5.0.1 streamlit pandas @@ -21,4 +24,5 @@ shapely geopandas # development tools -ruff \ No newline at end of file +ruff +coverage