From fc652a7f4640714800caeb561a7ceb900e48f2a2 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Sun, 6 Jun 2021 19:55:55 +0200 Subject: Move configuration section to site contributing guide. --- .../guides/pydis-guides/contributing/site.md | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md index ada47931..8c21b5b0 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md @@ -143,3 +143,35 @@ Unless you are editing the Dockerfile or docker-compose.yml, you shouldn't need Django provides an interface for administration with which you can view and edit the models among other things. It can be found at [http://admin.pythondiscord.local:8000](http://admin.pythondiscord.local:8000). The default credentials are `admin` for the username and `admin` for the password. + +--- + +# Configuration in detail + +The website is configured through the following environment variables: + +## Essential +- **`DATABASE_URL`**: A string specifying the PostgreSQL database to connect to, + in the form `postgresql://user:password@host/database`, such as + `postgresql://joethedestroyer:ihavemnesia33@localhost/pysite_dev` + +- **`METRICITY_DB_URL`**: A string specifying the PostgreSQL metric database to + connect to, in the same form as `$DATABASE_URL`. + +- **`DEBUG`**: Controls Django's internal debugging setup. Enable this when + you're developing locally. Optional, defaults to `False`. + +- **`LOG_LEVEL`**: Any valid Python `logging` module log level - one of `DEBUG`, + `INFO`, `WARN`, `ERROR` or `CRITICAL`. When using debug mode, this defaults to + `INFO`. When testing, defaults to `ERROR`. Otherwise, defaults to `WARN`. + +## Deployment +- **`ALLOWED_HOSTS`**: A comma-separated lists of alternative hosts to allow to + host the website on, when `DEBUG` is not set. Optional, defaults to the + `pythondiscord.com` family of domains. + +- **`SECRET_KEY`**: The secret key used in various parts of Django. Keep this + secret as the name suggests! This is managed for you in debug setups. + +- **`STATIC_ROOT`**: The root in which `python manage.py collectstatic` collects + static files. Optional, defaults to `/var/www/pythondiscord.com`. -- cgit v1.2.3 From 172f83967077cfaa552c066452eaacc3576a5527 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Sun, 6 Jun 2021 19:56:19 +0200 Subject: Kill `docs/` directory. --- docs/README.md | 17 ---------- docs/configuration.md | 25 -------------- docs/setup.md | 91 --------------------------------------------------- 3 files changed, 133 deletions(-) delete mode 100644 docs/README.md delete mode 100644 docs/configuration.md delete mode 100644 docs/setup.md diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index 5af383b4..00000000 --- a/docs/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Documentation - -This directory contains useful documentation for working with and using our site. - -## Table of contents - -* [Setup guide](setup.md) - - * [PostgreSQL setup](setup.md#postgresql-setup) - - * [Development with Docker](setup.md#development-with-docker) - - * [Development with `pip`](setup.md#development-with-pip) - -> Note: If you're looking to add redirects to the site, the `redirects` app is **NOT** the way to go. -> Convenience redirects should use our [Cloudflare Worker](https://github.com/python-discord/workers/tree/main/short-urls). -> Ask in the server if you have any questions! diff --git a/docs/configuration.md b/docs/configuration.md deleted file mode 100644 index 037f029f..00000000 --- a/docs/configuration.md +++ /dev/null @@ -1,25 +0,0 @@ -# Configuration -The website is configured through the following environment variables: - -## Essential -- **`DATABASE_URL`**: A string specifying the PostgreSQL database to connect to, - in the form `postgresql://user:password@host/database`, such as - `postgresql://joethedestroyer:ihavemnesia33@localhost/pysite_dev` - -- **`DEBUG`**: Controls Django's internal debugging setup. Enable this when - you're developing locally. Optional, defaults to `False`. - -- **`LOG_LEVEL`**: Any valid Python `logging` module log level - one of `DEBUG`, - `INFO`, `WARN`, `ERROR` or `CRITICAL`. When using debug mode, this defaults to - `INFO`. When testing, defaults to `ERROR`. Otherwise, defaults to `WARN`. - -## Deployment -- **`ALLOWED_HOSTS`**: A comma-separated lists of alternative hosts to allow to - host the website on, when `DEBUG` is not set. Optional, defaults to the - `pythondiscord.com` family of domains. - -- **`SECRET_KEY`**: The secret key used in various parts of Django. Keep this - secret as the name suggests! This is managed for you in debug setups. - -- **`STATIC_ROOT`**: The root in which `python manage.py collectstatic` collects - static files. Optional, defaults to `/var/www/pythondiscord.com`. diff --git a/docs/setup.md b/docs/setup.md deleted file mode 100644 index d88021cc..00000000 --- a/docs/setup.md +++ /dev/null @@ -1,91 +0,0 @@ -# Setup - -Setting up the Python site for local development -is quick and easy using `pip`. -Alternatively, you can set it up using Docker. -Both of these methods are documented here. - -## PostgreSQL setup - -Install PostgreSQL according to its documentation. -Then, create databases and users: - -```sql -$ psql -qd postgres -postgres=# CREATE USER pysite WITH CREATEDB; -postgres=# CREATE DATABASE pysite OWNER pysite; -``` - -Using different databases for development -and tests is recommended because Django -will expect an empty database when running tests. -Now that PostgreSQL is set up, simply set the proper database URL -in your environment variables: - -```sh -export DATABASE_URL=postgres://pysite@localhost/pysite -``` - -After this step, inside the `.env` file, set the `SECRET_KEY` variable which can be anything you like. - -A simpler approach to automatically configuring this might come in the -near future - if you have any suggestions, please let us know! - -## Development with Docker - -To quickly set up the site locally, you can use Docker. -You will need Docker itself and `docker-compose` - -you can omit the latter if you want to use PostgreSQL on -your host. Refer to the docker documentation on how to install Docker. - -If you want to set the site up using `docker-compose`, simply run - -```sh -docker-compose up -``` - -and it will do its magic. - -Otherwise, you need to set a bunch of environment variables (or pass them along to -the container). You will also need to have a running PostgreSQL instance if you want -to run on your host's PostgreSQL instance. - -## Development with `pip` - -This is the recommended way if you wish to quickly test your changes and don't want -the overhead that Docker brings. - -Follow the PostgreSQL setup instructions above. Then, create a virtual environment -for the project. If you're new to this, you may want to check out [Installing packages -using pip and virtualenv](https://packaging.python.org/guides/installing-using-pip-and-virtualenv/) -from the Python Packaging User Guide. - -Enter the virtual environment. Now you can run - -```sh -pip install -e .[lint,test] -``` - -to install base dependencies along with lint and test dependencies. - -To run tests, use `python manage.py test`. - -## Hosts file - -Make sure you add the following to your hosts file: - -```sh -127.0.0.1 pythondiscord.local -127.0.0.1 api.pythondiscord.local -127.0.0.1 staff.pythondiscord.local -127.0.0.1 admin.pythondiscord.local -``` -When trying to access the site, you'll be using the domains above instead of the usual `localhost:8000`. - -Finally, you will need to set the environment variable `DEBUG=1`. If you have `python-dotenv` installed, you can put this into a - `.env` file to have it exported automatically. It's also recommended to -export `LOG_LEVEL=INFO` when using `DEBUG=1` if you don't want super verbose logs. - -To run the server, run `python manage.py runserver`. If it gives you an error saying -`django.core.exceptions.ImproperlyConfigured: Set the DATABASE_URL environment variable` please make sure the server that your postgres database is located at is running -and run the command `$(export cat .env)`. Happy hacking! -- cgit v1.2.3 From ef59812d3399dfec16a43565f2b02dfe5c1b81f6 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Mon, 7 Jun 2021 21:21:21 +0200 Subject: Address review comments. - Link detail section in environment variables section. - Update old static path from pre-Docker environment times and mention the Docker setup. diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md index 8c21b5b0..24227f24 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md @@ -79,6 +79,9 @@ SECRET_KEY=suitable-for-development-only STATIC_ROOT=staticfiles ``` +The [Configuration in Detail](#configuration-in-detail) section contains +detailed information about these settings. + #### Notes regarding `DATABASE_URL` - If the database is hosted locally i.e. on the same machine as the webserver, then use `localhost` for the host. Windows and macOS users may need to use the [Docker host IP](../hosts-file/#windows) instead. @@ -173,5 +176,6 @@ The website is configured through the following environment variables: - **`SECRET_KEY`**: The secret key used in various parts of Django. Keep this secret as the name suggests! This is managed for you in debug setups. -- **`STATIC_ROOT`**: The root in which `python manage.py collectstatic` collects - static files. Optional, defaults to `/var/www/pythondiscord.com`. +- **`STATIC_ROOT`**: The root in which `python manage.py collectstatic` + collects static files. Optional, defaults to `/app/staticfiles` for the + standard Docker deployment. --- .../content/resources/guides/pydis-guides/contributing/site.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md index 8c21b5b0..24227f24 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md @@ -79,6 +79,9 @@ SECRET_KEY=suitable-for-development-only STATIC_ROOT=staticfiles ``` +The [Configuration in Detail](#configuration-in-detail) section contains +detailed information about these settings. + #### Notes regarding `DATABASE_URL` - If the database is hosted locally i.e. on the same machine as the webserver, then use `localhost` for the host. Windows and macOS users may need to use the [Docker host IP](../hosts-file/#windows) instead. @@ -173,5 +176,6 @@ The website is configured through the following environment variables: - **`SECRET_KEY`**: The secret key used in various parts of Django. Keep this secret as the name suggests! This is managed for you in debug setups. -- **`STATIC_ROOT`**: The root in which `python manage.py collectstatic` collects - static files. Optional, defaults to `/var/www/pythondiscord.com`. +- **`STATIC_ROOT`**: The root in which `python manage.py collectstatic` + collects static files. Optional, defaults to `/app/staticfiles` for the + standard Docker deployment. -- cgit v1.2.3 From 1fd6c9bdb0164c9953a4d55277d829009332aa4a Mon Sep 17 00:00:00 2001 From: Kronifer <44979306+Kronifer@users.noreply.github.com> Date: Thu, 10 Jun 2021 08:36:56 -0500 Subject: Added Cloudflare to Sponsors list (#527) --- pydis_site/static/images/sponsors/cloudflare.png | Bin 0 -> 13822 bytes pydis_site/templates/home/index.html | 2 ++ 2 files changed, 2 insertions(+) create mode 100644 pydis_site/static/images/sponsors/cloudflare.png diff --git a/pydis_site/static/images/sponsors/cloudflare.png b/pydis_site/static/images/sponsors/cloudflare.png new file mode 100644 index 00000000..e2cd3b44 Binary files /dev/null and b/pydis_site/static/images/sponsors/cloudflare.png differ diff --git a/pydis_site/templates/home/index.html b/pydis_site/templates/home/index.html index 18f6b77b..08f98607 100644 --- a/pydis_site/templates/home/index.html +++ b/pydis_site/templates/home/index.html @@ -200,6 +200,8 @@ StreamYard + + Cloudflare -- cgit v1.2.3 From b8132bd77c32ec07134605a0f047a614ec8ce379 Mon Sep 17 00:00:00 2001 From: Janine vN Date: Mon, 14 Jun 2021 22:36:18 -0400 Subject: Code Jam 8 - Initial PR for Announcement (#528) --- .../static/images/events/cj8_asciimatics.png | Bin 0 -> 26219 bytes pydis_site/static/images/events/cj8_blessed.gif | Bin 0 -> 41307 bytes pydis_site/static/images/events/cj8_curses.png | Bin 0 -> 6483 bytes pydis_site/static/images/events/cj8_rich.gif | Bin 0 -> 906975 bytes pydis_site/static/images/events/cj8_urwid.png | Bin 0 -> 318 bytes .../static/images/events/summer_code_jam_2021.png | Bin 0 -> 738161 bytes pydis_site/templates/events/index.html | 3 + .../templates/events/pages/code-jams/8/_index.html | 41 +++++++++ .../events/pages/code-jams/8/frameworks.html | 92 +++++++++++++++++++++ .../templates/events/pages/code-jams/8/rules.html | 70 ++++++++++++++++ .../templates/events/sidebar/code-jams/8.html | 17 ++++ .../sidebar/code-jams/previous-code-jams.html | 1 + .../sidebar/code-jams/upcoming-code-jam.html | 6 +- .../templates/events/sidebar/upcoming-event.html | 4 +- 14 files changed, 229 insertions(+), 5 deletions(-) create mode 100644 pydis_site/static/images/events/cj8_asciimatics.png create mode 100644 pydis_site/static/images/events/cj8_blessed.gif create mode 100644 pydis_site/static/images/events/cj8_curses.png create mode 100644 pydis_site/static/images/events/cj8_rich.gif create mode 100644 pydis_site/static/images/events/cj8_urwid.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021.png create mode 100644 pydis_site/templates/events/pages/code-jams/8/_index.html create mode 100644 pydis_site/templates/events/pages/code-jams/8/frameworks.html create mode 100644 pydis_site/templates/events/pages/code-jams/8/rules.html create mode 100644 pydis_site/templates/events/sidebar/code-jams/8.html diff --git a/pydis_site/static/images/events/cj8_asciimatics.png b/pydis_site/static/images/events/cj8_asciimatics.png new file mode 100644 index 00000000..ac52338e Binary files /dev/null and b/pydis_site/static/images/events/cj8_asciimatics.png differ diff --git a/pydis_site/static/images/events/cj8_blessed.gif b/pydis_site/static/images/events/cj8_blessed.gif new file mode 100644 index 00000000..8bdbf5b1 Binary files /dev/null and b/pydis_site/static/images/events/cj8_blessed.gif differ diff --git a/pydis_site/static/images/events/cj8_curses.png b/pydis_site/static/images/events/cj8_curses.png new file mode 100644 index 00000000..c1a177ff Binary files /dev/null and b/pydis_site/static/images/events/cj8_curses.png differ diff --git a/pydis_site/static/images/events/cj8_rich.gif b/pydis_site/static/images/events/cj8_rich.gif new file mode 100644 index 00000000..3a0ffbf3 Binary files /dev/null and b/pydis_site/static/images/events/cj8_rich.gif differ diff --git a/pydis_site/static/images/events/cj8_urwid.png b/pydis_site/static/images/events/cj8_urwid.png new file mode 100644 index 00000000..98a264b7 Binary files /dev/null and b/pydis_site/static/images/events/cj8_urwid.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021.png b/pydis_site/static/images/events/summer_code_jam_2021.png new file mode 100644 index 00000000..778c7c90 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021.png differ diff --git a/pydis_site/templates/events/index.html b/pydis_site/templates/events/index.html index 024e7fdc..64bf2c25 100644 --- a/pydis_site/templates/events/index.html +++ b/pydis_site/templates/events/index.html @@ -9,6 +9,9 @@ {% block event_content %}

Code Jams

+
+ The 2021 Summer Code Jam qualifier will open June 21st. Check out the details here. +

Each year, we organize a Winter Code Jam and a Summer Code Jam. During these events, members of our community will work together in teams to create something amazing using a technology we picked for them. One such technology that was picked for the Winter Code Jam 2020 was Kivy, a cross-platform GUI framework.

To help fuel the creative process, we provide a specific theme, like Ancient Technology or This App Hates You. At the end of the Code Jam, the projects are judged by Python Discord server staff members and guest judges from the larger Python community. The judges will consider creativity, code quality, teamwork, and adherence to the theme.

If you want to read more about Code Jams, visit our Code Jam info page or watch this video showcasing the best projects created during the Winter Code Jam 2020: Ancient Technology:

diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html new file mode 100644 index 00000000..08eaae07 --- /dev/null +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -0,0 +1,41 @@ +{% extends "events/base_sidebar.html" %} + +{% block title %}Summer Code Jam 2021{% endblock %} + +{% block breadcrumb %} +
  • Events
  • +
  • Code Jams
  • +
  • Summer Code Jam 2021
  • +{% endblock %} + +{% block event_content %} +

    Twice a year we host a code jam for members of our server to participate in. The code jam is an event where we place you + in a team with 5 other random server members. You then have 7 days to code some sort of application or program in Python. + Your program must use the specified technology/framework and incorporate the theme chosen by the server. +

    +

    + After the 7 days is complete, your team has 2 days to finish documentation and create a video presentation showcasing + and walking through the program that your team has created. More details and specifics of this will be released within the next 2 weeks. +

    + +

    Important Dates

    +
      +
    • Monday, June 15 - Form to submit theme suggestions opens
    • +
    • Monday, June 21 - The Qualifier is released
    • +
    • Friday, June 25 - Voting for the theme opens
    • +
    • Sunday, June 27 - Github Bootcamp
    • +
    • Wednesday, June 30 - The Qualifier closes
    • +
    • Friday, July 9 - Code Jam Begins
    • +
    • Friday, July 16 - Coding portion of the jam ends
    • +
    • Sunday, July 18 - Code Jam submissions are closed
    • +
    +

    How to Join

    +

    The Qualifier isn't released yet, but to receive the most up-to-date information and to get notified + when the Qualifier is released you can join the server: discord.gg/python.

    +{% endblock %} + +{% block sidebar %} + + {% include "events/sidebar/code-jams/8.html" %} + +{% endblock %} diff --git a/pydis_site/templates/events/pages/code-jams/8/frameworks.html b/pydis_site/templates/events/pages/code-jams/8/frameworks.html new file mode 100644 index 00000000..64ff7a0c --- /dev/null +++ b/pydis_site/templates/events/pages/code-jams/8/frameworks.html @@ -0,0 +1,92 @@ +{% extends "events/base_sidebar.html" %} + +{% load static %} + +{% block title %}Summer Code Jam 2021{% endblock %} + +{% block breadcrumb %} +
  • Events
  • +
  • Code Jams
  • +
  • Summer Code Jam 2021
  • +
  • Allowed Frameworks
  • +{% endblock %} + +{% block event_content %} +

    Below is the list of approved frameworks that you can use for the code jam. Please take note of what frameworks are available for which platform. + Please work with your team to choose a library that everyone can develop on, whether it's cross platform or something you can use WSL or a Virtual Machine for. +

    +

    Urwid

    +
    +
    +
      +
    • Supports: Linux, Mac, other unix-like OS
    • +
    • Somewhat in-depth tutorial
    • +
    • Uses widgets in a fairly straight forward design
    • +
    • Docs include tutorials of both functional and class-based examples
    • +
    +
    +
    + urwid +
    +
    +

    Curses

    +
    +
    +
      +
    • Supports: Linux and other unix-like OS
    • +
    • Part of the standard library
    • +
    • Extensive how-to guide
    • +
    • Very basic, more effort to get working/looking good
    • +
    +
    +
    + curses +
    +
    +

    Blessed

    +
    +
    +
      +
    • Supports: Linux, Mac, and Windows
    • +
    • Sits on top of curses to add more pythonic bindings
    • +
    • Doesn't provide any widgets or layouts
    • +
    +
    +
    + blessed +
    +
    +

    Rich

    +
    +
    +
      +
    • Supports: Linux, Mac, and Windows
    • +
    • Documentation is good and overall is very OOP focused
    • +
    • Robust with many features and example snippets
    • +
    +
    +
    + rich +
    +
    +

    Asciimatics

    +
    +
    +
      +
    • Supports: Linux, Mac, and Windows
    • +
    • Documentation is well structured and straightforward to navigate
    • +
    +
    +
    + asciimatics +
    +
    + + +{% endblock %} + +{% block sidebar %} + + {% include "events/sidebar/code-jams/8.html" %} + +{% endblock %} diff --git a/pydis_site/templates/events/pages/code-jams/8/rules.html b/pydis_site/templates/events/pages/code-jams/8/rules.html new file mode 100644 index 00000000..632ca877 --- /dev/null +++ b/pydis_site/templates/events/pages/code-jams/8/rules.html @@ -0,0 +1,70 @@ +{% extends "events/base_sidebar.html" %} + +{% block title %}Summer Code Jam 2021{% endblock %} + +{% block breadcrumb %} +
  • Events
  • +
  • Code Jams
  • +
  • Summer Code Jam 2021
  • +
  • Rules
  • +{% endblock %} + +{% block event_content %} +
      +
    1. Your solution must use one of the approved frameworks. It is not permitted to circumvent this rule by e.g. using the approved framework as a wrapper for another framework.

    2. +
    3. Your solution should be platform agnostic. For example, if you use filepaths in your submission, use pathlib to create platform agnostic Path objects instead of hardcoding the paths.

    4. +
    5. +

      + You must document precisely how to install and run your project. + This should be as easy as possible, which means you should consider using dependency managers like pipenv or poetry. + We would also encourage you to use docker and docker-compose to containerize your project, but this isn't a requirement. +

      +
    6. +
    7. + You must get contributions from every member of your team, if you have an issue with someone on your team please contact a member of the administration team. + These contributions do not necessarily have to be code, for example it's absolutely fine for someone to contribute management, documentation, graphics or audio. + + Team members that do not contribute will be removed from the Code Jam, and will not receive their share of any prizes the team may win. + They may also be barred from entering future events. + +
    8. +
    9. You must use GitHub as source control.

    10. +
    11. +

      + All code and assets must be compatible with the MIT license. + This is because we will be merging your submission into our summer-code-jam-2021 repo at the end of the jam, + and this repo is licensed with the MIT license. + Projects that include assets that are incompatible with this license may be disqualified. +

      +
    12. +
    13. All code must be written and committed within the time constrictions of the jam. Late commits may be reverted, so make sure you leave enough time to bug test your program.

    14. +
    15. +

      + Use English as the main language for your project, including names, comments, documentation, and commit messages. + The text displayed in your web application should also be in English, + although you are allowed to provide the user with options for internationalisation and translation. +

      +
    16. +
    17. +

      + Your team, once the coding portion of the code jam is complete, must create a video presentation that showcases and explains your final product. + This must be in a video format and must be uploaded somewhere for the judges to view (i.e. unlisted Youtube video, Vimeo, etc.) + The video can be as simple as a screen recording with annotated text. + Teams who do not submit a final video presentation may be disqualified. +

      +
    18. +
    + + +
    + Please note that our regular + community rules and code of conduct + also apply during the event and that we reserve the right to make changes to these rules at any time. +
    +{% endblock %} + +{% block sidebar %} + + {% include "events/sidebar/code-jams/8.html" %} + +{% endblock %} diff --git a/pydis_site/templates/events/sidebar/code-jams/8.html b/pydis_site/templates/events/sidebar/code-jams/8.html new file mode 100644 index 00000000..fb14d83e --- /dev/null +++ b/pydis_site/templates/events/sidebar/code-jams/8.html @@ -0,0 +1,17 @@ +{% load static %} +
    +

    Important Links

    + Rules + Approved Frameworks + +
    +
    + Summer Code Jam 2021 + + + Django + + + JetBrains + +
    diff --git a/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html b/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html index 154f6ac4..9f9ecd1a 100644 --- a/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html +++ b/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html @@ -1,6 +1,7 @@
    diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html index 08eaae07..799beca1 100644 --- a/pydis_site/templates/events/pages/code-jams/8/_index.html +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -20,18 +20,26 @@

    Important Dates

      -
    • Monday, June 15 - Form to submit theme suggestions opens
    • +
    • Tuesday, June 15 - Form to submit theme suggestions opens
    • Monday, June 21 - The Qualifier is released
    • Friday, June 25 - Voting for the theme opens
    • -
    • Sunday, June 27 - Github Bootcamp
    • +
    • Sunday, June 27 - GitHub Bootcamp
    • Wednesday, June 30 - The Qualifier closes
    • -
    • Friday, July 9 - Code Jam Begins
    • +
    • Friday, July 9 - Code Jam begins
    • Friday, July 16 - Coding portion of the jam ends
    • Sunday, July 18 - Code Jam submissions are closed
    + +

    Technology

    +

    + The chosen technology/tech stack for this year is Text User Interfaces (TUIs). + Each team must create a program with one of the approved frameworks that creates a user interface that is text based. + For more information of TUIs and what's involved with such an interface, check out this wikipedia article. +

    +

    How to Join

    The Qualifier isn't released yet, but to receive the most up-to-date information and to get notified - when the Qualifier is released you can join the server: discord.gg/python.

    + when the Qualifier is released you can join us on Discord at discord.gg/python.

    {% endblock %} {% block sidebar %} diff --git a/pydis_site/templates/events/pages/code-jams/8/frameworks.html b/pydis_site/templates/events/pages/code-jams/8/frameworks.html index 64ff7a0c..cc1aa671 100644 --- a/pydis_site/templates/events/pages/code-jams/8/frameworks.html +++ b/pydis_site/templates/events/pages/code-jams/8/frameworks.html @@ -8,7 +8,7 @@
  • Events
  • Code Jams
  • Summer Code Jam 2021
  • -
  • Allowed Frameworks
  • +
  • Approved Frameworks
  • {% endblock %} {% block event_content %} @@ -19,6 +19,7 @@
      +
    • Documentation Link
    • Supports: Linux, Mac, other unix-like OS
    • Somewhat in-depth tutorial
    • Uses widgets in a fairly straight forward design
    • @@ -33,6 +34,7 @@
        +
      • Documentation Link
      • Supports: Linux and other unix-like OS
      • Part of the standard library
      • Extensive how-to guide
      • @@ -47,6 +49,7 @@
          +
        • Documentation Link
        • Supports: Linux, Mac, and Windows
        • Sits on top of curses to add more pythonic bindings
        • Doesn't provide any widgets or layouts
        • @@ -60,6 +63,7 @@
          @@ -86,6 +92,19 @@ asciimatics
          +

          Python Prompt Toolkit

          +
          +
          + +
          +
          + python prompt toolkit +
          +
          {% endblock %} -- cgit v1.2.3 From 297337fa6552ec32d95e82dc41c018ef1a5e3cf3 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Wed, 16 Jun 2021 06:22:40 +0100 Subject: Add cache purge step to CI deploy stage (#533) --- .github/workflows/deploy.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index efc08040..4208f727 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -44,3 +44,9 @@ jobs: site/deployment.yaml images: 'ghcr.io/python-discord/site:${{ steps.sha_tag.outputs.tag }}' kubectl-version: 'latest' + + - name: Purge Cloudflare Edge Cache + uses: jakejarvis/cloudflare-purge-action@master + env: + CLOUDFLARE_ZONE: 989c984a358bfcd1e9b9d188cc86c1df + CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }} -- cgit v1.2.3 From a8a0322c871ef04920167ded706cfdc8a425d958 Mon Sep 17 00:00:00 2001 From: bast Date: Fri, 18 Jun 2021 13:46:06 -0700 Subject: Adjust Message model to support new nitro messages with over 4000 chars --- .../apps/api/migrations/0070_auto_20210618_2010.py | 18 ++++++++++ pydis_site/apps/api/models/bot/message.py | 2 +- pydis_site/apps/api/tests/test_models.py | 40 +++++++++++++++++++++- 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 pydis_site/apps/api/migrations/0070_auto_20210618_2010.py diff --git a/pydis_site/apps/api/migrations/0070_auto_20210618_2010.py b/pydis_site/apps/api/migrations/0070_auto_20210618_2010.py new file mode 100644 index 00000000..b0c79b32 --- /dev/null +++ b/pydis_site/apps/api/migrations/0070_auto_20210618_2010.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.14 on 2021-06-18 20:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0069_documentationlink_validators'), + ] + + operations = [ + migrations.AlterField( + model_name='deletedmessage', + name='content', + field=models.CharField(blank=True, help_text='The content of this message, taken from Discord.', max_length=4000), + ), + ] diff --git a/pydis_site/apps/api/models/bot/message.py b/pydis_site/apps/api/models/bot/message.py index ff06de21..60e2a553 100644 --- a/pydis_site/apps/api/models/bot/message.py +++ b/pydis_site/apps/api/models/bot/message.py @@ -43,7 +43,7 @@ class Message(ModelReprMixin, models.Model): verbose_name="Channel ID" ) content = models.CharField( - max_length=2_000, + max_length=4_000, help_text="The content of this message, taken from Discord.", blank=True ) diff --git a/pydis_site/apps/api/tests/test_models.py b/pydis_site/apps/api/tests/test_models.py index 66052e01..1303639e 100644 --- a/pydis_site/apps/api/tests/test_models.py +++ b/pydis_site/apps/api/tests/test_models.py @@ -1,6 +1,7 @@ from datetime import datetime as dt -from django.test import SimpleTestCase +from django.core.exceptions import ValidationError +from django.test import SimpleTestCase, TestCase from django.utils import timezone from pydis_site.apps.api.models import ( @@ -34,6 +35,43 @@ class ReprMixinTests(SimpleTestCase): self.assertEqual(repr(self.klass), expected) +class NitroMessageLengthTest(TestCase): + def setUp(self): + self.user = User.objects.create(id=50, name='bill', discriminator=5) + self.context = MessageDeletionContext.objects.create( + id=50, + actor=self.user, + creation=dt.utcnow() + ) + + def test_create(self): + message = DeletedMessage( + id=46, + author=self.user, + channel_id=666, + content="w"*4000, + deletion_context=self.context, + embeds=[] + ) + + try: + message.clean_fields() + except Exception as e: + self.fail(f"Creation of message of length 3950 failed with: {e}") + + def test_create_failure(self): + message = DeletedMessage( + id=47, + author=self.user, + channel_id=666, + content="w"*4001, + deletion_context=self.context, + embeds=[] + ) + + self.assertRaisesRegex(ValidationError, "content':", message.clean_fields) + + class StringDunderMethodTests(SimpleTestCase): def setUp(self): self.nomination = Nomination( -- cgit v1.2.3 From c40ed8c159f5101d1bc677a66406cef7c99843aa Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 18 Jun 2021 22:16:53 +0100 Subject: Use BigInt for permissions field and remove max value validator BigInt is needed as Discord's permissions number now exceeds that which can be stored in a normal int. I have removed the max value validator, as this just adds maintanence burden for us each time Discord adds new permissions. --- .../apps/api/migrations/0070_auto_20210618_2114.py | 19 +++++++++++++++++++ pydis_site/apps/api/models/bot/role.py | 8 ++------ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 pydis_site/apps/api/migrations/0070_auto_20210618_2114.py diff --git a/pydis_site/apps/api/migrations/0070_auto_20210618_2114.py b/pydis_site/apps/api/migrations/0070_auto_20210618_2114.py new file mode 100644 index 00000000..1d25e421 --- /dev/null +++ b/pydis_site/apps/api/migrations/0070_auto_20210618_2114.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0.14 on 2021-06-18 21:14 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0069_documentationlink_validators'), + ] + + operations = [ + migrations.AlterField( + model_name='role', + name='permissions', + field=models.BigIntegerField(help_text='The integer value of the permission bitset of this role from Discord.', validators=[django.core.validators.MinValueValidator(limit_value=0, message='Role permissions cannot be negative.')]), + ), + ] diff --git a/pydis_site/apps/api/models/bot/role.py b/pydis_site/apps/api/models/bot/role.py index cfadfec4..733a8e08 100644 --- a/pydis_site/apps/api/models/bot/role.py +++ b/pydis_site/apps/api/models/bot/role.py @@ -1,6 +1,6 @@ from __future__ import annotations -from django.core.validators import MaxValueValidator, MinValueValidator +from django.core.validators import MinValueValidator from django.db import models from pydis_site.apps.api.models.mixins import ModelReprMixin @@ -38,16 +38,12 @@ class Role(ModelReprMixin, models.Model): ), help_text="The integer value of the colour of this role from Discord." ) - permissions = models.IntegerField( + permissions = models.BigIntegerField( validators=( MinValueValidator( limit_value=0, message="Role permissions cannot be negative." ), - MaxValueValidator( - limit_value=2 << 32, - message="Role permission bitset exceeds value of having all permissions" - ) ), help_text="The integer value of the permission bitset of this role from Discord." ) -- cgit v1.2.3 From e4acdf24ecfd8c2ce52ea56b73813e4bde4d8bec Mon Sep 17 00:00:00 2001 From: Janine vN Date: Sun, 20 Jun 2021 11:38:19 -0400 Subject: Adding GitHub Bootcamp Information This commit adds some basic information about the github bootcamp. More information should and will be added later, but this adds some of the basics and adds it to the sidebar. --- .../events/pages/code-jams/8/github-bootcamp.html | 40 ++++++++++++++++++++++ .../templates/events/sidebar/code-jams/8.html | 1 + 2 files changed, 41 insertions(+) create mode 100644 pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html diff --git a/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html b/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html new file mode 100644 index 00000000..a60afa33 --- /dev/null +++ b/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html @@ -0,0 +1,40 @@ +{% extends "events/base_sidebar.html" %} + +{% load static %} + +{% block title %}Summer Code Jam 2021{% endblock %} + +{% block breadcrumb %} +
        • Events
        • +
        • Code Jams
        • +
        • Summer Code Jam 2021
        • +
        • GitHub Bootcamp
        • +{% endblock %} + +{% block event_content %} +

          + This year we'll be running a GitHub Bootcamp on Saturday, June 26th. + This bootcamp is intended to be an interactive workshop session where we help participants + get setup with git and using it in a team environment. +

          +

          Session 1: Setting up Git

          +

          + This session will run for an hour and be focused on installing and setting up git for the first time. + We'll have helpers available to help you set up git and get it integreated with your editor of choice. + Whether it's PyCharm, VSCode, or vim, we can help you get rolling with version control. +

          +

          Session 2: Using git and github in a team environment

          +

          + This session will run for an hour. It will be focused on using git and HitHub in a team environment. + You'll be put in a group of people with a repo to work on. +

          + + + +{% endblock %} + +{% block sidebar %} + + {% include "events/sidebar/code-jams/8.html" %} + +{% endblock %} diff --git a/pydis_site/templates/events/sidebar/code-jams/8.html b/pydis_site/templates/events/sidebar/code-jams/8.html index fe65ae2e..3d5a5447 100644 --- a/pydis_site/templates/events/sidebar/code-jams/8.html +++ b/pydis_site/templates/events/sidebar/code-jams/8.html @@ -3,6 +3,7 @@

          Important Links

          Rules Approved Frameworks + GitHub Bootcamp
        -- cgit v1.2.3 From 8ed04b26d64bb1d3191a94e78db190c46a823473 Mon Sep 17 00:00:00 2001 From: Janine vN Date: Sun, 20 Jun 2021 12:23:10 -0400 Subject: Add in information about the Qualifier This adds in a section about the qualifier and links to it and the sign-up form. --- .../templates/events/pages/code-jams/8/_index.html | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html index 799beca1..1f08fb66 100644 --- a/pydis_site/templates/events/pages/code-jams/8/_index.html +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -21,9 +21,9 @@

        Important Dates

        • Tuesday, June 15 - Form to submit theme suggestions opens
        • -
        • Monday, June 21 - The Qualifier is released
        • +
        • Monday, June 21 - The Qualifier is released
        • Friday, June 25 - Voting for the theme opens
        • -
        • Sunday, June 27 - GitHub Bootcamp
        • +
        • Sunday, June 27 - GitHub Bootcamp
        • Wednesday, June 30 - The Qualifier closes
        • Friday, July 9 - Code Jam begins
        • Friday, July 16 - Coding portion of the jam ends
        • @@ -36,10 +36,27 @@ Each team must create a program with one of the approved frameworks that creates a user interface that is text based. For more information of TUIs and what's involved with such an interface, check out this wikipedia article.

          - +

          The Qualifier

          +

          + The qualifier is a coding challenge that you are required to complete before registering for the code jam. + This is meant as a basic assessment of your skills to ensure you have enough python knowledge to effectively contribute in a team environment. +

          +

          View the Qualifier

          + Please note the requirements for the qualifier. +
            +
          • The qualifier must be completed using Python 3.9
          • +
          • No external modules are allowed, only those available through the standard library.
          • +
          • The Qualifier must be submitted through the Code Jam sign-up form.
          • +
          +

          How to Join

          -

          The Qualifier isn't released yet, but to receive the most up-to-date information and to get notified - when the Qualifier is released you can join us on Discord at discord.gg/python.

          +

          + To enter into the code jam you must complete The Qualifier and submit the sign-up form. + Don't forget to join us on Discord at discord.gg/python! +

          +

          + {% endblock %} {% block sidebar %} -- cgit v1.2.3 From ef5f4b71397886f6a208f85d88e649c13c7774ad Mon Sep 17 00:00:00 2001 From: Janine vN Date: Sun, 20 Jun 2021 14:15:13 -0400 Subject: Add Tabnine as a sponsor Adds tabnine as a sponsor on the events sidebar. --- pydis_site/static/images/events/Tabnine.png | Bin 0 -> 10534 bytes pydis_site/templates/events/sidebar/code-jams/8.html | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 pydis_site/static/images/events/Tabnine.png diff --git a/pydis_site/static/images/events/Tabnine.png b/pydis_site/static/images/events/Tabnine.png new file mode 100644 index 00000000..eee42a5e Binary files /dev/null and b/pydis_site/static/images/events/Tabnine.png differ diff --git a/pydis_site/templates/events/sidebar/code-jams/8.html b/pydis_site/templates/events/sidebar/code-jams/8.html index 3d5a5447..c1afdf47 100644 --- a/pydis_site/templates/events/sidebar/code-jams/8.html +++ b/pydis_site/templates/events/sidebar/code-jams/8.html @@ -15,4 +15,7 @@ JetBrains + + Tabnine +
        -- cgit v1.2.3 From 35fb561256e19aafcd7800fb275d3497bcd59680 Mon Sep 17 00:00:00 2001 From: Janine vN Date: Sun, 20 Jun 2021 14:25:45 -0400 Subject: Adds Prizes section to CJ8 page This adds a Prizes section to the Code Jam 8 page. Links, descriptions, and a quick summation of the prizes offered by each sponsor is included. The Python Discord prizes should also be included at a later date. --- .../templates/events/pages/code-jams/8/_index.html | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html index 1f08fb66..6539e63a 100644 --- a/pydis_site/templates/events/pages/code-jams/8/_index.html +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -1,5 +1,7 @@ {% extends "events/base_sidebar.html" %} +{% load static %} + {% block title %}Summer Code Jam 2021{% endblock %} {% block breadcrumb %} @@ -56,6 +58,69 @@ Don't forget to join us on Discord at discord.gg/python!

        +

        Prizes

        +

        + Our Code Jam Sponsors have provided prizes for the winners of the code jam. + Also, a big thank you to our Patreon patrons for supporting this server and allowing us + to provide our prizes as well. +

        + +
        +
        +
        +
        + Digital Ocean +
        +
        + +

        + Scalable compute platform with add-on storage, security, and monitoring capabilities. + We make it simple to launch in the cloud and scale up as you grow—whether you’re running one virtual machine or ten thousand. +

        +

        Prizes
        + $250 in DigitalOcean credits to a winning team.

        +
        +
        +
        +
        + +
        +
        +
        +
        + JetBrains +
        +
        + +

        + Whatever platform or language you work with, JetBrains has a development tool for you. + We help developers work faster by automating common, repetitive tasks to enable them to stay focused on code design and the big picture. + We provide tools to explore and familiarize with code bases faster. Our products make it easy for you to take care of quality during all stages of development and spend less time on maintenance tasks. +

        +

        Prizes
        + 1-year JetBrain licenses to a winning team.

        +
        +
        +
        +
        +
        +
        +
        +
        + Tabnine +
        +
        + +

        Tabnine is an AI-powered code completion tool used by millions of devs around the world every day + - Tabnine supports dozens of programming languages, in all of your favorite IDEs, saving you tons of time - so that you can type less and code more. + Tabnine comes as a plugin and has a free-forever basic plan, so you can get started with it right away! +

        +

        Prizes
        + 1-year Pro Licenses to Tabnine to a winning team.

        +
        +
        +
        +
        {% endblock %} -- cgit v1.2.3 From d2112a84259c18db2d2a93b3821a8668edc23ada Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Mon, 21 Jun 2021 00:48:27 +0100 Subject: Update navbar hamburger/dropdown anchors to spans There is no href on these items, so they should not be anchors. --- pydis_site/templates/base/navbar.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pydis_site/templates/base/navbar.html b/pydis_site/templates/base/navbar.html index ee458b03..d7cb49b2 100644 --- a/pydis_site/templates/base/navbar.html +++ b/pydis_site/templates/base/navbar.html @@ -57,12 +57,12 @@ {# More #}
        @@ -98,7 +98,7 @@ We provide tools to explore and familiarize with code bases faster. Our products make it easy for you to take care of quality during all stages of development and spend less time on maintenance tasks.

        Prizes
        - 1-year JetBrain licenses to a winning team.

        + 1-year JetBrain licenses to the members of a winning team.

    @@ -116,7 +116,7 @@ Tabnine comes as a plugin and has a free-forever basic plan, so you can get started with it right away!

    Prizes
    - 1-year Pro Licenses to Tabnine to a winning team.

    + 1-year Pro Licenses to Tabnine to the members of a winning team.

    -- cgit v1.2.3 From 89e52ce860b598cc7575af82b6b7134f246c3e26 Mon Sep 17 00:00:00 2001 From: Boris Muratov <8bee278@gmail.com> Date: Wed, 23 Jun 2021 14:24:40 +0300 Subject: Update git bootcamp date --- pydis_site/templates/events/pages/code-jams/8/_index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html index 9b75188c..9ebca7c7 100644 --- a/pydis_site/templates/events/pages/code-jams/8/_index.html +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -25,7 +25,7 @@
  • Tuesday, June 15 - Form to submit theme suggestions opens
  • Monday, June 21 - The Qualifier is released
  • Friday, June 25 - Voting for the theme opens
  • -
  • Sunday, June 27 - GitHub Bootcamp
  • +
  • Saturday, June 26 - GitHub Bootcamp
  • Wednesday, June 30 - The Qualifier closes
  • Friday, July 9 - Code Jam begins
  • Friday, July 16 - Coding portion of the jam ends
  • -- cgit v1.2.3 From fa42a72ae957e8e62d1f554a8f21af5b8f247777 Mon Sep 17 00:00:00 2001 From: Janine vN Date: Wed, 23 Jun 2021 21:44:08 -0400 Subject: Updating bootcamp information Adds time and more information about the GitHub bootcamp. --- .../templates/events/pages/code-jams/8/_index.html | 2 +- .../events/pages/code-jams/8/github-bootcamp.html | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html index 9ebca7c7..d3d3cc0f 100644 --- a/pydis_site/templates/events/pages/code-jams/8/_index.html +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -25,7 +25,7 @@
  • Tuesday, June 15 - Form to submit theme suggestions opens
  • Monday, June 21 - The Qualifier is released
  • Friday, June 25 - Voting for the theme opens
  • -
  • Saturday, June 26 - GitHub Bootcamp
  • +
  • Saturday, June 26 @ 12PM UTC- GitHub Bootcamp
  • Wednesday, June 30 - The Qualifier closes
  • Friday, July 9 - Code Jam begins
  • Friday, July 16 - Coding portion of the jam ends
  • diff --git a/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html b/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html index 18951e48..bac03d11 100644 --- a/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html +++ b/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html @@ -13,24 +13,29 @@ {% block event_content %}

    - This year we'll be running a GitHub Bootcamp on Saturday, June 26th. + This year we'll be running a GitHub Bootcamp on Saturday, June 26th at 4PM UTC. This bootcamp is intended to be an interactive workshop session where we help participants - get setup with git and using it in a team environment. + get setup with git and using it in a team environment. If you are new to git or would like to brush up on it, + then this is the perfect event for you. +

    +

    + The instructional parts of this bootcamp will be recorded. We'll also be providing a cheatsheet / reference guide to all attendees that will + be made available here for download.

    Session 1: Setting up Git

    - This session will run for an hour and be focused on installing and setting up git for the first time. - We'll have helpers available to help you set up git and get it integreated with your editor of choice. + This first session will run for an hour starting at 4PM UTC. It will be focused on installing and setting up git for the first time. + We'll have helpers available to help you set up git and integreated with your editor of choice. Whether it's PyCharm, VSCode, or vim, we can help you get rolling with version control.

    Session 2: Using git and github in a team environment

    - This session will run for an hour. It will be focused on using git and GitHub in a team environment. - You'll be put in a group of people with a repo to work on. + This session will run for an hour starting at 5PM UTC. It will be focused on using git and GitHub in a team environment. + You'll be put in a group with other attendees and use the common git commands for working in a repo. + You'll learn how to set-up a GitHub reposity with other contributors, how to make branches, make commits, pull down changes, and then make pull requests. + We'll also be going over different strategies for creating branches and best practices for commits and pull requests.

    - - {% endblock %} {% block sidebar %} -- cgit v1.2.3 From 57a6ff40d3abbad39db1394b679c5358bfa9b274 Mon Sep 17 00:00:00 2001 From: Janine vN Date: Wed, 23 Jun 2021 22:01:50 -0400 Subject: Change time to UTC --- pydis_site/templates/events/pages/code-jams/8/_index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html index d3d3cc0f..c510c250 100644 --- a/pydis_site/templates/events/pages/code-jams/8/_index.html +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -25,7 +25,7 @@
  • Tuesday, June 15 - Form to submit theme suggestions opens
  • Monday, June 21 - The Qualifier is released
  • Friday, June 25 - Voting for the theme opens
  • -
  • Saturday, June 26 @ 12PM UTC- GitHub Bootcamp
  • +
  • Saturday, June 26 @ 4PM UTC- GitHub Bootcamp
  • Wednesday, June 30 - The Qualifier closes
  • Friday, July 9 - Code Jam begins
  • Friday, July 16 - Coding portion of the jam ends
  • -- cgit v1.2.3 From 0284db7f24fb1f624e0b548894d5248eb0eba1f5 Mon Sep 17 00:00:00 2001 From: Janine vN Date: Wed, 23 Jun 2021 22:08:37 -0400 Subject: Fix typos --- pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html b/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html index bac03d11..836ed3ed 100644 --- a/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html +++ b/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html @@ -25,14 +25,14 @@

    Session 1: Setting up Git

    This first session will run for an hour starting at 4PM UTC. It will be focused on installing and setting up git for the first time. - We'll have helpers available to help you set up git and integreated with your editor of choice. + We'll have helpers available to help you set up git and integrated with your editor of choice. Whether it's PyCharm, VSCode, or vim, we can help you get rolling with version control.

    Session 2: Using git and github in a team environment

    This session will run for an hour starting at 5PM UTC. It will be focused on using git and GitHub in a team environment. You'll be put in a group with other attendees and use the common git commands for working in a repo. - You'll learn how to set-up a GitHub reposity with other contributors, how to make branches, make commits, pull down changes, and then make pull requests. + You'll learn how to set-up a GitHub repository with other contributors, how to make branches, make commits, pull down changes, and then make pull requests. We'll also be going over different strategies for creating branches and best practices for commits and pull requests.

    -- cgit v1.2.3 From 05730b3c55811ec2b9c7c0ff8484714a3ee498b2 Mon Sep 17 00:00:00 2001 From: bast Date: Thu, 24 Jun 2021 07:34:59 -0700 Subject: Add pragma: no cover to mark failure condition of test as known ok --- pydis_site/apps/api/tests/test_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/apps/api/tests/test_models.py b/pydis_site/apps/api/tests/test_models.py index 1303639e..5c9ddea4 100644 --- a/pydis_site/apps/api/tests/test_models.py +++ b/pydis_site/apps/api/tests/test_models.py @@ -56,7 +56,7 @@ class NitroMessageLengthTest(TestCase): try: message.clean_fields() - except Exception as e: + except Exception as e: # pragma: no cover self.fail(f"Creation of message of length 3950 failed with: {e}") def test_create_failure(self): -- cgit v1.2.3 From 6c9c7f078d2d677f4e377264e2741fd02a228cab Mon Sep 17 00:00:00 2001 From: bast Date: Thu, 24 Jun 2021 07:46:14 -0700 Subject: Recreate nitro message length migration and name it --- .../apps/api/migrations/0070_auto_20210618_2010.py | 18 ------------------ .../migrations/0071_increase_message_content_4000.py | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) delete mode 100644 pydis_site/apps/api/migrations/0070_auto_20210618_2010.py create mode 100644 pydis_site/apps/api/migrations/0071_increase_message_content_4000.py diff --git a/pydis_site/apps/api/migrations/0070_auto_20210618_2010.py b/pydis_site/apps/api/migrations/0070_auto_20210618_2010.py deleted file mode 100644 index b0c79b32..00000000 --- a/pydis_site/apps/api/migrations/0070_auto_20210618_2010.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.14 on 2021-06-18 20:10 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('api', '0069_documentationlink_validators'), - ] - - operations = [ - migrations.AlterField( - model_name='deletedmessage', - name='content', - field=models.CharField(blank=True, help_text='The content of this message, taken from Discord.', max_length=4000), - ), - ] diff --git a/pydis_site/apps/api/migrations/0071_increase_message_content_4000.py b/pydis_site/apps/api/migrations/0071_increase_message_content_4000.py new file mode 100644 index 00000000..6ca5d21a --- /dev/null +++ b/pydis_site/apps/api/migrations/0071_increase_message_content_4000.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.14 on 2021-06-24 14:45 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0070_auto_20210618_2114'), + ] + + operations = [ + migrations.AlterField( + model_name='deletedmessage', + name='content', + field=models.CharField(blank=True, help_text='The content of this message, taken from Discord.', max_length=4000), + ), + ] -- cgit v1.2.3 From 25cc5fbd8821c0bc1344de1ef9e613efd9ef8989 Mon Sep 17 00:00:00 2001 From: lemonsaurus Date: Sun, 27 Jun 2021 12:52:15 +0200 Subject: Move existing code jam assets into a folder. --- pydis_site/static/images/events/cj8_asciimatics.png | Bin 26219 -> 0 bytes pydis_site/static/images/events/cj8_blessed.gif | Bin 41307 -> 0 bytes pydis_site/static/images/events/cj8_curses.png | Bin 6483 -> 0 bytes pydis_site/static/images/events/cj8_prompttoolkit.png | Bin 144850 -> 0 bytes pydis_site/static/images/events/cj8_rich.gif | Bin 906975 -> 0 bytes pydis_site/static/images/events/cj8_urwid.png | Bin 318 -> 0 bytes .../static/images/events/summer_code_jam_2021.png | Bin 738161 -> 0 bytes .../images/events/summer_code_jam_2021/banner.png | Bin 0 -> 738161 bytes .../events/summer_code_jam_2021/cj8_asciimatics.png | Bin 0 -> 26219 bytes .../images/events/summer_code_jam_2021/cj8_blessed.gif | Bin 0 -> 41307 bytes .../images/events/summer_code_jam_2021/cj8_curses.png | Bin 0 -> 6483 bytes .../events/summer_code_jam_2021/cj8_prompttoolkit.png | Bin 0 -> 144850 bytes .../images/events/summer_code_jam_2021/cj8_rich.gif | Bin 0 -> 906975 bytes .../images/events/summer_code_jam_2021/cj8_urwid.png | Bin 0 -> 318 bytes .../templates/events/pages/code-jams/8/frameworks.html | 12 ++++++------ pydis_site/templates/events/sidebar/code-jams/8.html | 2 +- .../events/sidebar/code-jams/upcoming-code-jam.html | 2 +- .../templates/events/sidebar/upcoming-event.html | 2 +- 18 files changed, 9 insertions(+), 9 deletions(-) delete mode 100644 pydis_site/static/images/events/cj8_asciimatics.png delete mode 100644 pydis_site/static/images/events/cj8_blessed.gif delete mode 100644 pydis_site/static/images/events/cj8_curses.png delete mode 100644 pydis_site/static/images/events/cj8_prompttoolkit.png delete mode 100644 pydis_site/static/images/events/cj8_rich.gif delete mode 100644 pydis_site/static/images/events/cj8_urwid.png delete mode 100644 pydis_site/static/images/events/summer_code_jam_2021.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/banner.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/cj8_asciimatics.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/cj8_blessed.gif create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/cj8_curses.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/cj8_prompttoolkit.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/cj8_rich.gif create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/cj8_urwid.png diff --git a/pydis_site/static/images/events/cj8_asciimatics.png b/pydis_site/static/images/events/cj8_asciimatics.png deleted file mode 100644 index ac52338e..00000000 Binary files a/pydis_site/static/images/events/cj8_asciimatics.png and /dev/null differ diff --git a/pydis_site/static/images/events/cj8_blessed.gif b/pydis_site/static/images/events/cj8_blessed.gif deleted file mode 100644 index 8bdbf5b1..00000000 Binary files a/pydis_site/static/images/events/cj8_blessed.gif and /dev/null differ diff --git a/pydis_site/static/images/events/cj8_curses.png b/pydis_site/static/images/events/cj8_curses.png deleted file mode 100644 index c1a177ff..00000000 Binary files a/pydis_site/static/images/events/cj8_curses.png and /dev/null differ diff --git a/pydis_site/static/images/events/cj8_prompttoolkit.png b/pydis_site/static/images/events/cj8_prompttoolkit.png deleted file mode 100644 index a359a7af..00000000 Binary files a/pydis_site/static/images/events/cj8_prompttoolkit.png and /dev/null differ diff --git a/pydis_site/static/images/events/cj8_rich.gif b/pydis_site/static/images/events/cj8_rich.gif deleted file mode 100644 index 3a0ffbf3..00000000 Binary files a/pydis_site/static/images/events/cj8_rich.gif and /dev/null differ diff --git a/pydis_site/static/images/events/cj8_urwid.png b/pydis_site/static/images/events/cj8_urwid.png deleted file mode 100644 index 98a264b7..00000000 Binary files a/pydis_site/static/images/events/cj8_urwid.png and /dev/null differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021.png b/pydis_site/static/images/events/summer_code_jam_2021.png deleted file mode 100644 index 778c7c90..00000000 Binary files a/pydis_site/static/images/events/summer_code_jam_2021.png and /dev/null differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/banner.png b/pydis_site/static/images/events/summer_code_jam_2021/banner.png new file mode 100644 index 00000000..778c7c90 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/banner.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/cj8_asciimatics.png b/pydis_site/static/images/events/summer_code_jam_2021/cj8_asciimatics.png new file mode 100644 index 00000000..ac52338e Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/cj8_asciimatics.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/cj8_blessed.gif b/pydis_site/static/images/events/summer_code_jam_2021/cj8_blessed.gif new file mode 100644 index 00000000..8bdbf5b1 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/cj8_blessed.gif differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/cj8_curses.png b/pydis_site/static/images/events/summer_code_jam_2021/cj8_curses.png new file mode 100644 index 00000000..c1a177ff Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/cj8_curses.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/cj8_prompttoolkit.png b/pydis_site/static/images/events/summer_code_jam_2021/cj8_prompttoolkit.png new file mode 100644 index 00000000..a359a7af Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/cj8_prompttoolkit.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/cj8_rich.gif b/pydis_site/static/images/events/summer_code_jam_2021/cj8_rich.gif new file mode 100644 index 00000000..3a0ffbf3 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/cj8_rich.gif differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/cj8_urwid.png b/pydis_site/static/images/events/summer_code_jam_2021/cj8_urwid.png new file mode 100644 index 00000000..98a264b7 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/cj8_urwid.png differ diff --git a/pydis_site/templates/events/pages/code-jams/8/frameworks.html b/pydis_site/templates/events/pages/code-jams/8/frameworks.html index 2ee6715a..532fb71f 100644 --- a/pydis_site/templates/events/pages/code-jams/8/frameworks.html +++ b/pydis_site/templates/events/pages/code-jams/8/frameworks.html @@ -27,7 +27,7 @@
    - urwid + urwid

    Curses

    @@ -48,7 +48,7 @@
    - curses + curses

    Blessed

    @@ -62,7 +62,7 @@
    - blessed + blessed

    Rich

    @@ -76,7 +76,7 @@
    - rich + rich

    Asciimatics

    @@ -89,7 +89,7 @@
    - asciimatics + asciimatics

    Python Prompt Toolkit

    @@ -102,7 +102,7 @@
    - python prompt toolkit + python prompt toolkit
    diff --git a/pydis_site/templates/events/sidebar/code-jams/8.html b/pydis_site/templates/events/sidebar/code-jams/8.html index c1afdf47..ff5131c2 100644 --- a/pydis_site/templates/events/sidebar/code-jams/8.html +++ b/pydis_site/templates/events/sidebar/code-jams/8.html @@ -7,7 +7,7 @@
    - Summer Code Jam 2021 + Summer Code Jam 2021 Digital Ocean diff --git a/pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html b/pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html index 10494ad8..19806b4e 100644 --- a/pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html +++ b/pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html @@ -3,6 +3,6 @@ diff --git a/pydis_site/templates/events/sidebar/upcoming-event.html b/pydis_site/templates/events/sidebar/upcoming-event.html index d8ea18e0..cfa4cf88 100644 --- a/pydis_site/templates/events/sidebar/upcoming-event.html +++ b/pydis_site/templates/events/sidebar/upcoming-event.html @@ -3,6 +3,6 @@
    - Summer Code Jam 2021 + Summer Code Jam 2021
    -- cgit v1.2.3 From 56094871d188fb0c26bd4d774600f136f46568ae Mon Sep 17 00:00:00 2001 From: lemonsaurus Date: Sun, 27 Jun 2021 12:52:39 +0200 Subject: Add some new Summer Code Jam banners. --- .../front_page_banners/currently_live.png | Bin 0 -> 253088 bytes .../front_page_banners/random_team.png | Bin 0 -> 273798 bytes .../front_page_banners/sign_up_now.png | Bin 0 -> 209657 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png diff --git a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png new file mode 100644 index 00000000..c678c977 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png new file mode 100644 index 00000000..4f0999f5 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png new file mode 100644 index 00000000..98035441 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png differ -- cgit v1.2.3 From 8ad3f9c099a59978c9b05612b6666d372dc6b324 Mon Sep 17 00:00:00 2001 From: lemonsaurus Date: Sun, 27 Jun 2021 12:52:55 +0200 Subject: Put Summer Code Jam '21 banner on the front page. --- pydis_site/templates/home/index.html | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/pydis_site/templates/home/index.html b/pydis_site/templates/home/index.html index 08f98607..3d173d6d 100644 --- a/pydis_site/templates/home/index.html +++ b/pydis_site/templates/home/index.html @@ -11,15 +11,7 @@
    -
    -

    100K Member Milestone!

    -
    -
    - Thanks to all our members for helping us create this friendly and helpful community! -

    - As a nice treat, we've created a Timeline page for people - to discover the events that made our community what it is today. Be sure to check it out! -
    + Summer Code Jam 2021
    @@ -29,7 +21,7 @@
    {# Embedded Welcome video #} -
    +
    + + {# Code Jam banner #} +
    + Summer Code Jam 2021 +
    -- cgit v1.2.3 From f23f1cea39c9a04e9a74a4bcddacdc4bc38f6459 Mon Sep 17 00:00:00 2001 From: Matteo Bertucci Date: Sun, 27 Jun 2021 15:13:03 +0200 Subject: Docker-compose: upgrade to postgres 13 We have been using postgres 13 in production for a long time, but we never actually updated the docker-compose environment. --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1f49f1f3..05867a46 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,7 @@ version: "3.6" services: postgres: - image: postgres:12-alpine + image: postgres:13-alpine ports: - "127.0.0.1:7777:5432" environment: -- cgit v1.2.3 From eda0a551949beeda44a698ad22aac25f70198c9f Mon Sep 17 00:00:00 2001 From: lemonsaurus Date: Sun, 27 Jun 2021 15:24:55 +0200 Subject: Update banners to have vertically centered text. --- .../front_page_banners/currently_live.png | Bin 253088 -> 253545 bytes .../front_page_banners/random_team.png | Bin 273798 -> 273735 bytes .../front_page_banners/sign_up_now.png | Bin 209657 -> 209749 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png index c678c977..939aca2a 100644 Binary files a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png and b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png index 4f0999f5..ea48ef4b 100644 Binary files a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png and b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png index 98035441..7258b1b9 100644 Binary files a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png and b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png differ -- cgit v1.2.3 From 70154a63c9a1fbac46bc2e16110217f9c295ae05 Mon Sep 17 00:00:00 2001 From: lemonsaurus Date: Sun, 27 Jun 2021 15:25:04 +0200 Subject: Hyperlink code jam banner to code jam page. --- pydis_site/templates/home/index.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pydis_site/templates/home/index.html b/pydis_site/templates/home/index.html index 3d173d6d..2efa5b49 100644 --- a/pydis_site/templates/home/index.html +++ b/pydis_site/templates/home/index.html @@ -11,7 +11,9 @@
    - Summer Code Jam 2021 + + Summer Code Jam 2021 +
    @@ -45,7 +47,9 @@ {# Code Jam banner #}
    - Summer Code Jam 2021 + + Summer Code Jam 2021 +
    -- cgit v1.2.3 From 5e024b41f823a0c3101cd974a88c8a8867d2fd7c Mon Sep 17 00:00:00 2001 From: Numerlor <25886452+Numerlor@users.noreply.github.com> Date: Sun, 27 Jun 2021 17:10:11 +0200 Subject: Add docker-compose.override.yml to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index e8a4d31f..e4ad2c19 100644 --- a/.gitignore +++ b/.gitignore @@ -116,6 +116,9 @@ rethinkdb_data/ # Node modules node_modules/ +# User configuration +docker-compose.override.yml + pip-wheel-metadata/ staticfiles/ -- cgit v1.2.3 From 0cec14fec6c67128c7e29323a69ffdb4fbeaf263 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Thu, 8 Jul 2021 20:16:20 +0300 Subject: Create The Code Style Guide under Code Jam pages --- .../pages/code-jams/the-code-style-guide.html | 299 +++++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 pydis_site/templates/events/pages/code-jams/the-code-style-guide.html diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html new file mode 100644 index 00000000..33b36d99 --- /dev/null +++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html @@ -0,0 +1,299 @@ +{% extends "events/base_sidebar.html" %} + +{% block breadcrumb %} +
  • Events
  • +
  • Code Jams
  • +
  • The Code Style Guide
  • +{% endblock %} + +{% block title %}The Code Style Guide{% endblock %} + +{% block event_content %} +

    + For end-users, the most important parts of the software are functionality and UI/UX. + But for developers, there is one more important aspect - code style. + While ugly code can do everything that it has to do, developing it further may be a difficult task, + especially if a developer didn't write an original code. + Which one of the following do you prefer to read and work with? +

    +
    +        
    +            MyPath = '/file.txt'
    +            from pathlib import *
    +            import os.path,sys
    +            def check(p):
    +                """Uses os.path.exist         """
    +                return os.path.exists(p)
    +
    +            def getF(
    +              p):
    +            """Not sure what this do, this just worked.
    +            """
    +              return Path(p
    +              )
    +            result=[check(MyPath),getF(MyPath)]
    +        
    +    
    +

    or

    +
    +        
    +            import os.path
    +            from pathlib import Path
    +
    +            FILE_PATH = '/file.txt'
    +
    +
    +            def check_file_exists(path: str) -> bool:
    +                """Checks does file exists in path. Uses os.path.exists."""
    +                return os.path.exists(path)
    +
    +
    +            def get_path_object(path: str) -> Path:
    +                """
    +                Returns Path object of the path provided in arguments.
    +
    +                This is here for backward compatibility, will be removed in the future.
    +                """
    +                return Path(path)
    +
    +            result = [
    +                check_file_exists(FILE_PATH),
    +                get_path_object(FILE_PATH),
    +            ]
    +        
    +    
    + +

    + The second is definitely easier to read and understand. + These scripts are small and if you read even first, you can understand what this code does pretty fast, + but what if the project has thousands and thousands of files in a really complex folder structure? + Do you want then code what looks like the first example? + You can save hours sometimes if you write beautiful code that follows style rules. +

    +

    + The most important document of Python code style is PEP 8. + This gives the majority of all Python code style rules. This article will cover the most important rules of PEP 8. +

    + +

    Linters

    +

    + But everyone makes mistakes and there are so many style rules that can be really difficult to remember and always follow. + Luckily, we have amazing tools that help us - linters. While there are many linters, + we'd like code jam participants to use flake8. + Flake8 points out to you rules what you did break in your code so you can fix them. +

    + +

    Rules

    +

    Basics

    +

    For indentation, you should use 4 spaces. Using tabs is not suggested, but if you do, you can't mix spaces and tabs.

    +

    + PEP 8 defines a maximum line length of 79 characters, however, + we are not so strict - we let teams choose a maximum line length between 79 and 119 characters. +

    +

    2 blank lines should be left before functions and classes. Single blank lines are used to split sections and make logical breaks.

    + +

    Naming

    +

    Module, file, function, and variable names (except type variables) should be lowercase and use underscores.

    +
    +        
    +            # File: my_module.py/mymodule.py
    +
    +            def my_function():
    +                my_variable = "value"
    +        
    +    
    +

    Class and type variable names should use the camel case style.

    +
    +        
    +            from typing import List
    +
    +
    +            class MyClass:
    +                pass
    +
    +            ListOfMyClass = List[MyClass]
    +        
    +    
    +

    Constant names should be all uppercase, and words should be separated with underscores.

    +
    +        
    +            MY_CONSTANT = 1
    +        
    +    
    +

    + You should avoid single-character names, as these might be confusing. + But if you still do, you should avoid characters that may look like zero or one in some fonts: + "O" (uppercase o), "l" (lowercase L), and "I" (uppercase i). +

    + +

    Operators

    +

    + If you have a chain of mathematic operations that you split into multiple lines, + you should put the operator at the beginning of the line and not to the end of the line. +

    +
    +        
    +            # No
    +            result = (
    +                1 +
    +                2 *
    +                3
    +            )
    +
    +            # Yes
    +            result = (
    +                1
    +                + 2
    +                * 3
    +            )
    +        
    +    
    +

    If you compare against None, you should use is and is not, but not compare equality.

    +
    +        
    +            # No
    +            if variable == None:
    +                print("Variable is None")
    +
    +            # Yes
    +            if variable is None:
    +                print("Variable is None")
    +        
    +    
    +

    + You should prefer using is not over not is . + Using second makes it harder to understand the expression. +

    +
    +        
    +            # No
    +            if not variable is None:
    +                print("Variable is not None")
    +
    +            # Yes - it is much easier to read and understand this than previous
    +            if variable is not None:
    +                print("Variable is not None")
    +        
    +    
    + +

    Imports

    +

    Imports should be at top of the file, the only things that should be before them are module comments and docstrings.

    +

    You shouldn't import multiple modules in one line, but give each module import its own line instead.

    +
    +        
    +            # No
    +            import pathlib, os
    +
    +            # Yes
    +            import os
    +            import pathlib
    +        
    +    
    +

    Wildcard imports should be avoided in most cases. They make unclear where what comes from.

    +
    +        
    +            # No
    +            from pathlib import *
    +
    +            # Yes
    +            from pathlib import Path
    +        
    +    
    +

    You should use isort imports order specification, what means:

    +
      +
    • + Group by type: order of import types should be __future__ imports, standard library imports, + third-party library imports, and finally project imports. +
    • +
    • + Group by import way: inside each group, first should come imports in format import <package> + and after them from <package> import <items>. +
    • +
    • + Order imports alphabetically: inside each import way group, imports should be ordered by package names. +
    • +
    • + Order individual import items by type and alphabetically: in from <package> import <items> format, + <items> should be ordered alphabetically, starting with bare module imports. +
    • +
    + +

    Comments

    +

    + Comments are really important because they help everyone understand, what code does. + But as important as having comments is keeping them up-to-date. + Out-to-date, wrong comments confuse readers. +

    +

    Comments content should start with a capital letter and be a full sentence(s).

    +

    There are three types of comments:

    +
      +
    • + Block comments: Probably most common comment type. Should be indented to the same level as the code they describe. + Each line in the block comment has to start with # what should be followed by a single space, + except for text indention inside the comment. To separate paragraphs, use one line containing only #. +
      +                
      +                    if variable is None or variable == 1:
      +                        # If variable is None, something went wrong previously.
      +                        #
      +                        # Here starts a new important paragraph.
      +                
      +            
      +
    • +
    • + Inline comments: You should prefer block comments over inline comments and use inline comments only where it is really necessary. + Never use inline comments to explain obvious things what line do. If you want to use an inline comment on a variable, think first, + maybe you can use a better variable name instead. After code and before the start of inline comments should be at least two spaces. + Just like block comments, inline comments also have to start with # what should be followed by a single space. +
      +                
      +                    # Do not use inline comments to explain things
      +                    # that the reader can understand even without the inline comment.
      +                    my_variable = "Value!"  # Assign value to my_variable
      +
      +                    # Here better variable name can be used like shown in the second line.
      +                    x = "Walmart"  # Shop name
      +                    shop_name = "Walmart"
      +
      +                    # Sometimes, if something is not obvious, then inline comments are useful.
      +                    # Example is from PEP 8.
      +                    x = x + 1  # Compensate for border
      +                
      +            
      +
    • +
    • + Docstrings: Last, but not least important comment type is docstring, which is a short version of documentation string. + Docstring rules haven't been defined by PEP 8, but by PEP 257 instead. + Docstrings should start and end with three quotes ("""). There are two types of docstrings: one-line docstrings and multiline docstrings. + One-line docstrings have to start and end in the same line, while multiline docstrings start and end in different lines. + Multiline docstring has two parts: summary line and a longer description, which are separated by one empty line. + The multiline sentence starting and ending quotes should be at different lines than the content. +
      +                
      +                    # This is a one-line docstring.
      +                    """This is one line module docstring."""
      +
      +
      +                    # This is a multiline docstring.
      +                    def my_function():
      +                        """
      +                        This is the summary line.
      +
      +                        This is the description.
      +                        """
      +                
      +            
      +
    • +
    + +

    Too much for you?

    +

    + Is all this PEP 8 rules stuff making your head exploding? We have something for you! We have a song! + We have The PEP 8 Song (featuring lemonsaurus)! + Great way to get started with writing beautiful code. +

    +{% endblock %} + +{% block sidebar %} + {% include "events/sidebar/code-jams/useful-information.html" %} +{% endblock %} -- cgit v1.2.3 From 20ae1ecf415f19f422df4866a2e07359549460b2 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Thu, 8 Jul 2021 20:17:58 +0300 Subject: Add The Code Style Guide to useful information sidebar --- pydis_site/templates/events/sidebar/code-jams/useful-information.html | 1 + 1 file changed, 1 insertion(+) diff --git a/pydis_site/templates/events/sidebar/code-jams/useful-information.html b/pydis_site/templates/events/sidebar/code-jams/useful-information.html index c4e665e6..841a533a 100644 --- a/pydis_site/templates/events/sidebar/code-jams/useful-information.html +++ b/pydis_site/templates/events/sidebar/code-jams/useful-information.html @@ -4,5 +4,6 @@
  • How to use git
  • How does judging work?
  • Opening a Pull Request
  • +
  • The Code Style Guide
  • -- cgit v1.2.3 From fac0a2bce2f8c06111f68446ad7df7f3003d3383 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Thu, 8 Jul 2021 20:18:56 +0300 Subject: Add The Code Style Guide to CJ 8 sidebar --- pydis_site/templates/events/sidebar/code-jams/8.html | 1 + 1 file changed, 1 insertion(+) diff --git a/pydis_site/templates/events/sidebar/code-jams/8.html b/pydis_site/templates/events/sidebar/code-jams/8.html index ff5131c2..e68c913d 100644 --- a/pydis_site/templates/events/sidebar/code-jams/8.html +++ b/pydis_site/templates/events/sidebar/code-jams/8.html @@ -4,6 +4,7 @@ Rules Approved Frameworks GitHub Bootcamp + The Code Style Guide
    -- cgit v1.2.3 From 25a50578cd7f77dd468bcee2cfd398aa42da972d Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Thu, 8 Jul 2021 20:33:10 +0300 Subject: Remove trailing whitespace from The Code Style Guide --- pydis_site/templates/events/pages/code-jams/the-code-style-guide.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html index 33b36d99..3176babf 100644 --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html @@ -175,7 +175,7 @@ print("Variable is not None") - +

    Imports

    Imports should be at top of the file, the only things that should be before them are module comments and docstrings.

    You shouldn't import multiple modules in one line, but give each module import its own line instead.

    -- cgit v1.2.3 From 23b1e46342e743cdb1ec8e0bb30e4696a3018079 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 00:00:15 +0300 Subject: Add missing slash at b tag ending Co-authored-by: Numerlor <25886452+Numerlor@users.noreply.github.com> --- pydis_site/templates/events/pages/code-jams/the-code-style-guide.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html index 3176babf..eb8ab9da 100644 --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html @@ -199,7 +199,7 @@ from pathlib import Path -

    You should use isort imports order specification, what means:

    +

    You should use isort imports order specification, what means:

    • Group by type: order of import types should be __future__ imports, standard library imports, -- cgit v1.2.3 From 1ff45d2831eff3a48bd7718bb95b9e73d513713e Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 00:03:04 +0300 Subject: Use better wording for head explosion question --- pydis_site/templates/events/pages/code-jams/the-code-style-guide.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html index eb8ab9da..be022ffc 100644 --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html @@ -288,7 +288,7 @@

      Too much for you?

      - Is all this PEP 8 rules stuff making your head exploding? We have something for you! We have a song! + Do all these style rules make your head explode? We have something for you! We have a song! We have The PEP 8 Song (featuring lemonsaurus)! Great way to get started with writing beautiful code.

      -- cgit v1.2.3 From c1ad8468166ae7bc37d7293b7ad724a329b9f8a2 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 00:06:25 +0300 Subject: Add missing comma Co-authored-by: Numerlor <25886452+Numerlor@users.noreply.github.com> --- pydis_site/templates/events/pages/code-jams/the-code-style-guide.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html index be022ffc..07823f6f 100644 --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html @@ -220,7 +220,7 @@

      Comments

      - Comments are really important because they help everyone understand, what code does. + Comments are really important because they help everyone understand what code does. But as important as having comments is keeping them up-to-date. Out-to-date, wrong comments confuse readers.

      -- cgit v1.2.3 From 7f8e84b97ec38546bc6e1204f9fa1313955ad68d Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 00:08:18 +0300 Subject: Way -> method --- pydis_site/templates/events/pages/code-jams/the-code-style-guide.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html index 07823f6f..fabf5444 100644 --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html @@ -206,11 +206,11 @@ third-party library imports, and finally project imports.
    • - Group by import way: inside each group, first should come imports in format import <package> + Group by import method: inside each group, first should come imports in format import <package> and after them from <package> import <items>.
    • - Order imports alphabetically: inside each import way group, imports should be ordered by package names. + Order imports alphabetically: inside each import method group, imports should be ordered by package names.
    • Order individual import items by type and alphabetically: in from <package> import <items> format, -- cgit v1.2.3 From 761aa067d19f669e56c32dc4c24b8242cd23a668 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 00:09:32 +0300 Subject: Add missing colon Co-authored-by: Numerlor <25886452+Numerlor@users.noreply.github.com> --- pydis_site/templates/events/pages/code-jams/the-code-style-guide.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html index fabf5444..5e4a957e 100644 --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html @@ -202,7 +202,7 @@

      You should use isort imports order specification, what means:

      • - Group by type: order of import types should be __future__ imports, standard library imports, + Group by type: order of import types should be: __future__ imports, standard library imports, third-party library imports, and finally project imports.
      • -- cgit v1.2.3 From 0f60abe2305047bcf6d11a9be7f458c03b74cf22 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 00:10:24 +0300 Subject: Change wording in The Code Style Guide Co-authored-by: Numerlor <25886452+Numerlor@users.noreply.github.com> --- .../templates/events/pages/code-jams/the-code-style-guide.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html index 5e4a957e..a26a973c 100644 --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html @@ -242,9 +242,9 @@
      • Inline comments: You should prefer block comments over inline comments and use inline comments only where it is really necessary. - Never use inline comments to explain obvious things what line do. If you want to use an inline comment on a variable, think first, + Never use inline comments to explain obvious things like what a line does. If you want to use an inline comment on a variable, think first, maybe you can use a better variable name instead. After code and before the start of inline comments should be at least two spaces. - Just like block comments, inline comments also have to start with # what should be followed by a single space. + Just like block comments, inline comments also have to start with # followed by a single space.
                         
                             # Do not use inline comments to explain things
        @@ -267,7 +267,7 @@
                     Docstrings should start and end with three quotes ("""). There are two types of docstrings: one-line docstrings and multiline docstrings.
                     One-line docstrings have to start and end in the same line, while multiline docstrings start and end in different lines.
                     Multiline docstring has two parts: summary line and a longer description, which are separated by one empty line.
        -            The multiline sentence starting and ending quotes should be at different lines than the content.
        +            The multiline sentence start and end quotes should be at different lines than the content.
                     
                         
                             # This is a one-line docstring.
        -- 
        cgit v1.2.3
        
        
        From bdc492f79880b3ebb7be6e15020142e44c8dbdd6 Mon Sep 17 00:00:00 2001
        From: ks129 <45097959+ks129@users.noreply.github.com>
        Date: Fri, 9 Jul 2021 00:12:35 +0300
        Subject: Escape HTML in The Code Style Guide
        
        ---
         pydis_site/templates/events/pages/code-jams/the-code-style-guide.html | 2 +-
         1 file changed, 1 insertion(+), 1 deletion(-)
        
        diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
        index a26a973c..4258cd94 100644
        --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
        +++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
        @@ -161,7 +161,7 @@
                 
             

        - You should prefer using is not over not is . + You should prefer using <item one> is not <item two> over not <item one> is <item two>. Using second makes it harder to understand the expression.

        -- 
        cgit v1.2.3
        
        
        From dea0924f8160c5452e0c52657aeaacc488b606e2 Mon Sep 17 00:00:00 2001
        From: ks129 <45097959+ks129@users.noreply.github.com>
        Date: Fri, 9 Jul 2021 00:26:58 +0300
        Subject: Remove leading spaces and unnecessary newlines from code blocks
        
        HTML 
         tag is adding indention also to result, so I had to remove these.
        ---
         .../pages/code-jams/the-code-style-guide.html      | 252 ++++++++-------------
         1 file changed, 100 insertions(+), 152 deletions(-)
        
        diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
        index 4258cd94..d3359ebb 100644
        --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
        +++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html
        @@ -16,52 +16,44 @@
                 especially if a developer didn't write an original code.
                 Which one of the following do you prefer to read and work with?
             

        -
        -        
        -            MyPath = '/file.txt'
        -            from pathlib import *
        -            import os.path,sys
        -            def check(p):
        -                """Uses os.path.exist         """
        -                return os.path.exists(p)
        -
        -            def getF(
        -              p):
        -            """Not sure what this do, this just worked.
        -            """
        -              return Path(p
        -              )
        -            result=[check(MyPath),getF(MyPath)]
        -        
        -    
        +
        MyPath = '/file.txt'
        +from pathlib import *
        +import os.path,sys
        +def check(p):
        +  """Uses os.path.exist         """
        +  return os.path.exists(p)
        +
        +def getF(
        +  p):
        +  """Not sure what this do, this just worked.
        +  """
        +  return Path(p
        +  )
        +result=[check(MyPath),getF(MyPath)]

        or

        -
        -        
        -            import os.path
        -            from pathlib import Path
        +    
        import os.path
        +from pathlib import Path
         
        -            FILE_PATH = '/file.txt'
        +FILE_PATH = '/file.txt'
         
         
        -            def check_file_exists(path: str) -> bool:
        -                """Checks does file exists in path. Uses os.path.exists."""
        -                return os.path.exists(path)
        +def check_file_exists(path: str) -> bool:
        +    """Checks does file exists in path. Uses os.path.exists."""
        +    return os.path.exists(path)
         
         
        -            def get_path_object(path: str) -> Path:
        -                """
        -                Returns Path object of the path provided in arguments.
        +def get_path_object(path: str) -> Path:
        +    """
        +    Returns Path object of the path provided in arguments.
         
        -                This is here for backward compatibility, will be removed in the future.
        -                """
        -                return Path(path)
        +    This is here for backward compatibility, will be removed in the future.
        +    """
        +    return Path(path)
         
        -            result = [
        -                check_file_exists(FILE_PATH),
        -                get_path_object(FILE_PATH),
        -            ]
        -        
        -    
        +result = [ + check_file_exists(FILE_PATH), + get_path_object(FILE_PATH), +]

        The second is definitely easier to read and understand. @@ -94,32 +86,20 @@

        Naming

        Module, file, function, and variable names (except type variables) should be lowercase and use underscores.

        -
        -        
        -            # File: my_module.py/mymodule.py
        -
        -            def my_function():
        -                my_variable = "value"
        -        
        -    
        +
        # File: my_module.py/mymodule.py
        +
        +def my_function():
        +    my_variable = "value"

        Class and type variable names should use the camel case style.

        -
        -        
        -            from typing import List
        +    
        from typing import List
         
         
        -            class MyClass:
        -                pass
        +class MyClass:
        +    pass
         
        -            ListOfMyClass = List[MyClass]
        -        
        -    
        +ListOfMyClass = List[MyClass]

        Constant names should be all uppercase, and words should be separated with underscores.

        -
        -        
        -            MY_CONSTANT = 1
        -        
        -    
        +
        MY_CONSTANT = 1

        You should avoid single-character names, as these might be confusing. But if you still do, you should avoid characters that may look like zero or one in some fonts: @@ -131,74 +111,54 @@ If you have a chain of mathematic operations that you split into multiple lines, you should put the operator at the beginning of the line and not to the end of the line.

        -
        -        
        -            # No
        -            result = (
        -                1 +
        -                2 *
        -                3
        -            )
        -
        -            # Yes
        -            result = (
        -                1
        -                + 2
        -                * 3
        -            )
        -        
        -    
        +
        # No
        +result = (
        +    1 +
        +    2 *
        +    3
        +)
        +
        +# Yes
        +result = (
        +    1
        +    + 2
        +    * 3
        +)

        If you compare against None, you should use is and is not, but not compare equality.

        -
        -        
        -            # No
        -            if variable == None:
        -                print("Variable is None")
        -
        -            # Yes
        -            if variable is None:
        -                print("Variable is None")
        -        
        -    
        +
        # No
        +if variable == None:
        +    print("Variable is None")
        +
        +# Yes
        +if variable is None:
        +    print("Variable is None")

        You should prefer using <item one> is not <item two> over not <item one> is <item two>. Using second makes it harder to understand the expression.

        -
        -        
        -            # No
        -            if not variable is None:
        -                print("Variable is not None")
        -
        -            # Yes - it is much easier to read and understand this than previous
        -            if variable is not None:
        -                print("Variable is not None")
        -        
        -    
        +
        # No
        +if not variable is None:
        +    print("Variable is not None")
        +
        +# Yes - it is much easier to read and understand this than previous
        +if variable is not None:
        +    print("Variable is not None")

        Imports

        Imports should be at top of the file, the only things that should be before them are module comments and docstrings.

        You shouldn't import multiple modules in one line, but give each module import its own line instead.

        -
        -        
        -            # No
        -            import pathlib, os
        -
        -            # Yes
        -            import os
        -            import pathlib
        -        
        -    
        +
        # No
        +import pathlib, os
        +
        +# Yes
        +import os
        +import pathlib

        Wildcard imports should be avoided in most cases. They make unclear where what comes from.

        -
        -        
        -            # No
        -            from pathlib import *
        -
        -            # Yes
        -            from pathlib import Path
        -        
        -    
        +
        # No
        +from pathlib import *
        +
        +# Yes
        +from pathlib import Path

        You should use isort imports order specification, what means:

        • @@ -231,35 +191,27 @@ Block comments: Probably most common comment type. Should be indented to the same level as the code they describe. Each line in the block comment has to start with # what should be followed by a single space, except for text indention inside the comment. To separate paragraphs, use one line containing only #. -
          -                
          -                    if variable is None or variable == 1:
          -                        # If variable is None, something went wrong previously.
          -                        #
          -                        # Here starts a new important paragraph.
          -                
          -            
          +
          if variable is None or variable == 1:
          +    # If variable is None, something went wrong previously.
          +    #
          +    # Here starts a new important paragraph.
        • Inline comments: You should prefer block comments over inline comments and use inline comments only where it is really necessary. Never use inline comments to explain obvious things like what a line does. If you want to use an inline comment on a variable, think first, maybe you can use a better variable name instead. After code and before the start of inline comments should be at least two spaces. Just like block comments, inline comments also have to start with # followed by a single space. -
          -                
          -                    # Do not use inline comments to explain things
          -                    # that the reader can understand even without the inline comment.
          -                    my_variable = "Value!"  # Assign value to my_variable
          -
          -                    # Here better variable name can be used like shown in the second line.
          -                    x = "Walmart"  # Shop name
          -                    shop_name = "Walmart"
          -
          -                    # Sometimes, if something is not obvious, then inline comments are useful.
          -                    # Example is from PEP 8.
          -                    x = x + 1  # Compensate for border
          -                
          -            
          +
          # Do not use inline comments to explain things
          +# that the reader can understand even without the inline comment.
          +my_variable = "Value!"  # Assign value to my_variable
          +
          +# Here better variable name can be used like shown in the second line.
          +x = "Walmart"  # Shop name
          +shop_name = "Walmart"
          +
          +# Sometimes, if something is not obvious, then inline comments are useful.
          +# Example is from PEP 8.
          +x = x + 1  # Compensate for border
        • Docstrings: Last, but not least important comment type is docstring, which is a short version of documentation string. @@ -268,21 +220,17 @@ One-line docstrings have to start and end in the same line, while multiline docstrings start and end in different lines. Multiline docstring has two parts: summary line and a longer description, which are separated by one empty line. The multiline sentence start and end quotes should be at different lines than the content. -
          -                
          -                    # This is a one-line docstring.
          -                    """This is one line module docstring."""
          +            
          # This is a one-line docstring.
          +"""This is one line module docstring."""
           
           
          -                    # This is a multiline docstring.
          -                    def my_function():
          -                        """
          -                        This is the summary line.
          +# This is a multiline docstring.
          +def my_function():
          +    """
          +    This is the summary line.
           
          -                        This is the description.
          -                        """
          -                
          -            
          + This is the description. + """
        -- cgit v1.2.3 From 20962cbc7ae5b3d0a5ba53e6d3360a02e07e750c Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 00:31:39 +0300 Subject: Split comments paragraphs to even smaller paragraphs --- .../pages/code-jams/the-code-style-guide.html | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html index d3359ebb..68423dde 100644 --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html @@ -197,10 +197,15 @@ from pathlib import Path
        # Here starts a new important paragraph.
      • - Inline comments: You should prefer block comments over inline comments and use inline comments only where it is really necessary. - Never use inline comments to explain obvious things like what a line does. If you want to use an inline comment on a variable, think first, - maybe you can use a better variable name instead. After code and before the start of inline comments should be at least two spaces. - Just like block comments, inline comments also have to start with # followed by a single space. +

        + Inline comments: You should prefer block comments over inline comments and use inline comments only where it is really necessary. + Never use inline comments to explain obvious things like what a line does. +

        +

        If you want to use an inline comment on a variable, think first, maybe you can use a better variable name instead.

        +

        + After code and before the start of inline comments should be at least two spaces. + Just like block comments, inline comments also have to start with # followed by a single space. +

        # Do not use inline comments to explain things
         # that the reader can understand even without the inline comment.
         my_variable = "Value!"  # Assign value to my_variable
        @@ -214,12 +219,17 @@ shop_name = "Walmart"
         x = x + 1  # Compensate for border
      • - Docstrings: Last, but not least important comment type is docstring, which is a short version of documentation string. - Docstring rules haven't been defined by PEP 8, but by PEP 257 instead. - Docstrings should start and end with three quotes ("""). There are two types of docstrings: one-line docstrings and multiline docstrings. - One-line docstrings have to start and end in the same line, while multiline docstrings start and end in different lines. - Multiline docstring has two parts: summary line and a longer description, which are separated by one empty line. - The multiline sentence start and end quotes should be at different lines than the content. +

        + Docstrings: Last, but not least important comment type is docstring, which is a short version of documentation string. + Docstring rules haven't been defined by PEP 8, but by PEP 257 instead. + Docstrings should start and end with three quotes ("""). +

        +

        There are two types of docstrings: one-line docstrings and multiline docstrings.

        +

        + One-line docstrings have to start and end in the same line, while multiline docstrings start and end in different lines. + Multiline docstring has two parts: summary line and a longer description, which are separated by one empty line. + The multiline docstring start and end quotes should be at different lines than the content. +

        # This is a one-line docstring.
         """This is one line module docstring."""
         
        -- 
        cgit v1.2.3
        
        
        From 944343cddc573d757784027463242298511ebf6a Mon Sep 17 00:00:00 2001
        From: Janine vN 
        Date: Thu, 8 Jul 2021 18:57:13 -0400
        Subject: Update dates & times for code jam The dates and times on the main
         event page have been updated to reflect the changes.
        
        ---
         pydis_site/templates/events/pages/code-jams/8/_index.html | 14 +++++++-------
         1 file changed, 7 insertions(+), 7 deletions(-)
        
        diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html
        index c510c250..34171969 100644
        --- a/pydis_site/templates/events/pages/code-jams/8/_index.html
        +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html
        @@ -12,12 +12,12 @@
         
         {% block event_content %}
             

        Twice a year we host a code jam for members of our server to participate in. The code jam is an event where we place you - in a team with 5 other random server members. You then have 7 days to code some sort of application or program in Python. + in a team with 5 other random server members. You then have 8 days to code some sort of application or program in Python. Your program must use the specified technology/framework and incorporate the theme chosen by the server.

        - After the 7 days is complete, your team has 2 days to finish documentation and create a video presentation showcasing - and walking through the program that your team has created. More details and specifics of this will be released within the next 2 weeks. + After the 8 days is complete, your team has 3 days to finish documentation and create a video presentation showcasing + and walking through the program that your team has created.

        Important Dates

        @@ -26,10 +26,10 @@
      • Monday, June 21 - The Qualifier is released
      • Friday, June 25 - Voting for the theme opens
      • Saturday, June 26 @ 4PM UTC- GitHub Bootcamp
      • -
      • Wednesday, June 30 - The Qualifier closes
      • -
      • Friday, July 9 - Code Jam begins
      • -
      • Friday, July 16 - Coding portion of the jam ends
      • -
      • Sunday, July 18 - Code Jam submissions are closed
      • +
      • Wednesday, July 1 - The Qualifier closes
      • +
      • Friday, July 9 @ 5PM UTC - Code Jam begins and the theme is announced
      • +
      • Saturday, July 17 @ 5PM UTC - Coding portion of the jam ends
      • +
      • Tuesday, July 20 - Code Jam submissions are closed and video presentation must be submitted

      Technology

      -- cgit v1.2.3 From 451b04fb57573364c525bdaee18d380faee832a5 Mon Sep 17 00:00:00 2001 From: Janine vN Date: Thu, 8 Jul 2021 19:06:05 -0400 Subject: Add textual to conditionally approved list Adds Textual, the TUI framework that uses Rich as its renderer to as an allowed library. It's still under active development though and is not stable. --- pydis_site/templates/events/pages/code-jams/8/frameworks.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pydis_site/templates/events/pages/code-jams/8/frameworks.html b/pydis_site/templates/events/pages/code-jams/8/frameworks.html index 532fb71f..34ac4f0a 100644 --- a/pydis_site/templates/events/pages/code-jams/8/frameworks.html +++ b/pydis_site/templates/events/pages/code-jams/8/frameworks.html @@ -73,6 +73,11 @@
    • Supports: Linux, Mac, and Windows
    • Documentation is good and overall is very OOP focused
    • Robust with many features and example snippets
    • +
    • To supplement Rich the following library is approved, although no guarantees are made for stability.
    • +
        +
      • Textual - a TUI framework using Rich as the render. +
        It is still under active development, is only available on Mac/Linux, and is not stable yet.
      • +
    -- cgit v1.2.3 From cae262bdc412c06273b4ff5e9c50378fec08fc09 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 12:17:09 +0300 Subject: Rename the-code-style-guide.html to code-style-guide.html --- .../events/pages/code-jams/code-style-guide.html | 257 +++++++++++++++++++++ .../pages/code-jams/the-code-style-guide.html | 257 --------------------- 2 files changed, 257 insertions(+), 257 deletions(-) create mode 100644 pydis_site/templates/events/pages/code-jams/code-style-guide.html delete mode 100644 pydis_site/templates/events/pages/code-jams/the-code-style-guide.html diff --git a/pydis_site/templates/events/pages/code-jams/code-style-guide.html b/pydis_site/templates/events/pages/code-jams/code-style-guide.html new file mode 100644 index 00000000..68423dde --- /dev/null +++ b/pydis_site/templates/events/pages/code-jams/code-style-guide.html @@ -0,0 +1,257 @@ +{% extends "events/base_sidebar.html" %} + +{% block breadcrumb %} +
  • Events
  • +
  • Code Jams
  • +
  • The Code Style Guide
  • +{% endblock %} + +{% block title %}The Code Style Guide{% endblock %} + +{% block event_content %} +

    + For end-users, the most important parts of the software are functionality and UI/UX. + But for developers, there is one more important aspect - code style. + While ugly code can do everything that it has to do, developing it further may be a difficult task, + especially if a developer didn't write an original code. + Which one of the following do you prefer to read and work with? +

    +
    MyPath = '/file.txt'
    +from pathlib import *
    +import os.path,sys
    +def check(p):
    +  """Uses os.path.exist         """
    +  return os.path.exists(p)
    +
    +def getF(
    +  p):
    +  """Not sure what this do, this just worked.
    +  """
    +  return Path(p
    +  )
    +result=[check(MyPath),getF(MyPath)]
    +

    or

    +
    import os.path
    +from pathlib import Path
    +
    +FILE_PATH = '/file.txt'
    +
    +
    +def check_file_exists(path: str) -> bool:
    +    """Checks does file exists in path. Uses os.path.exists."""
    +    return os.path.exists(path)
    +
    +
    +def get_path_object(path: str) -> Path:
    +    """
    +    Returns Path object of the path provided in arguments.
    +
    +    This is here for backward compatibility, will be removed in the future.
    +    """
    +    return Path(path)
    +
    +result = [
    +    check_file_exists(FILE_PATH),
    +    get_path_object(FILE_PATH),
    +]
    + +

    + The second is definitely easier to read and understand. + These scripts are small and if you read even first, you can understand what this code does pretty fast, + but what if the project has thousands and thousands of files in a really complex folder structure? + Do you want then code what looks like the first example? + You can save hours sometimes if you write beautiful code that follows style rules. +

    +

    + The most important document of Python code style is PEP 8. + This gives the majority of all Python code style rules. This article will cover the most important rules of PEP 8. +

    + +

    Linters

    +

    + But everyone makes mistakes and there are so many style rules that can be really difficult to remember and always follow. + Luckily, we have amazing tools that help us - linters. While there are many linters, + we'd like code jam participants to use flake8. + Flake8 points out to you rules what you did break in your code so you can fix them. +

    + +

    Rules

    +

    Basics

    +

    For indentation, you should use 4 spaces. Using tabs is not suggested, but if you do, you can't mix spaces and tabs.

    +

    + PEP 8 defines a maximum line length of 79 characters, however, + we are not so strict - we let teams choose a maximum line length between 79 and 119 characters. +

    +

    2 blank lines should be left before functions and classes. Single blank lines are used to split sections and make logical breaks.

    + +

    Naming

    +

    Module, file, function, and variable names (except type variables) should be lowercase and use underscores.

    +
    # File: my_module.py/mymodule.py
    +
    +def my_function():
    +    my_variable = "value"
    +

    Class and type variable names should use the camel case style.

    +
    from typing import List
    +
    +
    +class MyClass:
    +    pass
    +
    +ListOfMyClass = List[MyClass]
    +

    Constant names should be all uppercase, and words should be separated with underscores.

    +
    MY_CONSTANT = 1
    +

    + You should avoid single-character names, as these might be confusing. + But if you still do, you should avoid characters that may look like zero or one in some fonts: + "O" (uppercase o), "l" (lowercase L), and "I" (uppercase i). +

    + +

    Operators

    +

    + If you have a chain of mathematic operations that you split into multiple lines, + you should put the operator at the beginning of the line and not to the end of the line. +

    +
    # No
    +result = (
    +    1 +
    +    2 *
    +    3
    +)
    +
    +# Yes
    +result = (
    +    1
    +    + 2
    +    * 3
    +)
    +

    If you compare against None, you should use is and is not, but not compare equality.

    +
    # No
    +if variable == None:
    +    print("Variable is None")
    +
    +# Yes
    +if variable is None:
    +    print("Variable is None")
    +

    + You should prefer using <item one> is not <item two> over not <item one> is <item two>. + Using second makes it harder to understand the expression. +

    +
    # No
    +if not variable is None:
    +    print("Variable is not None")
    +
    +# Yes - it is much easier to read and understand this than previous
    +if variable is not None:
    +    print("Variable is not None")
    + +

    Imports

    +

    Imports should be at top of the file, the only things that should be before them are module comments and docstrings.

    +

    You shouldn't import multiple modules in one line, but give each module import its own line instead.

    +
    # No
    +import pathlib, os
    +
    +# Yes
    +import os
    +import pathlib
    +

    Wildcard imports should be avoided in most cases. They make unclear where what comes from.

    +
    # No
    +from pathlib import *
    +
    +# Yes
    +from pathlib import Path
    +

    You should use isort imports order specification, what means:

    +
      +
    • + Group by type: order of import types should be: __future__ imports, standard library imports, + third-party library imports, and finally project imports. +
    • +
    • + Group by import method: inside each group, first should come imports in format import <package> + and after them from <package> import <items>. +
    • +
    • + Order imports alphabetically: inside each import method group, imports should be ordered by package names. +
    • +
    • + Order individual import items by type and alphabetically: in from <package> import <items> format, + <items> should be ordered alphabetically, starting with bare module imports. +
    • +
    + +

    Comments

    +

    + Comments are really important because they help everyone understand what code does. + But as important as having comments is keeping them up-to-date. + Out-to-date, wrong comments confuse readers. +

    +

    Comments content should start with a capital letter and be a full sentence(s).

    +

    There are three types of comments:

    +
      +
    • + Block comments: Probably most common comment type. Should be indented to the same level as the code they describe. + Each line in the block comment has to start with # what should be followed by a single space, + except for text indention inside the comment. To separate paragraphs, use one line containing only #. +
      if variable is None or variable == 1:
      +    # If variable is None, something went wrong previously.
      +    #
      +    # Here starts a new important paragraph.
      +
    • +
    • +

      + Inline comments: You should prefer block comments over inline comments and use inline comments only where it is really necessary. + Never use inline comments to explain obvious things like what a line does. +

      +

      If you want to use an inline comment on a variable, think first, maybe you can use a better variable name instead.

      +

      + After code and before the start of inline comments should be at least two spaces. + Just like block comments, inline comments also have to start with # followed by a single space. +

      +
      # Do not use inline comments to explain things
      +# that the reader can understand even without the inline comment.
      +my_variable = "Value!"  # Assign value to my_variable
      +
      +# Here better variable name can be used like shown in the second line.
      +x = "Walmart"  # Shop name
      +shop_name = "Walmart"
      +
      +# Sometimes, if something is not obvious, then inline comments are useful.
      +# Example is from PEP 8.
      +x = x + 1  # Compensate for border
      +
    • +
    • +

      + Docstrings: Last, but not least important comment type is docstring, which is a short version of documentation string. + Docstring rules haven't been defined by PEP 8, but by PEP 257 instead. + Docstrings should start and end with three quotes ("""). +

      +

      There are two types of docstrings: one-line docstrings and multiline docstrings.

      +

      + One-line docstrings have to start and end in the same line, while multiline docstrings start and end in different lines. + Multiline docstring has two parts: summary line and a longer description, which are separated by one empty line. + The multiline docstring start and end quotes should be at different lines than the content. +

      +
      # This is a one-line docstring.
      +"""This is one line module docstring."""
      +
      +
      +# This is a multiline docstring.
      +def my_function():
      +    """
      +    This is the summary line.
      +
      +    This is the description.
      +    """
      +
    • +
    + +

    Too much for you?

    +

    + Do all these style rules make your head explode? We have something for you! We have a song! + We have The PEP 8 Song (featuring lemonsaurus)! + Great way to get started with writing beautiful code. +

    +{% endblock %} + +{% block sidebar %} + {% include "events/sidebar/code-jams/useful-information.html" %} +{% endblock %} diff --git a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html b/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html deleted file mode 100644 index 68423dde..00000000 --- a/pydis_site/templates/events/pages/code-jams/the-code-style-guide.html +++ /dev/null @@ -1,257 +0,0 @@ -{% extends "events/base_sidebar.html" %} - -{% block breadcrumb %} -
  • Events
  • -
  • Code Jams
  • -
  • The Code Style Guide
  • -{% endblock %} - -{% block title %}The Code Style Guide{% endblock %} - -{% block event_content %} -

    - For end-users, the most important parts of the software are functionality and UI/UX. - But for developers, there is one more important aspect - code style. - While ugly code can do everything that it has to do, developing it further may be a difficult task, - especially if a developer didn't write an original code. - Which one of the following do you prefer to read and work with? -

    -
    MyPath = '/file.txt'
    -from pathlib import *
    -import os.path,sys
    -def check(p):
    -  """Uses os.path.exist         """
    -  return os.path.exists(p)
    -
    -def getF(
    -  p):
    -  """Not sure what this do, this just worked.
    -  """
    -  return Path(p
    -  )
    -result=[check(MyPath),getF(MyPath)]
    -

    or

    -
    import os.path
    -from pathlib import Path
    -
    -FILE_PATH = '/file.txt'
    -
    -
    -def check_file_exists(path: str) -> bool:
    -    """Checks does file exists in path. Uses os.path.exists."""
    -    return os.path.exists(path)
    -
    -
    -def get_path_object(path: str) -> Path:
    -    """
    -    Returns Path object of the path provided in arguments.
    -
    -    This is here for backward compatibility, will be removed in the future.
    -    """
    -    return Path(path)
    -
    -result = [
    -    check_file_exists(FILE_PATH),
    -    get_path_object(FILE_PATH),
    -]
    - -

    - The second is definitely easier to read and understand. - These scripts are small and if you read even first, you can understand what this code does pretty fast, - but what if the project has thousands and thousands of files in a really complex folder structure? - Do you want then code what looks like the first example? - You can save hours sometimes if you write beautiful code that follows style rules. -

    -

    - The most important document of Python code style is PEP 8. - This gives the majority of all Python code style rules. This article will cover the most important rules of PEP 8. -

    - -

    Linters

    -

    - But everyone makes mistakes and there are so many style rules that can be really difficult to remember and always follow. - Luckily, we have amazing tools that help us - linters. While there are many linters, - we'd like code jam participants to use flake8. - Flake8 points out to you rules what you did break in your code so you can fix them. -

    - -

    Rules

    -

    Basics

    -

    For indentation, you should use 4 spaces. Using tabs is not suggested, but if you do, you can't mix spaces and tabs.

    -

    - PEP 8 defines a maximum line length of 79 characters, however, - we are not so strict - we let teams choose a maximum line length between 79 and 119 characters. -

    -

    2 blank lines should be left before functions and classes. Single blank lines are used to split sections and make logical breaks.

    - -

    Naming

    -

    Module, file, function, and variable names (except type variables) should be lowercase and use underscores.

    -
    # File: my_module.py/mymodule.py
    -
    -def my_function():
    -    my_variable = "value"
    -

    Class and type variable names should use the camel case style.

    -
    from typing import List
    -
    -
    -class MyClass:
    -    pass
    -
    -ListOfMyClass = List[MyClass]
    -

    Constant names should be all uppercase, and words should be separated with underscores.

    -
    MY_CONSTANT = 1
    -

    - You should avoid single-character names, as these might be confusing. - But if you still do, you should avoid characters that may look like zero or one in some fonts: - "O" (uppercase o), "l" (lowercase L), and "I" (uppercase i). -

    - -

    Operators

    -

    - If you have a chain of mathematic operations that you split into multiple lines, - you should put the operator at the beginning of the line and not to the end of the line. -

    -
    # No
    -result = (
    -    1 +
    -    2 *
    -    3
    -)
    -
    -# Yes
    -result = (
    -    1
    -    + 2
    -    * 3
    -)
    -

    If you compare against None, you should use is and is not, but not compare equality.

    -
    # No
    -if variable == None:
    -    print("Variable is None")
    -
    -# Yes
    -if variable is None:
    -    print("Variable is None")
    -

    - You should prefer using <item one> is not <item two> over not <item one> is <item two>. - Using second makes it harder to understand the expression. -

    -
    # No
    -if not variable is None:
    -    print("Variable is not None")
    -
    -# Yes - it is much easier to read and understand this than previous
    -if variable is not None:
    -    print("Variable is not None")
    - -

    Imports

    -

    Imports should be at top of the file, the only things that should be before them are module comments and docstrings.

    -

    You shouldn't import multiple modules in one line, but give each module import its own line instead.

    -
    # No
    -import pathlib, os
    -
    -# Yes
    -import os
    -import pathlib
    -

    Wildcard imports should be avoided in most cases. They make unclear where what comes from.

    -
    # No
    -from pathlib import *
    -
    -# Yes
    -from pathlib import Path
    -

    You should use isort imports order specification, what means:

    -
      -
    • - Group by type: order of import types should be: __future__ imports, standard library imports, - third-party library imports, and finally project imports. -
    • -
    • - Group by import method: inside each group, first should come imports in format import <package> - and after them from <package> import <items>. -
    • -
    • - Order imports alphabetically: inside each import method group, imports should be ordered by package names. -
    • -
    • - Order individual import items by type and alphabetically: in from <package> import <items> format, - <items> should be ordered alphabetically, starting with bare module imports. -
    • -
    - -

    Comments

    -

    - Comments are really important because they help everyone understand what code does. - But as important as having comments is keeping them up-to-date. - Out-to-date, wrong comments confuse readers. -

    -

    Comments content should start with a capital letter and be a full sentence(s).

    -

    There are three types of comments:

    -
      -
    • - Block comments: Probably most common comment type. Should be indented to the same level as the code they describe. - Each line in the block comment has to start with # what should be followed by a single space, - except for text indention inside the comment. To separate paragraphs, use one line containing only #. -
      if variable is None or variable == 1:
      -    # If variable is None, something went wrong previously.
      -    #
      -    # Here starts a new important paragraph.
      -
    • -
    • -

      - Inline comments: You should prefer block comments over inline comments and use inline comments only where it is really necessary. - Never use inline comments to explain obvious things like what a line does. -

      -

      If you want to use an inline comment on a variable, think first, maybe you can use a better variable name instead.

      -

      - After code and before the start of inline comments should be at least two spaces. - Just like block comments, inline comments also have to start with # followed by a single space. -

      -
      # Do not use inline comments to explain things
      -# that the reader can understand even without the inline comment.
      -my_variable = "Value!"  # Assign value to my_variable
      -
      -# Here better variable name can be used like shown in the second line.
      -x = "Walmart"  # Shop name
      -shop_name = "Walmart"
      -
      -# Sometimes, if something is not obvious, then inline comments are useful.
      -# Example is from PEP 8.
      -x = x + 1  # Compensate for border
      -
    • -
    • -

      - Docstrings: Last, but not least important comment type is docstring, which is a short version of documentation string. - Docstring rules haven't been defined by PEP 8, but by PEP 257 instead. - Docstrings should start and end with three quotes ("""). -

      -

      There are two types of docstrings: one-line docstrings and multiline docstrings.

      -

      - One-line docstrings have to start and end in the same line, while multiline docstrings start and end in different lines. - Multiline docstring has two parts: summary line and a longer description, which are separated by one empty line. - The multiline docstring start and end quotes should be at different lines than the content. -

      -
      # This is a one-line docstring.
      -"""This is one line module docstring."""
      -
      -
      -# This is a multiline docstring.
      -def my_function():
      -    """
      -    This is the summary line.
      -
      -    This is the description.
      -    """
      -
    • -
    - -

    Too much for you?

    -

    - Do all these style rules make your head explode? We have something for you! We have a song! - We have The PEP 8 Song (featuring lemonsaurus)! - Great way to get started with writing beautiful code. -

    -{% endblock %} - -{% block sidebar %} - {% include "events/sidebar/code-jams/useful-information.html" %} -{% endblock %} -- cgit v1.2.3 From da5ba59bbe2172e7a672bdb3308427315e6ceba4 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 12:18:19 +0300 Subject: Drop the- prefix from CJ 8 sidebar code style guide item --- pydis_site/templates/events/sidebar/code-jams/8.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/events/sidebar/code-jams/8.html b/pydis_site/templates/events/sidebar/code-jams/8.html index e68c913d..de8c6b0b 100644 --- a/pydis_site/templates/events/sidebar/code-jams/8.html +++ b/pydis_site/templates/events/sidebar/code-jams/8.html @@ -4,7 +4,7 @@ Rules Approved Frameworks GitHub Bootcamp - The Code Style Guide + The Code Style Guide
    -- cgit v1.2.3 From 3d83132d85c3182866feb18841ee076e595baa44 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 12:20:14 +0300 Subject: Remove the- prefix from useful information code style guide link --- pydis_site/templates/events/sidebar/code-jams/useful-information.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/events/sidebar/code-jams/useful-information.html b/pydis_site/templates/events/sidebar/code-jams/useful-information.html index 841a533a..87a92ade 100644 --- a/pydis_site/templates/events/sidebar/code-jams/useful-information.html +++ b/pydis_site/templates/events/sidebar/code-jams/useful-information.html @@ -4,6 +4,6 @@
  • How to use git
  • How does judging work?
  • Opening a Pull Request
  • -
  • The Code Style Guide
  • +
  • The Code Style Guide
  • -- cgit v1.2.3 From 29b022d613cc0b9c923b33a98f7f5725219a4ebd Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 14:54:27 +0300 Subject: Add PEP 8 song embed --- pydis_site/templates/events/pages/code-jams/code-style-guide.html | 1 + 1 file changed, 1 insertion(+) diff --git a/pydis_site/templates/events/pages/code-jams/code-style-guide.html b/pydis_site/templates/events/pages/code-jams/code-style-guide.html index 68423dde..f691d067 100644 --- a/pydis_site/templates/events/pages/code-jams/code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/code-style-guide.html @@ -250,6 +250,7 @@ def my_function(): We have The PEP 8 Song (featuring lemonsaurus)! Great way to get started with writing beautiful code.

    + {% endblock %} {% block sidebar %} -- cgit v1.2.3 From 2c156a46e4bdae22a973a3ad70368d4d43f94ec0 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 14:58:47 +0300 Subject: Move comment types from tags to

    --- .../events/pages/code-jams/code-style-guide.html | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pydis_site/templates/events/pages/code-jams/code-style-guide.html b/pydis_site/templates/events/pages/code-jams/code-style-guide.html index f691d067..0d948cbc 100644 --- a/pydis_site/templates/events/pages/code-jams/code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/code-style-guide.html @@ -188,17 +188,21 @@ from pathlib import Path

    There are three types of comments:

    • - Block comments: Probably most common comment type. Should be indented to the same level as the code they describe. - Each line in the block comment has to start with # what should be followed by a single space, - except for text indention inside the comment. To separate paragraphs, use one line containing only #. +

      Block comments

      +

      + Probably most common comment type. Should be indented to the same level as the code they describe. + Each line in the block comment has to start with # what should be followed by a single space, + except for text indention inside the comment. To separate paragraphs, use one line containing only #. +

      if variable is None or variable == 1:
           # If variable is None, something went wrong previously.
           #
           # Here starts a new important paragraph.
    • +

      Inline comments

      - Inline comments: You should prefer block comments over inline comments and use inline comments only where it is really necessary. + You should prefer block comments over inline comments and use inline comments only where it is really necessary. Never use inline comments to explain obvious things like what a line does.

      If you want to use an inline comment on a variable, think first, maybe you can use a better variable name instead.

      @@ -219,8 +223,9 @@ shop_name = "Walmart" x = x + 1 # Compensate for border
    • +

      Docstrings

      - Docstrings: Last, but not least important comment type is docstring, which is a short version of documentation string. + Last, but not least important comment type is docstring, which is a short version of documentation string. Docstring rules haven't been defined by PEP 8, but by PEP 257 instead. Docstrings should start and end with three quotes (""").

      -- cgit v1.2.3 From 3f1db69bea7a87073b1f58d7dac3e62fcb6438e8 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 15:01:04 +0300 Subject: List comment types before
        list --- pydis_site/templates/events/pages/code-jams/code-style-guide.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/events/pages/code-jams/code-style-guide.html b/pydis_site/templates/events/pages/code-jams/code-style-guide.html index 0d948cbc..fbcb7612 100644 --- a/pydis_site/templates/events/pages/code-jams/code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/code-style-guide.html @@ -185,7 +185,7 @@ from pathlib import Path Out-to-date, wrong comments confuse readers.

        Comments content should start with a capital letter and be a full sentence(s).

        -

        There are three types of comments:

        +

        There are three types of comments: block comments, inline comments, and docstrings.

        • Block comments

          -- cgit v1.2.3 From b76edd9b5e2fd0b64b1adc6c6f2679d5a75d69ec Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 9 Jul 2021 15:12:52 +0300 Subject: Improve wording in The Code Style Guide --- .../events/pages/code-jams/code-style-guide.html | 43 ++++++++++++---------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/pydis_site/templates/events/pages/code-jams/code-style-guide.html b/pydis_site/templates/events/pages/code-jams/code-style-guide.html index fbcb7612..31156da2 100644 --- a/pydis_site/templates/events/pages/code-jams/code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/code-style-guide.html @@ -13,7 +13,7 @@ For end-users, the most important parts of the software are functionality and UI/UX. But for developers, there is one more important aspect - code style. While ugly code can do everything that it has to do, developing it further may be a difficult task, - especially if a developer didn't write an original code. + especially if the developer didn't write the original code. Which one of the following do you prefer to read and work with?

          MyPath = '/file.txt'
          @@ -57,14 +57,15 @@ result = [
           
               

          The second is definitely easier to read and understand. - These scripts are small and if you read even first, you can understand what this code does pretty fast, + These scripts are small and even with the first code snippet you can understand what the code does pretty quickly, but what if the project has thousands and thousands of files in a really complex folder structure? - Do you want then code what looks like the first example? - You can save hours sometimes if you write beautiful code that follows style rules. + Do you want to work with code that looks like the first example? + You can save hours sometimes if you write beautiful code that follows the style guidelines.

          - The most important document of Python code style is PEP 8. - This gives the majority of all Python code style rules. This article will cover the most important rules of PEP 8. + The most important code style document for Python is PEP 8. + This Python Enhancement Proposal lays out the majority of all Python code style guidelines. + This article will cover the most important aspects of PEP 8.

          Linters

          @@ -75,12 +76,12 @@ result = [ Flake8 points out to you rules what you did break in your code so you can fix them.

          -

          Rules

          +

          Guidelines

          Basics

          For indentation, you should use 4 spaces. Using tabs is not suggested, but if you do, you can't mix spaces and tabs.

          PEP 8 defines a maximum line length of 79 characters, however, - we are not so strict - we let teams choose a maximum line length between 79 and 119 characters. + we are not so strict - teams are welcome to choose a maximum line length between 79 and 119 characters.

          2 blank lines should be left before functions and classes. Single blank lines are used to split sections and make logical breaks.

          @@ -109,7 +110,7 @@ ListOfMyClass = List[MyClass]

          Operators

          If you have a chain of mathematic operations that you split into multiple lines, - you should put the operator at the beginning of the line and not to the end of the line. + you should put the operator at the beginning of the line and not the end of the line.

          # No
           result = (
          @@ -124,7 +125,7 @@ result = (
               + 2
               * 3
           )
          -

          If you compare against None, you should use is and is not, but not compare equality.

          +

          If you ever check if something is equivalent to None, you should use is and is not instead of the == operator.

          # No
           if variable == None:
               print("Variable is None")
          @@ -134,7 +135,7 @@ if variable is None:
               print("Variable is None")

          You should prefer using <item one> is not <item two> over not <item one> is <item two>. - Using second makes it harder to understand the expression. + Using the latter makes it harder to understand what the expression is trying to do.

          # No
           if not variable is None:
          @@ -153,13 +154,13 @@ import pathlib, os
           # Yes
           import os
           import pathlib
          -

          Wildcard imports should be avoided in most cases. They make unclear where what comes from.

          +

          Wildcard imports should be avoided in most cases. It clutters the namespace and makes it less clear where functions or classes are coming from.

          # No
           from pathlib import *
           
           # Yes
           from pathlib import Path
          -

          You should use isort imports order specification, what means:

          +

          You should use isort imports order specification, which means:

          • Group by type: order of import types should be: __future__ imports, standard library imports, @@ -181,8 +182,12 @@ from pathlib import Path

            Comments

            Comments are really important because they help everyone understand what code does. - But as important as having comments is keeping them up-to-date. - Out-to-date, wrong comments confuse readers. + In general, comments should explain why you are doing something if it's not obvious. + You should aim to write code that makes it obvious what it is doing and you can use the comments to explain why and provide some context. +

            +

            + Keep in mind that just as important as having comments, is making sure they stay up to date. + Out-of-date and incorrect comments confuse readers of your code (including future you).

            Comments content should start with a capital letter and be a full sentence(s).

            There are three types of comments: block comments, inline comments, and docstrings.

            @@ -191,8 +196,8 @@ from pathlib import Path

            Block comments

            Probably most common comment type. Should be indented to the same level as the code they describe. - Each line in the block comment has to start with # what should be followed by a single space, - except for text indention inside the comment. To separate paragraphs, use one line containing only #. + Each line in the block comment has to start with # and should be followed by a single space. + To separate paragraphs, use one line containing only #.

            if variable is None or variable == 1:
                 # If variable is None, something went wrong previously.
            @@ -227,13 +232,13 @@ x = x + 1  # Compensate for border

            Last, but not least important comment type is docstring, which is a short version of documentation string. Docstring rules haven't been defined by PEP 8, but by PEP 257 instead. - Docstrings should start and end with three quotes (""").

            +

            Docstrings should start and end with three quotes (""").

            There are two types of docstrings: one-line docstrings and multiline docstrings.

            One-line docstrings have to start and end in the same line, while multiline docstrings start and end in different lines. Multiline docstring has two parts: summary line and a longer description, which are separated by one empty line. - The multiline docstring start and end quotes should be at different lines than the content. + The multiline docstring start and end quotes should be on different lines than the content.

            # This is a one-line docstring.
             """This is one line module docstring."""
            -- 
            cgit v1.2.3
            
            
            From 0bfa8c16ba0bdee49403a1e67487bf9a47053f6d Mon Sep 17 00:00:00 2001
            From: Matteo Bertucci 
            Date: Fri, 9 Jul 2021 17:42:48 +0200
            Subject: Code jam: switch the right menu to ongoing
            
            ---
             pydis_site/templates/events/index.html                            | 2 +-
             pydis_site/templates/events/pages/code-jams/_index.html           | 2 +-
             .../templates/events/sidebar/code-jams/ongoing-code-jam.html      | 8 ++++++++
             .../templates/events/sidebar/code-jams/upcoming-code-jam.html     | 8 --------
             pydis_site/templates/events/sidebar/ongoing-event.html            | 8 ++++++++
             pydis_site/templates/events/sidebar/upcoming-event.html           | 8 --------
             6 files changed, 18 insertions(+), 18 deletions(-)
             create mode 100644 pydis_site/templates/events/sidebar/code-jams/ongoing-code-jam.html
             delete mode 100644 pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html
             create mode 100644 pydis_site/templates/events/sidebar/ongoing-event.html
             delete mode 100644 pydis_site/templates/events/sidebar/upcoming-event.html
            
            diff --git a/pydis_site/templates/events/index.html b/pydis_site/templates/events/index.html
            index 64bf2c25..daad1c9c 100644
            --- a/pydis_site/templates/events/index.html
            +++ b/pydis_site/templates/events/index.html
            @@ -121,6 +121,6 @@
             {% endblock %}
             
             {% block sidebar %}
            -    {% include "events/sidebar/upcoming-event.html" %}
            +    {% include "events/sidebar/ongoing-event.html" %}
                 {% include "events/sidebar/events-list.html" %}
             {% endblock %}
            diff --git a/pydis_site/templates/events/pages/code-jams/_index.html b/pydis_site/templates/events/pages/code-jams/_index.html
            index fcbfa4d9..22a86db3 100644
            --- a/pydis_site/templates/events/pages/code-jams/_index.html
            +++ b/pydis_site/templates/events/pages/code-jams/_index.html
            @@ -66,7 +66,7 @@
             {% endblock %}
             
             {% block sidebar %}
            -    {% include "events/sidebar/code-jams/upcoming-code-jam.html" %}
            +    {% include "events/sidebar/code-jams/ongoing-code-jam.html" %}
                 {% include "events/sidebar/code-jams/previous-code-jams.html" %}
                 {% include "events/sidebar/code-jams/useful-information.html" %}
             {% endblock %}
            diff --git a/pydis_site/templates/events/sidebar/code-jams/ongoing-code-jam.html b/pydis_site/templates/events/sidebar/code-jams/ongoing-code-jam.html
            new file mode 100644
            index 00000000..f4fa3a37
            --- /dev/null
            +++ b/pydis_site/templates/events/sidebar/code-jams/ongoing-code-jam.html
            @@ -0,0 +1,8 @@
            +{% load static %}
            +
            +
            + + + Summer Code Jam 2021 + +
            diff --git a/pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html b/pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html deleted file mode 100644 index 19806b4e..00000000 --- a/pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html +++ /dev/null @@ -1,8 +0,0 @@ -{% load static %} - -
            - - - Summer Code Jam 2021 - -
            diff --git a/pydis_site/templates/events/sidebar/ongoing-event.html b/pydis_site/templates/events/sidebar/ongoing-event.html new file mode 100644 index 00000000..37dfdf77 --- /dev/null +++ b/pydis_site/templates/events/sidebar/ongoing-event.html @@ -0,0 +1,8 @@ +{% load static %} + +
            + + + Summer Code Jam 2021 + +
            diff --git a/pydis_site/templates/events/sidebar/upcoming-event.html b/pydis_site/templates/events/sidebar/upcoming-event.html deleted file mode 100644 index cfa4cf88..00000000 --- a/pydis_site/templates/events/sidebar/upcoming-event.html +++ /dev/null @@ -1,8 +0,0 @@ -{% load static %} - -
            - - - Summer Code Jam 2021 - -
            -- cgit v1.2.3 From 5a7ea51c39a1eab103d06b64e23f9e2840b64ccf Mon Sep 17 00:00:00 2001 From: Matteo Bertucci Date: Fri, 9 Jul 2021 17:44:27 +0200 Subject: Code jam: switch home to use the ongoing banner --- pydis_site/templates/home/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pydis_site/templates/home/index.html b/pydis_site/templates/home/index.html index 2efa5b49..072e3817 100644 --- a/pydis_site/templates/home/index.html +++ b/pydis_site/templates/home/index.html @@ -12,7 +12,7 @@
            - Summer Code Jam 2021 + Summer Code Jam 2021
            @@ -48,7 +48,7 @@ {# Code Jam banner #} -- cgit v1.2.3 From 877d3c219b56ad170a382e397b3f174d9ee8b948 Mon Sep 17 00:00:00 2001 From: Matteo Bertucci Date: Fri, 9 Jul 2021 17:44:49 +0200 Subject: Code jam: use case name in code style --- pydis_site/templates/events/pages/code-jams/code-style-guide.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pydis_site/templates/events/pages/code-jams/code-style-guide.html b/pydis_site/templates/events/pages/code-jams/code-style-guide.html index 31156da2..4ff5baaf 100644 --- a/pydis_site/templates/events/pages/code-jams/code-style-guide.html +++ b/pydis_site/templates/events/pages/code-jams/code-style-guide.html @@ -91,7 +91,7 @@ result = [ def my_function(): my_variable = "value"
            -

            Class and type variable names should use the camel case style.

            +

            Class and type variable names should use the PascalCase style.

            from typing import List
             
             
            @@ -99,7 +99,7 @@ class MyClass:
                 pass
             
             ListOfMyClass = List[MyClass]
            -

            Constant names should be all uppercase, and words should be separated with underscores.

            +

            Constant names should use the SCREAMING_SNAKE_CASE style.

            MY_CONSTANT = 1

            You should avoid single-character names, as these might be confusing. -- cgit v1.2.3 From c114398445e11b43cb0ee3e1fe6b70158747ea26 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Mon, 12 Jul 2021 13:16:25 +0100 Subject: Rename repl.it to replit and update links replit recently updated branding to replit.com, so we now reflect that in our site too. --- pydis_site/apps/resources/resources/tools/ides/repl_it.yaml | 5 ----- pydis_site/apps/resources/resources/tools/ides/replit.yaml | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 pydis_site/apps/resources/resources/tools/ides/repl_it.yaml create mode 100644 pydis_site/apps/resources/resources/tools/ides/replit.yaml diff --git a/pydis_site/apps/resources/resources/tools/ides/repl_it.yaml b/pydis_site/apps/resources/resources/tools/ides/repl_it.yaml deleted file mode 100644 index 8cd14e14..00000000 --- a/pydis_site/apps/resources/resources/tools/ides/repl_it.yaml +++ /dev/null @@ -1,5 +0,0 @@ -description: A free, collaborative, in-browser IDE to code in 50+ languages — - without spending a second on setup. -name: repl.it -title_url: https://repl.it/ -position: 3 diff --git a/pydis_site/apps/resources/resources/tools/ides/replit.yaml b/pydis_site/apps/resources/resources/tools/ides/replit.yaml new file mode 100644 index 00000000..844c5016 --- /dev/null +++ b/pydis_site/apps/resources/resources/tools/ides/replit.yaml @@ -0,0 +1,5 @@ +description: A free, collaborative, in-browser IDE to code in 50+ languages — + without spending a second on setup. +name: replit +title_url: https://replit.com/ +position: 3 -- cgit v1.2.3 From c404a011a5cf951255c256e35d348331be784e18 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Thu, 15 Jul 2021 06:31:13 +0300 Subject: Fixes Broken Doc Link Fixes a local link that points to a non-existent resource. Signed-off-by: Hassan Abouelela --- .../content/resources/guides/pydis-guides/contributing/sir-lancebot.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot.md index 601cfa4a..068b08ae 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot.md @@ -97,7 +97,7 @@ The first time you run this command, it may take a few minutes while Docker down $ docker-compose up ``` -If you get any Docker related errors, reference the [Possible Issues](./docker/possible-issues) section of the Docker page. +If you get any Docker related errors, reference the [Possible Issues](../docker#possible-issues) section of the Docker page. {: .notification .is-warning } ## Run on the host -- cgit v1.2.3 From cb268732223bef67bae1b1809e283a5b9a4a60d7 Mon Sep 17 00:00:00 2001 From: onerandomusername Date: Thu, 15 Jul 2021 02:04:19 -0400 Subject: Documents expected emoji format --- .../guides/pydis-guides/contributing/sir-lancebot/env-var-reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot/env-var-reference.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot/env-var-reference.md index 5c472eb2..2a7ef0d6 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot/env-var-reference.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot/env-var-reference.md @@ -32,7 +32,7 @@ Additionally, you may find the following environment variables useful during dev | `REDIS_PASSWORD` | | | `USE_FAKEREDIS` | If the FakeRedis module should be used. Set this to true if you don't have a Redis database setup. | | `BOT_SENTRY_DSN` | The DSN of the sentry monitor. | -| `TRASHCAN_EMOJI` | The emoji to use for the trashcan during paginated embeds | +| `TRASHCAN_EMOJI` | The full emoji to use for the trashcan. Format should be like the output of `\:emoji:`. | --- -- cgit v1.2.3