From 4635bffc9f96285b074072a83b0cb86522e53456 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Mon, 10 Apr 2023 14:02:42 +0300 Subject: [PATCH 01/12] Fix tests --- FOSSDB_web/apps/fossdb/admin.py | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FOSSDB_web/apps/fossdb/admin.py b/FOSSDB_web/apps/fossdb/admin.py index ea74c31..4730425 100644 --- a/FOSSDB_web/apps/fossdb/admin.py +++ b/FOSSDB_web/apps/fossdb/admin.py @@ -1,4 +1,4 @@ -from django.contrib import admin +# from django.contrib import admin from .host.models import HostingPlatform, ProjectHostingPlatform from .language.models import ProgrammingLanguage, ProjectProgrammingLanguage diff --git a/setup.cfg b/setup.cfg index 3ef6ae0..11cce81 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = FOSSDB-Web -description = Open-Source Software Database Website +description = Free and Open-Source Software Database Website author = Kristofers Solo license = GPL3 license_files = LICENSE From f9246064efc7ea75629b09ed9c060a65386c1aa4 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Mon, 10 Apr 2023 13:50:52 +0300 Subject: [PATCH 02/12] Created `README.md` file --- README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..208f8d4 --- /dev/null +++ b/README.md @@ -0,0 +1,51 @@ +# FOSSDB + +[![License](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) +![Tests](https://github.com/kristoferssolo/FOSSDB-Web/actions/workflows/test.yml/badge.svg) + + +FOSSDB is an open-source web application that helps users find, contribute, and collaborate on free and open-source software (FOSS) projects. + +## Table of Contents +- [Installation](#installation) +- [Usage](#usage) +- [Contributing](#contributing) +- [License](#license) + +## Installation +1. Clone the repository and `cd` into it. +2. Install dependencies: +```sh +pip install -r requirements.txt +``` +3. Enter your `SECRET_KEY` and database information into `config.json` file. +4. Run database migrations: +```sh +python manage.py migrate +``` +5. Create a superuser: +```sh +python manage.py createsuperuser +``` +6. Run the development server: +```sh +python manage.py runserver +``` + +## Usage +After following the installation steps, you can access the application at [https://localhost:8000](https://localhost:8000). +Here are some of the features: +- Browse projects by programming language, license, or search term +- View project details, including programming languages, licenses, and descriptions +- Create a new project and add programming languages and licenses +- Edit and delete existing projects + +## Contributing +Contributions are always welcome! Here are some ways to get started: +1. Fork the repository and make your changes. +2. Submit a pull request. +3. Respond to open issues or submit new ones. +4. Improve documentation. + +## License +This project is licensed under the [GPL3 License](https://www.gnu.org/licenses/gpl-3.0.en.html). See the [LICENSE](./LICENSE) file for details. From f10fe979cecf8c779e73cc05397a75bea086babd Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Wed, 12 Apr 2023 10:35:48 +0300 Subject: [PATCH 03/12] Separated lint and test to 2 files --- .github/workflows/lint.yml | 25 +++++++++++++++++++++++++ .github/workflows/test.yml | 4 ++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..41df0de --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +name: Lint +on: + - push + - pull_request +jobs: + lint: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + python-version: ["3.10"] + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements_dev.txt + - name: Lint with mypy + run: mypy FOSSDB_web + - name: Lint with flake8 + run: flake8 FOSSDB_web diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b1a1554..365ee12 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox tox-gh-actions + pip install -r requirements.txt - name: Test with tox - run: tox + run: python manage.py test From 623c5e22aed5c1c552b08d52345f234539479c03 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Wed, 12 Apr 2023 10:45:21 +0300 Subject: [PATCH 04/12] Fix tests --- .github/workflows/lint.yml | 4 ++-- .github/workflows/test.yml | 4 ++-- FOSSDB_web/apps/fossdb/admin.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 41df0de..521effb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,7 +3,7 @@ on: - push - pull_request jobs: - lint: + test: runs-on: ${{ matrix.os }} strategy: matrix: @@ -18,7 +18,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements_dev.txt + pip install mypy flake8 - name: Lint with mypy run: mypy FOSSDB_web - name: Lint with flake8 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 365ee12..a410855 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - - name: Test with tox + pip install django + - name: Test with django test run: python manage.py test diff --git a/FOSSDB_web/apps/fossdb/admin.py b/FOSSDB_web/apps/fossdb/admin.py index 4730425..ea74c31 100644 --- a/FOSSDB_web/apps/fossdb/admin.py +++ b/FOSSDB_web/apps/fossdb/admin.py @@ -1,4 +1,4 @@ -# from django.contrib import admin +from django.contrib import admin from .host.models import HostingPlatform, ProjectHostingPlatform from .language.models import ProgrammingLanguage, ProjectProgrammingLanguage From 4509ee531328e3fc13156cd9c7e4278b53b696ab Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Wed, 12 Apr 2023 10:46:57 +0300 Subject: [PATCH 05/12] Install requirements for tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a410855..88ecea3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install django + pip install -r requirements.txt - name: Test with django test run: python manage.py test From 8439fa56bc14aecf23a6e8ee09859b1a1e79af86 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Wed, 12 Apr 2023 10:47:54 +0300 Subject: [PATCH 06/12] Added lint to README --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 208f8d4..3772914 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # FOSSDB -[![License](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) -![Tests](https://github.com/kristoferssolo/FOSSDB-Web/actions/workflows/test.yml/badge.svg) +[![License](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) +![Tests](https://github.com/kristoferssolo/FOSSDB-Web/actions/workflows/test.yml/badge.svg) +![Lint](https://github.com/kristoferssolo/FOSSDB-Web/actions/workflows/lint.yml/badge.svg) FOSSDB is an open-source web application that helps users find, contribute, and collaborate on free and open-source software (FOSS) projects. From 4dcf8709a2480c782541a19dff3c53889772cec6 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Sat, 22 Apr 2023 13:47:59 +0300 Subject: [PATCH 07/12] Renamed project to `FOSSDB` --- {FOSSDB_web => FOSSDB}/__init__.py | 0 {FOSSDB_web => FOSSDB}/apps/account/__init__.py | 0 {FOSSDB_web => FOSSDB}/apps/account/admin.py | 0 {FOSSDB_web => FOSSDB}/apps/account/apps.py | 0 {FOSSDB_web => FOSSDB}/apps/account/forms.py | 0 {FOSSDB_web => FOSSDB}/apps/account/tests.py | 0 {FOSSDB_web => FOSSDB}/apps/account/urls.py | 0 {FOSSDB_web => FOSSDB}/apps/account/views.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/__init__.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/admin.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/apps.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/forms.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/host/forms.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/host/models.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/language/forms.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/language/models.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/license/forms.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/license/models.py | 0 .../apps/fossdb/migrations/0001_initial.py | 0 .../fossdb/migrations/0002_operatingsystem_project_os.py | 0 .../apps/fossdb/migrations/0003_star_project_star.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/migrations/__init__.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/models.py | 0 .../apps/fossdb/operating_system/models.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/star/models.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/tag/models.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/tests.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/urls.py | 0 {FOSSDB_web => FOSSDB}/apps/fossdb/views.py | 0 {FOSSDB_web => FOSSDB}/asgi.py | 4 ++-- {FOSSDB_web => FOSSDB}/settings.py | 8 ++++---- {FOSSDB_web => FOSSDB}/urls.py | 2 +- {FOSSDB_web => FOSSDB}/wsgi.py | 4 ++-- README.md | 4 ++-- manage.py | 2 +- pyproject.toml | 2 +- setup.cfg | 4 ++-- tox.ini | 4 ++-- 38 files changed, 17 insertions(+), 17 deletions(-) rename {FOSSDB_web => FOSSDB}/__init__.py (100%) rename {FOSSDB_web => FOSSDB}/apps/account/__init__.py (100%) rename {FOSSDB_web => FOSSDB}/apps/account/admin.py (100%) rename {FOSSDB_web => FOSSDB}/apps/account/apps.py (100%) rename {FOSSDB_web => FOSSDB}/apps/account/forms.py (100%) rename {FOSSDB_web => FOSSDB}/apps/account/tests.py (100%) rename {FOSSDB_web => FOSSDB}/apps/account/urls.py (100%) rename {FOSSDB_web => FOSSDB}/apps/account/views.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/__init__.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/admin.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/apps.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/forms.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/host/forms.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/host/models.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/language/forms.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/language/models.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/license/forms.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/license/models.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/migrations/0001_initial.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/migrations/0002_operatingsystem_project_os.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/migrations/0003_star_project_star.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/migrations/__init__.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/models.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/operating_system/models.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/star/models.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/tag/models.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/tests.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/urls.py (100%) rename {FOSSDB_web => FOSSDB}/apps/fossdb/views.py (100%) rename {FOSSDB_web => FOSSDB}/asgi.py (73%) rename {FOSSDB_web => FOSSDB}/settings.py (95%) rename {FOSSDB_web => FOSSDB}/urls.py (96%) rename {FOSSDB_web => FOSSDB}/wsgi.py (73%) diff --git a/FOSSDB_web/__init__.py b/FOSSDB/__init__.py similarity index 100% rename from FOSSDB_web/__init__.py rename to FOSSDB/__init__.py diff --git a/FOSSDB_web/apps/account/__init__.py b/FOSSDB/apps/account/__init__.py similarity index 100% rename from FOSSDB_web/apps/account/__init__.py rename to FOSSDB/apps/account/__init__.py diff --git a/FOSSDB_web/apps/account/admin.py b/FOSSDB/apps/account/admin.py similarity index 100% rename from FOSSDB_web/apps/account/admin.py rename to FOSSDB/apps/account/admin.py diff --git a/FOSSDB_web/apps/account/apps.py b/FOSSDB/apps/account/apps.py similarity index 100% rename from FOSSDB_web/apps/account/apps.py rename to FOSSDB/apps/account/apps.py diff --git a/FOSSDB_web/apps/account/forms.py b/FOSSDB/apps/account/forms.py similarity index 100% rename from FOSSDB_web/apps/account/forms.py rename to FOSSDB/apps/account/forms.py diff --git a/FOSSDB_web/apps/account/tests.py b/FOSSDB/apps/account/tests.py similarity index 100% rename from FOSSDB_web/apps/account/tests.py rename to FOSSDB/apps/account/tests.py diff --git a/FOSSDB_web/apps/account/urls.py b/FOSSDB/apps/account/urls.py similarity index 100% rename from FOSSDB_web/apps/account/urls.py rename to FOSSDB/apps/account/urls.py diff --git a/FOSSDB_web/apps/account/views.py b/FOSSDB/apps/account/views.py similarity index 100% rename from FOSSDB_web/apps/account/views.py rename to FOSSDB/apps/account/views.py diff --git a/FOSSDB_web/apps/fossdb/__init__.py b/FOSSDB/apps/fossdb/__init__.py similarity index 100% rename from FOSSDB_web/apps/fossdb/__init__.py rename to FOSSDB/apps/fossdb/__init__.py diff --git a/FOSSDB_web/apps/fossdb/admin.py b/FOSSDB/apps/fossdb/admin.py similarity index 100% rename from FOSSDB_web/apps/fossdb/admin.py rename to FOSSDB/apps/fossdb/admin.py diff --git a/FOSSDB_web/apps/fossdb/apps.py b/FOSSDB/apps/fossdb/apps.py similarity index 100% rename from FOSSDB_web/apps/fossdb/apps.py rename to FOSSDB/apps/fossdb/apps.py diff --git a/FOSSDB_web/apps/fossdb/forms.py b/FOSSDB/apps/fossdb/forms.py similarity index 100% rename from FOSSDB_web/apps/fossdb/forms.py rename to FOSSDB/apps/fossdb/forms.py diff --git a/FOSSDB_web/apps/fossdb/host/forms.py b/FOSSDB/apps/fossdb/host/forms.py similarity index 100% rename from FOSSDB_web/apps/fossdb/host/forms.py rename to FOSSDB/apps/fossdb/host/forms.py diff --git a/FOSSDB_web/apps/fossdb/host/models.py b/FOSSDB/apps/fossdb/host/models.py similarity index 100% rename from FOSSDB_web/apps/fossdb/host/models.py rename to FOSSDB/apps/fossdb/host/models.py diff --git a/FOSSDB_web/apps/fossdb/language/forms.py b/FOSSDB/apps/fossdb/language/forms.py similarity index 100% rename from FOSSDB_web/apps/fossdb/language/forms.py rename to FOSSDB/apps/fossdb/language/forms.py diff --git a/FOSSDB_web/apps/fossdb/language/models.py b/FOSSDB/apps/fossdb/language/models.py similarity index 100% rename from FOSSDB_web/apps/fossdb/language/models.py rename to FOSSDB/apps/fossdb/language/models.py diff --git a/FOSSDB_web/apps/fossdb/license/forms.py b/FOSSDB/apps/fossdb/license/forms.py similarity index 100% rename from FOSSDB_web/apps/fossdb/license/forms.py rename to FOSSDB/apps/fossdb/license/forms.py diff --git a/FOSSDB_web/apps/fossdb/license/models.py b/FOSSDB/apps/fossdb/license/models.py similarity index 100% rename from FOSSDB_web/apps/fossdb/license/models.py rename to FOSSDB/apps/fossdb/license/models.py diff --git a/FOSSDB_web/apps/fossdb/migrations/0001_initial.py b/FOSSDB/apps/fossdb/migrations/0001_initial.py similarity index 100% rename from FOSSDB_web/apps/fossdb/migrations/0001_initial.py rename to FOSSDB/apps/fossdb/migrations/0001_initial.py diff --git a/FOSSDB_web/apps/fossdb/migrations/0002_operatingsystem_project_os.py b/FOSSDB/apps/fossdb/migrations/0002_operatingsystem_project_os.py similarity index 100% rename from FOSSDB_web/apps/fossdb/migrations/0002_operatingsystem_project_os.py rename to FOSSDB/apps/fossdb/migrations/0002_operatingsystem_project_os.py diff --git a/FOSSDB_web/apps/fossdb/migrations/0003_star_project_star.py b/FOSSDB/apps/fossdb/migrations/0003_star_project_star.py similarity index 100% rename from FOSSDB_web/apps/fossdb/migrations/0003_star_project_star.py rename to FOSSDB/apps/fossdb/migrations/0003_star_project_star.py diff --git a/FOSSDB_web/apps/fossdb/migrations/__init__.py b/FOSSDB/apps/fossdb/migrations/__init__.py similarity index 100% rename from FOSSDB_web/apps/fossdb/migrations/__init__.py rename to FOSSDB/apps/fossdb/migrations/__init__.py diff --git a/FOSSDB_web/apps/fossdb/models.py b/FOSSDB/apps/fossdb/models.py similarity index 100% rename from FOSSDB_web/apps/fossdb/models.py rename to FOSSDB/apps/fossdb/models.py diff --git a/FOSSDB_web/apps/fossdb/operating_system/models.py b/FOSSDB/apps/fossdb/operating_system/models.py similarity index 100% rename from FOSSDB_web/apps/fossdb/operating_system/models.py rename to FOSSDB/apps/fossdb/operating_system/models.py diff --git a/FOSSDB_web/apps/fossdb/star/models.py b/FOSSDB/apps/fossdb/star/models.py similarity index 100% rename from FOSSDB_web/apps/fossdb/star/models.py rename to FOSSDB/apps/fossdb/star/models.py diff --git a/FOSSDB_web/apps/fossdb/tag/models.py b/FOSSDB/apps/fossdb/tag/models.py similarity index 100% rename from FOSSDB_web/apps/fossdb/tag/models.py rename to FOSSDB/apps/fossdb/tag/models.py diff --git a/FOSSDB_web/apps/fossdb/tests.py b/FOSSDB/apps/fossdb/tests.py similarity index 100% rename from FOSSDB_web/apps/fossdb/tests.py rename to FOSSDB/apps/fossdb/tests.py diff --git a/FOSSDB_web/apps/fossdb/urls.py b/FOSSDB/apps/fossdb/urls.py similarity index 100% rename from FOSSDB_web/apps/fossdb/urls.py rename to FOSSDB/apps/fossdb/urls.py diff --git a/FOSSDB_web/apps/fossdb/views.py b/FOSSDB/apps/fossdb/views.py similarity index 100% rename from FOSSDB_web/apps/fossdb/views.py rename to FOSSDB/apps/fossdb/views.py diff --git a/FOSSDB_web/asgi.py b/FOSSDB/asgi.py similarity index 73% rename from FOSSDB_web/asgi.py rename to FOSSDB/asgi.py index e090765..11a6b23 100644 --- a/FOSSDB_web/asgi.py +++ b/FOSSDB/asgi.py @@ -1,5 +1,5 @@ """ -ASGI config for FOSSDB_web project. +ASGI config for FOSSDB project. It exposes the ASGI callable as a module-level variable named ``application``. @@ -11,6 +11,6 @@ import os from django.core.asgi import get_asgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FOSSDB_web.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FOSSDB.settings") application = get_asgi_application() diff --git a/FOSSDB_web/settings.py b/FOSSDB/settings.py similarity index 95% rename from FOSSDB_web/settings.py rename to FOSSDB/settings.py index 0c10737..39ae324 100644 --- a/FOSSDB_web/settings.py +++ b/FOSSDB/settings.py @@ -1,5 +1,5 @@ """ -Django settings for FOSSDB_web project. +Django settings for FOSSDB project. Generated by "django-admin startproject" using Django 4.0.5. @@ -16,7 +16,7 @@ from pathlib import Path # Build paths inside the project like this: BASE_DIR / "subdir". BASE_PATH = Path(__file__).resolve().parent.parent -sys.path.insert(0, str(BASE_PATH.joinpath("FOSSDB_web", "apps"))) +sys.path.insert(0, str(BASE_PATH.joinpath("FOSSDB", "apps"))) # SECURITY WARNING: don't run with debug turned on in production! @@ -56,7 +56,7 @@ MIDDLEWARE = [ "django.middleware.clickjacking.XFrameOptionsMiddleware", ] -ROOT_URLCONF = "FOSSDB_web.urls" +ROOT_URLCONF = "FOSSDB.urls" TEMPLATES = [ { @@ -74,7 +74,7 @@ TEMPLATES = [ }, ] -WSGI_APPLICATION = "FOSSDB_web.wsgi.application" +WSGI_APPLICATION = "FOSSDB.wsgi.application" # Database diff --git a/FOSSDB_web/urls.py b/FOSSDB/urls.py similarity index 96% rename from FOSSDB_web/urls.py rename to FOSSDB/urls.py index a68021a..6618184 100644 --- a/FOSSDB_web/urls.py +++ b/FOSSDB/urls.py @@ -1,4 +1,4 @@ -"""FOSSDB_web URL Configuration +"""FOSSDB URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.0/topics/http/urls/ diff --git a/FOSSDB_web/wsgi.py b/FOSSDB/wsgi.py similarity index 73% rename from FOSSDB_web/wsgi.py rename to FOSSDB/wsgi.py index 3d462f8..db8157c 100644 --- a/FOSSDB_web/wsgi.py +++ b/FOSSDB/wsgi.py @@ -1,5 +1,5 @@ """ -WSGI config for FOSSDB_web project. +WSGI config for FOSSDB project. It exposes the WSGI callable as a module-level variable named ``application``. @@ -11,6 +11,6 @@ import os from django.core.wsgi import get_wsgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FOSSDB_web.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FOSSDB.settings") application = get_wsgi_application() diff --git a/README.md b/README.md index 3772914..6d6ce19 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # FOSSDB [![License](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) -![Tests](https://github.com/kristoferssolo/FOSSDB-Web/actions/workflows/test.yml/badge.svg) -![Lint](https://github.com/kristoferssolo/FOSSDB-Web/actions/workflows/lint.yml/badge.svg) +![Tests](https://github.com/kristoferssolo/FOSSDB/actions/workflows/test.yml/badge.svg) +![Lint](https://github.com/kristoferssolo/FOSSDB/actions/workflows/lint.yml/badge.svg) FOSSDB is an open-source web application that helps users find, contribute, and collaborate on free and open-source software (FOSS) projects. diff --git a/manage.py b/manage.py index 94b8cd0..00cee50 100755 --- a/manage.py +++ b/manage.py @@ -6,7 +6,7 @@ import sys def main(): """Run administrative tasks.""" - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FOSSDB_web.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FOSSDB.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: diff --git a/pyproject.toml b/pyproject.toml index 53ca1a8..b770667 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" check_untyped_defs = true disallow_any_generics = true ignore_missing_imports = true -mypy_path = "FOSSDB_web" +mypy_path = "FOSSDB" no_implicit_optional = true no_implicit_reexport = true show_error_codes = true diff --git a/setup.cfg b/setup.cfg index 11cce81..0d6842f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [metadata] -name = FOSSDB-Web +name = FOSSDB description = Free and Open-Source Software Database Website author = Kristofers Solo license = GPL3 @@ -9,7 +9,7 @@ classifiers = Programming Language :: Python :: 3.10 [options] -packages = FOSSDB_web +packages = FOSSDB install_requires = Django>=4.1 Pillow>=9.4.0 diff --git a/tox.ini b/tox.ini index 0e5c0d3..72d22b6 100644 --- a/tox.ini +++ b/tox.ini @@ -16,10 +16,10 @@ commands = python manage.py test [testenv:flake8] basepython = python3.10 deps = flake8 -commands = flake8 FOSSDB_web +commands = flake8 FOSSDB [testenv:mypy] basepython = python3.10 deps = -r{toxinidir}/requirements_dev.txt -commands = mypy FOSSDB_web +commands = mypy FOSSDB From 5b0c5dd244f61d611ab53628712b748788abaf4c Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Sun, 23 Apr 2023 18:32:46 +0300 Subject: [PATCH 08/12] Changed `flake8` to `ruff` --- .github/workflows/lint.yml | 25 ------------------------- .github/workflows/ruff.yml | 8 ++++++++ .github/workflows/test.yml | 23 +++++++++-------------- FOSSDB/apps/fossdb/models.py | 12 ++++++++---- pyproject.toml | 3 +++ requirements_dev.txt | 5 +---- setup.cfg | 35 ----------------------------------- setup.py | 4 ---- tox.ini | 25 ------------------------- 9 files changed, 29 insertions(+), 111 deletions(-) delete mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/ruff.yml delete mode 100644 setup.cfg delete mode 100644 setup.py delete mode 100644 tox.ini diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 521effb..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Lint -on: - - push - - pull_request -jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - python-version: ["3.10"] - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install mypy flake8 - - name: Lint with mypy - run: mypy FOSSDB_web - - name: Lint with flake8 - run: flake8 FOSSDB_web diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..563b87d --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,8 @@ +name: Ruff +on: [push, pull_request] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: chartboost/ruff-action@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 88ecea3..264e1d4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,23 +1,18 @@ -name: Test -on: - - push - - pull_request +name: Django Test +on: [push, pull_request] jobs: test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - python-version: ["3.10"] + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup_python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: "3.10" - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - - name: Test with django test + - name: Run tests run: python manage.py test diff --git a/FOSSDB/apps/fossdb/models.py b/FOSSDB/apps/fossdb/models.py index 53d1bd0..5f19875 100644 --- a/FOSSDB/apps/fossdb/models.py +++ b/FOSSDB/apps/fossdb/models.py @@ -14,13 +14,16 @@ User = settings.AUTH_USER_MODEL class Project(models.Model): - uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + uuid = models.UUIDField( + primary_key=True, default=uuid.uuid4, editable=False) author = models.ForeignKey(User, on_delete=models.CASCADE, db_index=True) name = models.CharField(max_length=255) description = models.TextField(blank=True, default="") licenses = models.ManyToManyField(License) - programming_languages = models.ManyToManyField(ProgrammingLanguage, through="ProjectProgrammingLanguage", related_name="projects") - hosting_platform = models.ManyToManyField(HostingPlatform, through="ProjectHostingPlatform", related_name="projects") + programming_languages = models.ManyToManyField( + ProgrammingLanguage, through="ProjectProgrammingLanguage", related_name="projects") + hosting_platform = models.ManyToManyField( + HostingPlatform, through="ProjectHostingPlatform", related_name="projects") tag = models.ManyToManyField(Tag) os = models.ManyToManyField(OperatingSystem) star = models.ManyToManyField(Star, related_name="projects_star") @@ -38,5 +41,6 @@ class Project(models.Model): def save(self, *args, **kwargs): if not self.uuid: - self.uuid = uuid.uuid3(uuid.uuid4(), f"{self.author.username}-{self.name}") + self.uuid = uuid.uuid3( + uuid.uuid4(), f"{self.author.username}-{self.name}") super().save(*args, **kwargs) diff --git a/pyproject.toml b/pyproject.toml index b770667..ed7c9bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,3 +15,6 @@ warn_redundant_casts = true warn_return_any = true warn_unreachable = true warn_unused_configs = true + +[tool.ruff] +line-length = 160 diff --git a/requirements_dev.txt b/requirements_dev.txt index 14597cb..8373b5e 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,5 +1,2 @@ -flake8==6.0.0 mypy==0.991 -pytest-cov==4.0.0 -pytest==7.2.0 -tox==3.27.1 +ruff==0.0.262 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 0d6842f..0000000 --- a/setup.cfg +++ /dev/null @@ -1,35 +0,0 @@ -[metadata] -name = FOSSDB -description = Free and Open-Source Software Database Website -author = Kristofers Solo -license = GPL3 -license_files = LICENSE -platforms = unix, linux, osx, cygwin, win32 -classifiers = - Programming Language :: Python :: 3.10 - -[options] -packages = FOSSDB -install_requires = - Django>=4.1 - Pillow>=9.4.0 - fontawesomefree>=6.2.1 - mysqlclient>=2.1.1 - -python_requires = >=3.10 -package_dir = =. -zip_safe = no - -[options.extras_require] -testing = - flake8>=6.0.0 - mypy>=0.991 - pytest-cov>=4.0.0 - pytest>=7.2.0 - tox>=3.27.1 - -[options.package_data] -detector = py.typed - -[flake8] -max-line-length = 160 diff --git a/setup.py b/setup.py deleted file mode 100644 index 7f1a176..0000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -from setuptools import setup - -if __name__ == "__main__": - setup() diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 72d22b6..0000000 --- a/tox.ini +++ /dev/null @@ -1,25 +0,0 @@ -[tox] -minversion = 3.8.0 -envlist = django, flake8, mypy -isolated_build = true - -[gh-actions] -python = - 3.10: django, mypy, flake8 - - -[testenv:django] -basepython = python3.10 -deps = django -commands = python manage.py test - -[testenv:flake8] -basepython = python3.10 -deps = flake8 -commands = flake8 FOSSDB - -[testenv:mypy] -basepython = python3.10 -deps = - -r{toxinidir}/requirements_dev.txt -commands = mypy FOSSDB From 88b589a611df953776305c3ec91033811264796d Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Sun, 23 Apr 2023 18:33:22 +0300 Subject: [PATCH 09/12] Fix url --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6d6ce19..3056c88 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![License](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) ![Tests](https://github.com/kristoferssolo/FOSSDB/actions/workflows/test.yml/badge.svg) -![Lint](https://github.com/kristoferssolo/FOSSDB/actions/workflows/lint.yml/badge.svg) +![Lint](https://github.com/kristoferssolo/FOSSDB/actions/workflows/ruff.yml/badge.svg) FOSSDB is an open-source web application that helps users find, contribute, and collaborate on free and open-source software (FOSS) projects. From 915505a1e817fca567812ed39c6756782f1795fc Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Sun, 23 Apr 2023 18:36:14 +0300 Subject: [PATCH 10/12] Fix setup-python --- .github/workflows/test.yml | 2 +- README.md | 4 ++-- pyproject.toml | 4 ---- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 264e1d4..6b85293 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup_python@v2 + uses: actions/setup-python@v2 with: python-version: "3.10" - name: Install dependencies diff --git a/README.md b/README.md index 3056c88..0524bad 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # FOSSDB [![License](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) -![Tests](https://github.com/kristoferssolo/FOSSDB/actions/workflows/test.yml/badge.svg) -![Lint](https://github.com/kristoferssolo/FOSSDB/actions/workflows/ruff.yml/badge.svg) +![Django Test](https://github.com/kristoferssolo/FOSSDB/actions/workflows/test.yml/badge.svg) +![Ruff](https://github.com/kristoferssolo/FOSSDB/actions/workflows/ruff.yml/badge.svg) FOSSDB is an open-source web application that helps users find, contribute, and collaborate on free and open-source software (FOSS) projects. diff --git a/pyproject.toml b/pyproject.toml index ed7c9bd..636869d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,3 @@ -[build-system] -requires = ["setuptools>=42.0", "wheel"] -build-backend = "setuptools.build_meta" - [tool.mypy] check_untyped_defs = true disallow_any_generics = true From fc43ec6a9ae84b1e5123dc1810858e9e19e1968d Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Sun, 23 Apr 2023 18:38:57 +0300 Subject: [PATCH 11/12] Test errors --- .github/workflows/test.yml | 4 ++-- FOSSDB/apps/fossdb/models.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6b85293..f575616 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,9 +5,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: "3.10" - name: Install dependencies diff --git a/FOSSDB/apps/fossdb/models.py b/FOSSDB/apps/fossdb/models.py index 5f19875..7f189d7 100644 --- a/FOSSDB/apps/fossdb/models.py +++ b/FOSSDB/apps/fossdb/models.py @@ -10,7 +10,7 @@ from .operating_system.models import OperatingSystem from .star.models import Star from .tag.models import Tag -User = settings.AUTH_USER_MODEL +ser = settings.AUTH_USER_MODEL class Project(models.Model): From 3c6b8f3436440f6db235a7bb6cf5ea883d38b758 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Sun, 23 Apr 2023 18:41:12 +0300 Subject: [PATCH 12/12] Fix errors --- FOSSDB/apps/fossdb/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FOSSDB/apps/fossdb/models.py b/FOSSDB/apps/fossdb/models.py index 7f189d7..5f19875 100644 --- a/FOSSDB/apps/fossdb/models.py +++ b/FOSSDB/apps/fossdb/models.py @@ -10,7 +10,7 @@ from .operating_system.models import OperatingSystem from .star.models import Star from .tag.models import Tag -ser = settings.AUTH_USER_MODEL +User = settings.AUTH_USER_MODEL class Project(models.Model):