From 0187b3c575f048aaedebf459c0ce9bcca6a503f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20M=C3=A9ndez?= Date: Sat, 23 Mar 2024 17:11:02 -0500 Subject: [PATCH] Hatch, gh actions, docker and several repo goodies I use in all my projects --- .coveragerc | 5 + .dockerignore | 4 + .editorconfig | 17 +++ .github/CODE_OF_CONDUCT.md | 14 ++ .github/CONTRIBUTING.md | 22 +++ .github/ISSUE_TEMPLATE/bug.yml | 34 +++++ .github/ISSUE_TEMPLATE/config.yml | 5 + .github/ISSUE_TEMPLATE/feature-request.yml | 10 ++ .github/PULL_REQUEST_TEMPLATE.md | 1 + .github/SECURITY.md | 1 + .github/dependabot.yml | 6 + .github/labels.toml | 149 +++++++++++++++++++++ .github/workflows/ci.yml | 51 +++++++ .github/workflows/labels.yml | 22 +++ .github/workflows/release.yml | 21 +++ .gitignore | 87 +++++++++++- .pre-commit-config.yaml | 58 ++++++++ AUTHORS.md | 7 + Dockerfile | 18 +++ docker-compose.yml | 23 ++++ jirahub/__init__.py | 1 + jirahub/env.example | 3 + jirahub/settings.py | 30 ++--- pyproject.toml | 137 +++++++++++++++++++ requirements.txt | 6 - 25 files changed, 707 insertions(+), 25 deletions(-) create mode 100644 .coveragerc create mode 100644 .dockerignore create mode 100644 .editorconfig create mode 100644 .github/CODE_OF_CONDUCT.md create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE/bug.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature-request.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/SECURITY.md create mode 100644 .github/dependabot.yml create mode 100644 .github/labels.toml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/labels.yml create mode 100644 .github/workflows/release.yml create mode 100644 .pre-commit-config.yaml create mode 100644 AUTHORS.md create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 pyproject.toml delete mode 100644 requirements.txt diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..5ba2575 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,5 @@ +[run] +include = jirahub/* +omit = *migrations*, *tests* +plugins = + django_coverage_plugin diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e63c0c1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.* +!.coveragerc +!.env +!.pylintrc diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..22ddbb1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +# http://editorconfig.org + +root = true + +[*] +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +insert_final_newline = true +charset = utf-8 +end_of_line = lf + +[*.py] +indent_size = 4 + +[Makefile] +indent_style = tab diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..25824a1 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,14 @@ +# Code of Conduct + +Everyone interacting in this project is expected to follow the +[Django's Code of Conduct](https://www.djangoproject.com/conduct/). This includes all infrastructure +used in the development of this project, such as codebase, issue tracker, chat rooms, and mailing lists. + +In general, this means that everyone is expected to be **open**, **considerate**, and **respectful** +of others no matter what their position is within the project. + +## Reporting + +All incidents should be reported by matagus+coc@gmail.com. This email is an alias with the following responders: + +* Matias Agustin Mendez (https://github.com/matagus) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..01b8644 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,22 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. + +We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, such as physical or electronic addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 0000000..50a6f4f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,34 @@ +name: Bug Report +description: File a bug +body: +- type: input + id: macos_version + attributes: + label: Operating System + description: Which operating system were you using? + placeholder: MacOS Sonoma 14.3 + validations: + required: false +- type: input + id: package_version + attributes: + label: Package Version + description: Which version of this package were you using? If not the latest version, please check this issue has not since been resolved. + placeholder: 0.2.0 + validations: + required: false +- type: input + id: python_version + attributes: + label: Python Version + description: Which version of Python were you using? + placeholder: 3.12.0 + validations: + required: false +- type: textarea + id: description + attributes: + label: Description + description: Please describe the bug + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..67057c5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Ask a Question + url: https://github.com/matagus/matorral/discussions/new?category=q-a&title=[Question] + about: Ask questions and discuss with other community members diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000..2a7f84f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,10 @@ +name: Feature Request +description: Request an enhancement or new feature. +body: +- type: textarea + id: description + attributes: + label: Description + description: Please describe your feature request with appropriate detail. + validations: + required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..f8dae15 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1 @@ +This closes #. diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000..510730d --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1 @@ +Please report security issues directly over email to matagus+security@gmail.com diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e5903e0 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: +- package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly diff --git a/.github/labels.toml b/.github/labels.toml new file mode 100644 index 0000000..fa94777 --- /dev/null +++ b/.github/labels.toml @@ -0,0 +1,149 @@ +[accessibility] +color = "687DEA" +name = "accessibility" +description = "Accessibility issues" + +[admin] +color = "2E6BAB" +name = "admin" +description = "Admin related issue" + +["blocked/needs-investigation"] +color = "BD134F" +name = "blocked/needs-investigation" +description = "This is blocked: it needs investigation" + +["blocked/user-responsee"] +color = "3C0113" +name = "blocked/user-responsee" +description = "Blocked: this issue is waiting for user response" + +[breaking] +color = "EF24EB" +name = "breaking" +description = "This is a breaking change" + +[bug] +color = "d73a4a" +name = "bug" +description = "Something isn't working" + +["code quality"] +color = "4D8FA9" +name = "code quality" +description = "Code Quality" + +["could not reproduce"] +color = "E4B665" +name = "could not reproduce" +description = "Could not reproduce" + +[dependencies] +color = "D7AFA0" +name = "dependencies" +description = "Dependencies" + +[documentation] +color = "0075ca" +name = "documentation" +description = "Improvements or additions to documentation" + +[duplicate] +color = "cfd3d7" +name = "duplicate" +description = "This issue or pull request already exists" + +[enhancement] +color = "a2eeef" +name = "enhancement" +description = "New feature or request" + +[epic] +color = "4471DE" +name = "epic" +description = "This is an Epic" + +["feature request"] +color = "AF6601" +name = "feature request" +description = "Feature Requests" + +[github-actions] +color = "595E8A" +name = "github-actions" +description = "Github Actions" + +["good first issue"] +color = "2AF655" +name = "good first issue" +description = "Good for newcomers" + +["help wanted"] +color = "008672" +name = "help wanted" +description = "Extra attention is needed" + +[i18n] +color = "1D3BFB" +name = "i18n" +description = "Internacionalization and translations" + +[implemented] +color = "071BB8" +name = "implemented" +description = "This has already been implemented" + +[invalid] +color = "e4e669" +name = "invalid" +description = "This doesn't seem right" + +[non-code-contribution] +color = "63B6DA" +name = "non-code-contribution" +description = "Contributions that doesn't involve programming" + +[nonchangelog] +color = "9A9D37" +name = "nonchangelog" +description = "Ignore this issue when building the changelog" + +["on hold"] +color = "A9221E" +name = "on hold" +description = "On Hold" + +[question] +color = "d876e3" +name = "question" +description = "Further information is requested" + +[security] +color = "B1661C" +name = "security" +description = "Security related issue" + +[stale] +color = "FD622F" +name = "stale" +description = "Stale issues" + +[tests] +color = "E2AC68" +name = "tests" +description = "Issue about a test" + +[ux] +color = "AACC48" +name = "ux" +description = "User Experience related issues" + +[wip] +color = "5B8E1C" +name = "wip" +description = "Work in progress" + +[wontfix] +color = "ffffff" +name = "wontfix" +description = "This will not be worked on" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d4e21b4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: CI +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main +env: + DJANGO_SECRET_KEY: ${{ secrets.DJANGO_SECRET_KEY }} + +jobs: + test: + strategy: + max-parallel: 2 + fail-fast: true + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + django-version: ["4.0", "4.1", "4.2", "5.0"] + os: [ubuntu-latest] + exclude: + - django-version: "4.0" + python-version: "3.11" + - django-version: "4.0" + python-version: "3.12" + - django-version: "4.1" + python-version: "3.12" + - django-version: "5.0" + python-version: "3.9" + runs-on: ${{ matrix.os }} + env: + ENVIRONMENT: "test" + CELERY_ALWAYS_EAGER: 1 + DJANGO_EMAIL_BACKEND: "django.core.mail.backends.console.EmailBackend" + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade hatch + - name: Run tests for Python ${{ matrix.python-version }} and Django ${{ matrix.django-version }} on ${{ matrix.os }} with coverage report + run: | + hatch run test.py${{ matrix.python-version }}-${{ matrix.django-version }}:cov + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml new file mode 100644 index 0000000..db158e9 --- /dev/null +++ b/.github/workflows/labels.yml @@ -0,0 +1,22 @@ +name: Sync Github labels + +on: + push: + branches: + - main + paths: + - ".github/**" + +jobs: + labels: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Install labels + run: pip install labels + - name: Sync config with Github + run: labels -u ${{ github.repository_owner }} -t ${{ secrets.GITHUB_TOKEN }} sync -f .github/labels.toml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..14cc2fc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,21 @@ +name: Create Draft Release + +on: + workflow_dispatch: + push: + tags: + - "v*" + +jobs: + + build: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: ncipollo/release-action@v1 + with: + draft: true + allowUpdates: true + generateReleaseNotes: true diff --git a/.gitignore b/.gitignore index a091ffa..7bc77fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,85 @@ -db.sqlite3 -*.pyc -__pycache__/* +### OSX ### +.DS_Store +.AppleDouble +.LSOverride + +### SublimeText ### +# cache files for sublime text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache + +# workspace files are user-specific +*.sublime-workspace + +# project files should be checked into the repository, unless a significant +# proportion of contributors will probably not be using SublimeText +# *.sublime-project + +# sftp configuration file +sftp-config.json + +# Basics +*.py[cod] +__pycache__ + +# Logs +*.log +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox +nosetests.xml +htmlcov + +# Translations +*.mo +*.pot + +# Pycharm +.idea/* + +# Vim + +*~ +*.swp +*.swo + +# npm +node_modules/ + +# Compass +.sass-cache + +# virtual environments .env + +# User-uploaded media +jirahub/media/ +staticfiles/ + +# Hitch directory +tests/.hitch + +# sqlite db +*.db +*.db-journal +*.sqlite3 + +# celery beat +celerybeat-schedule.db +celerybeat.pid + +# pyenv +.python-version + +.idea + +jirahub.egg-info/ +.pytest_cache/ +celerybeat-schedule + +TODO.md + +data/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..9d1bf2d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,58 @@ +default_stages: [commit] +default_language_version: + python: python3.12 + +repos: + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: "v0.2.1" + hooks: + - id: ruff + args: [--fix] + + - repo: https://github.com/psf/black + rev: 24.1.1 + hooks: + - id: black + args: + - "--target-version=py39" + - "--target-version=py310" + - "--target-version=py311" + - "--target-version=py312" + types: [python] + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-added-large-files + - id: check-ast + - id: check-builtin-literals + - id: check-case-conflict + - id: check-docstring-first + - id: check-shebang-scripts-are-executable + - id: check-merge-conflict + - id: check-json + - id: check-toml + - id: check-xml + - id: check-yaml + - id: debug-statements + - id: destroyed-symlinks + - id: detect-private-key + - id: end-of-file-fixer + exclude: ^LICENSE|\.(html|csv|txt|svg|py)$ + - id: pretty-format-json + args: ["--autofix", "--no-ensure-ascii", "--no-sort-keys"] + - id: requirements-txt-fixer + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + exclude: \.(html|svg)$ + + - repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + + - repo: https://github.com/asottile/pyupgrade + rev: v3.15.0 + hooks: + - id: pyupgrade + args: [--py312] diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..d090393 --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,7 @@ +# Primary Authors + +- Matias Agustin Mendez (https://github.com/matagus) + +# Contributors + +No contributions yet. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..71919e7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM python:3.12 as stage1 + +ENV PYTHONUNBUFFERED 1 + +RUN python -m pip install hatch + +FROM stage1 as stage2 +RUN mkdir /app +WORKDIR /app + +COPY pyproject.toml /app +COPY jirahub/ /app/jirahub/ +COPY README.md /app + +COPY . . + +FROM stage2 as stage3 +CMD ["hatch", "run", "prod:run"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..209f8cc --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +services: + db: + image: postgres:16.2-alpine + ports: + - "5432:5432" + environment: + - POSTGRES_PASSWORD=postgres + - POSTGRES_USER=postgres + - POSTGRES_DB=postgres + volumes: + - ./data/db:/var/lib/postgresql/data/ + + web: + build: + dockerfile: Dockerfile + environment: + - DJANGO_DATABASE_URL=postgres://postgres:postgres@db:5432/postgres + ports: + - "8000:8000" + volumes: + - .:/app + depends_on: + - db diff --git a/jirahub/__init__.py b/jirahub/__init__.py index e69de29..9f7a875 100644 --- a/jirahub/__init__.py +++ b/jirahub/__init__.py @@ -0,0 +1 @@ +version = "0.1.0" diff --git a/jirahub/env.example b/jirahub/env.example index 47d9713..29fee16 100644 --- a/jirahub/env.example +++ b/jirahub/env.example @@ -1,2 +1,5 @@ +DEBUG=1 +SECRET_KEY=EDITME! +DATABASE_URL=sqlite:///db.sqlite3 PO_CONFIG=Account Name 1,slug1,https://slug1.atlassian.net,email1@example.com,TOKEN ACCOUNT_KEYS=KEY1 diff --git a/jirahub/settings.py b/jirahub/settings.py index 1e937e8..a3719b4 100644 --- a/jirahub/settings.py +++ b/jirahub/settings.py @@ -14,26 +14,27 @@ from pathlib import Path from typing import NamedTuple -import dotenv - -from collections import namedtuple +import environ # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent -dotenv.read_dotenv(BASE_DIR / 'jirahub', '.env') - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ +env = environ.Env( + # set casting, default value + DEBUG=(bool, False) +) -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'django-insecure-$59zfcii_x^g5qsb1u#*av#e3=z0o@ccy2xit$&_cjkpck%y@=' +# Take environment variables from .env file +environ.Env.read_env(os.path.join(BASE_DIR / 'jirahub', '.env')) -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +# False if not in os.environ because of casting above +DEBUG = env('DEBUG') -ALLOWED_HOSTS = ['127.0.0.1', 'localhost', 'jirahub.herokuapp.com'] +# Raises Django's ImproperlyConfigured +# exception if SECRET_KEY not in os.environ +SECRET_KEY = env('SECRET_KEY') +ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=['127.0.0.1', 'localhost']) # Application definition @@ -87,10 +88,7 @@ # https://docs.djangoproject.com/en/4.1/ref/settings/#databases DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', - } + 'default': env.db(), } diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b5425ad --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,137 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "jirahub" +dynamic = ["version"] +description = " A webapp to quickly access and browse Jira projects from different accounts." +readme = "README.md" +license = "GPL-3.0-or-later" +authors = [ + { name = "Matias Agustin Mendez", email = "matagus@gmail.com" }, +] +keywords = ["jira", "webapp", "django", "python", "htmx"] +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Web Environment", + "Framework :: Django", + "Framework :: Django :: 4.0", + "Framework :: Django :: 4.1", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", + "Intended Audience :: Developers", + "Intended Audience :: End Users/Desktop", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Natural Language :: English", + "Programming Language :: Python", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] +dependencies = [ + "Django>=4.0,<6.0", + "django-debug-toolbar", + "django-environ", + "django-extensions", + "django-htmx", + "jira", +] + +[project.urls] +Homepage = "https://github.com/matagus/jirahub" +Issues = "https://.github.com/matagus/jirahub/issues" +Repository = "https://github.com/matagus/jirahub" +Changelog = "https://githib.com/matagus/jirahub/releases" + +[tool.hatch.version] +path = "jirahub/__init__.py" + +[tool.hatch.build.targets.sdist] +include = ["."] +exclude = ["db.sqlite3"] + +[tool.hatch.build.targets.wheel] +packages = ["."] +exclude = ["db.sqlite3"] + +[tool.hatch.envs.default] +extra-dependencies = [] + +# Local environment +[tool.hatch.envs.local] +extra-dependencies = [ + "Werkzeug", + "coverage[toml]", + "django-coverage-plugin", + "django-test-plus", + "ipdb", + "ipython", +] + +[tool.hatch.envs.local.scripts] +server = "python manage.py runserver_plus {args}" +shell = "python manage.py shell_plus {args}" +migrate = "python manage.py migrate {args}" +makemigrations = "python manage.py makemigrations {args}" +createuser = "python manage.py createsuperuser {args}" +copy-config = "cp jirahub/env.example jirahub/.env" +install = ["migrate", "copy-config", "createuser"] + +# Production environment +[tool.hatch.envs.prod] +extra-dependencies = [ + "gunicorn", + "psycopg2-binary", +] + +[tool.hatch.envs.prod.scripts] +server = "gunicorn --bind '0.0.0.0:8000' --worker-tmp-dir /dev/shm --workers 3 jirahub.wsgi:application" +migrate = "python manage.py migrate {args}" +makemigrations = "python manage.py makemigrations {args}" +run = ["migrate", "server"] + +# Test environment +[tool.hatch.envs.test] +extra-dependencies = [ + "coverage[toml]", + "django~={matrix:django}.0", + "django_coverage_plugin", +] + +[[tool.hatch.envs.test.matrix]] +django = ["4.0"] +python = ["3.9", "3.10"] + +[[tool.hatch.envs.test.matrix]] +django = ["4.1"] +python = ["3.9", "3.10", "3.11"] + +[[tool.hatch.envs.test.matrix]] +django = ["4.2"] +python = ["3.9", "3.10", "3.11", "3.12"] + +[[tool.hatch.envs.test.matrix]] +django = ["5.0"] +python = ["3.10", "3.11", "3.12"] + +[tool.hatch.envs.test.scripts] +test = "python manage.py test --settings=jirahub.settings {args}" +test-cov = "coverage run -m django test --settings=jirahub.settings {args}" +cov-report = ["coverage json", "coverage report"] +cov = ["test-cov", "cov-report"] + +[tool.ruff] +line-length = 120 +exclude = ["db.sqlite3", "static", "jirahub/settings.py"] + +[tool.black] +line-length = 120 + +[tool.codespell] +skip = "*.db,*.sqlite3,static/*" +quiet-level = 3 +write-changes = true diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 370ee77..0000000 --- a/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -Django -jira -django-dotenv -django-htmx -django-debug-toolbar -django-extensions