Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VSCode settings #3374

Merged
merged 3 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
.tox/
db.sqlite3
*.egg-info
.ruff_cache/

website/media/
website/filepond-temp-uploads/
Expand Down
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.black-formatter",
"ms-python.isort",
"charliermarsh.ruff"
]
}
30 changes: 30 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Django: manage.py runserver",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/website/manage.py",
"args": [
"runserver",
],
"justMyCode": true,
"django": true,
},
DeD1rk marked this conversation as resolved.
Show resolved Hide resolved
{
"name": "Django: manage.py test",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/website/manage.py",
"args": [
"test",
"--noinput",
"--buffer",
],
"cwd": "${workspaceFolder}/website",
"justMyCode": true,
"django": true,
}
]
}
48 changes: 48 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// This file contains some good default settings for using VSCode with concrexit.
// If you install the recommended extensions (from .vscode/extensions.json), these
// settings will enable among other things:
// - Python linting with the correct settings.
// - Python formatting with black whenever you save a file.
// - Python imports sorting with isort whenever you save a file.
//
// As this file is checked in, git will track any changes you make to it, that you
// probably wouldn't want to actually commit. If you would like to customize VSCode
// for yourself, you can probably just do so in you *User* settings. But if you want to
// edit your own workspace settings (this file) without git tracking it, you can use:
//
// $ git update-index --skip-worktree .vscode/settings.json
//
// This will tell git to ignore any changes you make to this file. If remote changes are
// pulled, you may get a merge conflict. If you want to undo this, you can do:
//
// $ git update-index --no-skip-worktree .vscode/settings.json
//
// The same goes for the launch.json file.
{
"ruff.organizeImports": false,
"python.analysis.autoImportCompletions": true,
"python.analysis.addImport.exactMatchOnly": true,
"python.analysis.extraPaths": [
"website"
],
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"editor.formatOnType": true,
},
"git.branchProtection": [
"master"
],
"black-formatter.importStrategy": "fromEnvironment",
"isort.args": [
"--profile",
"black"
],
"ruff.args": [
"--extend-ignore",
".pyenv"
],
}
11 changes: 0 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,3 @@ Apart from that, we don't have any strict rules about test coverage, but we do e
Most of our tests are unit tests. We also have some integration tests, but not enough (we definitely need more of those).

You can run all the tests with `make test`, afterwards you can check the coverage with `make coverage`.


## For admins
It's possible for admins to push to the `master` branch, but this must only be
done with care. As such, a pre-push git hook is available which asks for confirmation
whenever a push to `master` is done. All admins should have this hook installed!

To install the git hook:
```bash
mv scripts/pre-push-hook ./git/hooks/pre-push
```
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ The latest Thalia Website built on Django.

## Getting started

0. Get at least Python 3.9 and install [poetry](https://python-poetry.org/docs/#installation), the Pillow requirements and Thabloid dependencies as per below.
0. Get at least Python 3.9 and install [poetry](https://python-poetry.org/docs/#installation) and the [Pillow dependencies](#pillow-dependencies) as per below.
1. Clone this repository
2. `make member` to create the first member while in the cloned folder. This will also install all dependencies (in a separate virtual environment)
3. `make fixtures` to generate a bunch of test data
4. `make run` to run a testing server. Now you are able to visit your local concrexit at http://127.0.0.1:8000
5. Open the code in your favorite Python IDE (VSCode or Pycharm both work great)
5. Open the code in your favorite Python IDE (we have some helpful default settings provided for VSCode).

Optional, but recommended: follow the tutorial! It can be found by going to the Wiki (top of the GitHub page) and then clicking on "Your first contribution" or by clicking [here](https://github.com/svthalia/concrexit/wiki/your-first-contribution).

The Thabloid dependencies are less important. If you don't intall them, the only thing that doesn't work is creating Thabloid cover images.

### Useful git commands

Expand All @@ -35,18 +34,15 @@ The Thabloid dependencies are less important. If you don't intall them, the only

### Pillow dependencies


Pillow dependencies are used for the thumbnail generation. The website will give lots of errors and work weirdly if you don't install these native dependencies.

For Ubuntu, use:

```bash
apt-get install python3-dev gettext gcc build-essential libtiff5-dev libjpeg-turbo8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev
apt-get install python3-dev build-essential libjpeg-dev zlib1g-dev libwebp-dev
```

For other operating systems, see the [Pillow Documentation][pillow-install].

[pillow-install]: https://pillow.readthedocs.io/en/latest/installation.html
For other operating systems, see the [Pillow Documentation](https://pillow.readthedocs.io/en/latest/installation.html).

On macOS you will also need to install `libmagic`, using the brew package manager by running `brew install libmagic`.

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ known_first_party = [
]

[tool.ruff]
exclude = ["migrations", "docs/conf.py"]
exclude = ["migrations", "docs/conf.py", ".venv", ".vscode", ".pyenv"]

select = [
"F",
Expand Down
40 changes: 0 additions & 40 deletions scripts/pre-push-hook

This file was deleted.

22 changes: 0 additions & 22 deletions scripts/test-vm.sh

This file was deleted.