From de1d66c9dc3803fadc8a07323e50a521d753bf34 Mon Sep 17 00:00:00 2001 From: Paul Harter Date: Thu, 27 Nov 2025 10:32:19 +0100 Subject: [PATCH 1/4] switched to pyproject.toml for dependencies --- .github/workflows/django.yml | 6 +-- CONTRIBUTING.md | 15 ++++-- README.md | 14 ++---- canvas_editor/pyproject.toml | 90 ++++++++++++++++++++++++---------- canvas_editor/requirements.txt | 17 ------- 5 files changed, 81 insertions(+), 61 deletions(-) delete mode 100644 canvas_editor/requirements.txt diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index e5b3c448..0d3ec1d5 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -14,7 +14,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ['3.10', '3.11', '3.12', '3.13'] + python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - name: Check out repository @@ -29,7 +29,7 @@ jobs: working-directory: canvas_editor run: | python -m pip install --upgrade pip - pip install -r requirements.txt + python -m pip install -e ".[dev]" - name: Run Tests working-directory: canvas_editor @@ -86,6 +86,6 @@ jobs: coverage xml - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # release v5.5.1 + uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # release v5.5.1 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2510c059..b99858eb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,9 +8,12 @@ By participating, you can help improve the project and make it even better :rais 1. **Fork the Repository**: Click the "Fork" button at the top right corner of this repository's page to create your own copy. 2. **Clone Your Fork**: Clone your forked repository to your local machine using Git :octocat:: + ```bash git clone https://github.com/ARTIST-Association/CANVAS.git `` + ``` + 3. **Install all development dependencies** in a separate python virtual environment from the main branch of your repo. This will put a number of pre-commit hooks, for code linting and code style for both Python and JavaScript, into place. It will also install tools like ruff and ESLint, used for development. @@ -21,17 +24,20 @@ By participating, you can help improve the project and make it even better :rais python3 -m venv source + # Dev tools + cd CANVAS/canvas_editor/ + python -m pip install -e ".[dev]" + # Pre commit hooks pre-commit install - # Dev tools - cd canvas_editor/ - python -m pip install -r requirements.txt + # Install all JavaScript dev dependencies npm install ``` 4. **Create a Branch**: Create a new branch for your contribution. Choose a descriptive name. Depending on what you want to work on, prepend either of the following prefixes, `features`, `maintenance`, `bugfix`, or `hotfix`. Example: + ```bash git checkout -b features/your-feature-name ``` @@ -145,11 +151,11 @@ By participating, you can help improve the project and make it even better :rais As the remote branch is already linked - 8. **Rebase Onto Current Main:** Rebase your feature branch onto the current main branch of the original repo. This will include any changes that might have been pushed into the main in the meantime and resolve possible conflicts. To sync your fork with the original upstream repo, check out [this page](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork) or follow the steps below. Note that before you can sync your fork with an upstream repo, you must configure a remote that points to the upstream repository in Git. + ``` cd git fetch upstream @@ -160,7 +166,6 @@ By participating, you can help improve the project and make it even better :rais 9. **Open a Pull Request**: Go to the [original repository](https://github.com/ARTIST-Association/CANVAS.git) and click the "New Pull Request" button. Follow the guidelines in the template to submit your pull request. - ## Code of Conduct Please note that we have a [Code of Conduct](CODE_OF_CONDUCT.md), and we expect all contributors to follow it. Be kind and respectful to one another :blue_heart:. diff --git a/README.md b/README.md index 2e388d7a..934a0a58 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,8 @@ We heavily recommend to install `CANVAS` package in a dedicated `Python3.10+` virtual environment ([click here for the documentation](https://docs.python.org/3/library/venv.html)). -After setting up and activating the virtual environment _(or deciding against it)_, execute the following instructions, to set up the code base +After setting up and activating the virtual environment _(or deciding against it)_, execute the following instructions, start the server. +See [CONTRIBUTING.md](/CONTRIBUTING.md) on how to set up a development environment. ```bash # You may have to replace python with python3, depending on your operating system. @@ -22,22 +23,15 @@ After setting up and activating the virtual environment _(or deciding against it git clone https://github.com/ARTIST-Association/CANVAS.git # install requirements -cd CANVAS-PSE2425/ -pip install -r requirements.txt - -# Installing Pre-commit Hooks -pre-commit install +cd CANVAS-PSE2425/canvas_editor/ +pip install . # add the .env file to the root of the canvas_editor folder # containing debug variable, client_id + secret_key for OpenID, email-host password, etc. # configure the database -cd canvas_editor/ python manage.py migrate -# Install npm dependencies -npm install - # start the server python manage.py runserver diff --git a/canvas_editor/pyproject.toml b/canvas_editor/pyproject.toml index 1f9f6738..ca421720 100644 --- a/canvas_editor/pyproject.toml +++ b/canvas_editor/pyproject.toml @@ -5,35 +5,73 @@ description = "An web-based 3D editor for ARTIST" readme = "README.md" requires-python = ">=3.10" + +dependencies = [ + "django==5.2.8", + "djangorestframework==3.16.1", + "artist-csp==1.0.0", + "django-cleanup==9.0.0", + "django-allauth==65.13.1", + "python-dotenv==1.2.1", + "Pillow==12.0.0", + "jwt==1.4.0", +] + + +[project.optional-dependencies] +dev = [ + "coverage==7.12.0", + "pre-commit==4.5.0", + "mypy==1.18.2", + "ruff==0.14.6", + "parameterized==0.9.0", + "unittest-xml-reporting==3.2.0", +] + + +[tool.setuptools.packages.find] +include = [ + "account_management", + "autosave_api", + "canvas", + "editor", + "hdf_management", + "job_interface", + "project_management", + "user_settings", + "static", + "templates", +] + [tool.ruff] # Exclude a variety of commonly ignored directories. exclude = [ - ".bzr", - ".direnv", - ".eggs", - ".git", - ".git-rewrite", - ".hg", - ".ipynb_checkpoints", - ".mypy_cache", - ".nox", - ".pants.d", - ".pyenv", - ".pytest_cache", - ".pytype", - ".ruff_cache", - ".svn", - ".tox", - ".venv", - ".vscode", - "__pypackages__", - "_build", - "buck-out", - "build", - "dist", - "node_modules", - "site-packages", - "venv", + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", ] line-length = 120 diff --git a/canvas_editor/requirements.txt b/canvas_editor/requirements.txt deleted file mode 100644 index df526446..00000000 --- a/canvas_editor/requirements.txt +++ /dev/null @@ -1,17 +0,0 @@ -django -djangorestframework -git+https://github.com/ARTIST-Association/ARTIST.git -torch -django-cleanup -django-allauth -requests -PyJWT -python-dotenv -cryptography -Pillow -coverage -mypy -pre-commit -ruff -parameterized -unittest-xml-reporting From b9d411e9f63dd7c7fd556d6c5a323f80feb6ee78 Mon Sep 17 00:00:00 2001 From: Paul Harter Date: Thu, 27 Nov 2025 10:40:28 +0100 Subject: [PATCH 2/4] updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 934a0a58..1dbaa9f0 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ See [CONTRIBUTING.md](/CONTRIBUTING.md) on how to set up a development environme git clone https://github.com/ARTIST-Association/CANVAS.git # install requirements -cd CANVAS-PSE2425/canvas_editor/ +cd CANVAS/canvas_editor/ pip install . # add the .env file to the root of the canvas_editor folder From b207d4177c57367e77226f6983d5b227d6235769 Mon Sep 17 00:00:00 2001 From: Paul Harter Date: Thu, 27 Nov 2025 10:44:41 +0100 Subject: [PATCH 3/4] removed none existing usersettings app --- canvas_editor/pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/canvas_editor/pyproject.toml b/canvas_editor/pyproject.toml index ca421720..5b00c963 100644 --- a/canvas_editor/pyproject.toml +++ b/canvas_editor/pyproject.toml @@ -38,7 +38,6 @@ include = [ "hdf_management", "job_interface", "project_management", - "user_settings", "static", "templates", ] From f63d440f4558850d47481de24d7195e80a132ae4 Mon Sep 17 00:00:00 2001 From: Paul Harter Date: Thu, 27 Nov 2025 11:03:53 +0100 Subject: [PATCH 4/4] removed static and templates from packages --- canvas_editor/pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/canvas_editor/pyproject.toml b/canvas_editor/pyproject.toml index 5b00c963..acdc8008 100644 --- a/canvas_editor/pyproject.toml +++ b/canvas_editor/pyproject.toml @@ -38,8 +38,6 @@ include = [ "hdf_management", "job_interface", "project_management", - "static", - "templates", ] [tool.ruff]