-
-
Notifications
You must be signed in to change notification settings - Fork 0
Monumental Monsteras #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
deefc35
11e4de2
cc9f868
7459079
f125dac
31f037c
e7c991a
2112f5c
a8bcce4
c0f417d
f9a3dc5
5240b37
5638dd8
69f587d
12bc5cf
a9e90cd
200e50d
09742f9
36294d6
79cb300
2140d98
3a1dd77
a1cb15f
b9b6030
a86deda
8db61a3
326eebe
61cf35b
e4cc132
a3cff30
b58fcb0
788754d
e0d1962
3a9e95e
09c470c
016d17f
548db4b
d3d3597
d695fae
7216a44
72e831b
ceba59f
e9031db
8fa1929
b36dd4d
7199e8f
61e55e7
4ba1235
1ef9ef9
5797720
21a358d
02ed88a
6616a78
3136fe2
d0a6162
de50c7e
567cd70
2edad88
797bd4b
a93479d
4d29b62
b68255a
b91da40
9bd111d
835e6ce
506dc6a
cba641f
378c802
a42c30f
8aaa2fa
c090c2f
2d14ca7
f2135a4
44641a8
321a2c9
b62b0ce
87dbaa7
2d0fd31
4284e07
4fc6988
ce176f1
1233b99
c410ee2
b51ec3e
5a24fce
9248750
d662197
54b9f7d
54ad25e
aafadba
b6d994c
16740fa
5b90b38
5e7988d
ffdbf67
04697fd
cc7ad36
c31385e
10d94bf
6c1f25d
a91595a
8a5a7fa
07da401
2f87297
94f7bcc
68d78b2
835cfb2
278a206
458ff9c
9fbe1ad
491a310
fc6f7d0
7596aec
5485258
d3eb51c
2812c26
a846a8d
67403a8
72aad93
fd49753
d24451c
e579c81
e28b68d
f659b25
22d8d7e
f014405
440b888
e2d892f
f234c83
eb6653e
afba4b7
e7fa1f8
b2f49fe
2e14069
2eb9b4d
620463c
62270f3
0a6bd68
a243637
fc189c0
f7e8aaf
682ca07
0826fbe
215e321
a1c45c1
25bfb12
2060a0e
d189dbd
7c8cd16
582ae21
93e4e09
0dade0b
103e2df
5a7a1fc
381fb72
6a6e17b
5285857
91b6d53
a5a84c6
9a7bd12
49cc843
7c90de1
368a8f0
de72617
078e46b
c881fa5
74ffd0c
21dc283
03116a8
81479e6
809d03d
c4d47c6
77f777a
add0938
6d634d6
53011ea
9b1a767
8d12c5f
10145cf
bc5eb27
36ed358
c6c0daf
00472cc
aff8a41
8b9a8d7
afb770b
9e6950f
5b8bef7
d41bd26
42d88a6
6f16e63
cc382f1
9341eab
9b653d3
9b72e46
c6fc920
90e2ff5
01a883e
6591ec3
123a610
73d439c
ebaa981
198ef8f
9c1801c
c66384a
33d861a
ff933b4
6b4339f
caf87a9
d8ba824
c1c3f57
297bff5
ea6b564
9654914
c0f52f9
219dd1f
a7402f9
afff29c
377f0a2
e19961f
d5a4775
e3341ad
4f7fb56
4a52ea9
cc61f02
937d560
37de23e
65dacda
4e0c69b
f4ea98e
76146e7
aab59d7
9afea8e
e802321
c93df32
e733c28
f3d03fa
5644dce
e55c0ef
253899f
0f019b3
043dde8
2cf7385
ae23340
8d4e6da
35a94ce
51a439b
f32c5ea
765e364
359d239
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # GitHub Action workflow enforcing our code style. | ||
|
|
||
| name: Lint | ||
|
|
||
| # Trigger the workflow on both push (to the main repository, on the main branch) | ||
| # and pull requests (against the main repository, but from any repo, from any branch). | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| # Brand new concurrency setting! This ensures that not more than one run can be triggered for the same commit. | ||
| # It is useful for pull requests coming from the main repository since both triggers will match. | ||
| concurrency: lint-${{ github.sha }} | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| env: | ||
| # The Python version your project uses. Feel free to change this if required. | ||
| PYTHON_VERSION: "3.12" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not use 3.13? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3.12 is just the default that comes with the repo template, and we never bothered changing it since it didn't really matter to us. |
||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python ${{ env.PYTHON_VERSION }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ env.PYTHON_VERSION }} | ||
|
|
||
| - name: Run pre-commit hooks | ||
| uses: pre-commit/action@v3.0.1 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be a |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Files generated by the interpreter | ||
| __pycache__/ | ||
| *.py[cod] | ||
|
|
||
| # Environment specific | ||
| .venv | ||
| venv | ||
| .env | ||
| env | ||
|
|
||
| # Unittest reports | ||
| .coverage* | ||
|
|
||
| # Logs | ||
| *.log | ||
|
|
||
| # PyEnv version selector | ||
| .python-version | ||
|
|
||
| # Built objects | ||
| *.so | ||
| dist/ | ||
| build/ | ||
|
|
||
| # IDEs | ||
| # PyCharm | ||
| .idea/ | ||
| # VSCode | ||
| .vscode/ | ||
| # MacOS | ||
| .DS_Store | ||
|
|
||
| # Since uv is not required for the project and all dependancies are pinned, | ||
| # ignore the lock file for the convenience of people using uv | ||
| uv.lock | ||
|
|
||
| # Useless build-specific files generated if you run the project a certain way | ||
| *.egg-info/ | ||
| *.egg |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Pre-commit configuration. | ||
| # See https://github.com/python-discord/code-jam-template/tree/main#pre-commit-run-linting-before-committing | ||
|
|
||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v5.0.0 | ||
| hooks: | ||
| - id: check-toml | ||
| - id: check-yaml | ||
| - id: end-of-file-fixer | ||
| - id: trailing-whitespace | ||
| args: [--markdown-linebreak-ext=md] | ||
|
|
||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.12.2 | ||
| hooks: | ||
| - id: ruff-check | ||
| - id: ruff-format |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Copyright 2025 Mannyvv, afx8732, enskyeing, husseinhirani, jks85, MeGaGiGaGon | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file probably should have been deleted. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| # Python Discord Code Jam Repository Template | ||
|
|
||
| ## A primer | ||
|
|
||
| Hello code jam participants! We've put together this repository template for you to use in [our code jams](https://pythondiscord.com/events/) or even other Python events! | ||
|
|
||
| This document contains the following information: | ||
|
|
||
| 1. [What does this template contain?](#what-does-this-template-contain) | ||
| 2. [How do I use this template?](#how-do-i-use-this-template) | ||
| 3. [How do I adapt this template to my project?](#how-do-i-adapt-this-template-to-my-project) | ||
|
|
||
| > [!TIP] | ||
| > You can also look at [our style guide](https://pythondiscord.com/events/code-jams/code-style-guide/) to get more information about what we consider a maintainable code style. | ||
|
|
||
| ## What does this template contain? | ||
|
|
||
| Here is a quick rundown of what each file in this repository contains: | ||
|
|
||
| - [`LICENSE.txt`](LICENSE.txt): [The MIT License](https://opensource.org/licenses/MIT), an OSS approved license which grants rights to everyone to use and modify your project, and limits your liability. We highly recommend you to read the license. | ||
| - [`.gitignore`](.gitignore): A list of files and directories that will be ignored by Git. Most of them are auto-generated or contain data that you wouldn't want to share publicly. | ||
| - [`pyproject.toml`](pyproject.toml): Configuration and metadata for the project, as well as the linting tool Ruff. If you're interested, you can read more about `pyproject.toml` in the [Python Packaging documentation](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/). | ||
| - [`.pre-commit-config.yaml`](.pre-commit-config.yaml): The configuration of the [pre-commit](https://pre-commit.com/) tool. | ||
| - [`.github/workflows/lint.yaml`](.github/workflows/lint.yaml): A [GitHub Actions](https://github.com/features/actions) workflow, a set of actions run by GitHub on their server after each push, to ensure the style requirements are met. | ||
|
|
||
| Each of these files have comments for you to understand easily, and modify to fit your needs. | ||
|
|
||
| ### Ruff: general style rules | ||
|
|
||
| Our first tool is Ruff. It will check your codebase and warn you about any non-conforming lines. | ||
| It is run with the command `ruff check` in the project root. | ||
|
|
||
| Here is a sample output: | ||
|
|
||
| ```shell | ||
| $ ruff check | ||
| app.py:1:5: N802 Function name `helloWorld` should be lowercase | ||
| app.py:1:5: ANN201 Missing return type annotation for public function `helloWorld` | ||
| app.py:2:5: D400 First line should end with a period | ||
| app.py:2:5: D403 First word of the first line should be capitalized: `docstring` -> `Docstring` | ||
| app.py:3:15: W292 No newline at end of file | ||
| Found 5 errors. | ||
| ``` | ||
|
|
||
| Each line corresponds to an error. The first part is the file path, then the line number, and the column index. | ||
| Then comes the error code, a unique identifier of the error, and then a human-readable message. | ||
|
|
||
| If, for any reason, you do not wish to comply with this specific error on a specific line, you can add `# noqa: CODE` at the end of the line. | ||
| For example: | ||
|
|
||
| ```python | ||
| def helloWorld(): # noqa: N802 | ||
| ... | ||
|
|
||
| ``` | ||
|
|
||
| This will ignore the function naming issue and pass linting. | ||
|
|
||
| > [!WARNING] | ||
| > We do not recommend ignoring errors unless you have a good reason to do so. | ||
|
|
||
| ### Ruff: formatting | ||
|
|
||
| Ruff also comes with a formatter, which can be run with the command `ruff format`. | ||
| It follows the same code style enforced by [Black](https://black.readthedocs.io/en/stable/index.html), so there's no need to pick between them. | ||
|
|
||
| ### Pre-commit: run linting before committing | ||
|
|
||
| The second tool doesn't check your code, but rather makes sure that you actually *do* check it. | ||
|
|
||
| It makes use of a feature called [Git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) which allow you to run a piece of code before running `git commit`. | ||
| The good thing about it is that it will cancel your commit if the lint doesn't pass. You won't have to wait for GitHub Actions to report issues and have a second fix commit. | ||
|
|
||
| It is *installed* by running `pre-commit install` and can be run manually by calling only `pre-commit`. | ||
|
|
||
| [Lint before you push!](https://soundcloud.com/lemonsaurusrex/lint-before-you-push) | ||
|
|
||
| #### List of hooks | ||
|
|
||
| - `check-toml`: Lints and corrects your TOML files. | ||
| - `check-yaml`: Lints and corrects your YAML files. | ||
| - `end-of-file-fixer`: Makes sure you always have an empty line at the end of your file. | ||
| - `trailing-whitespace`: Removes whitespaces at the end of each line. | ||
| - `ruff-check`: Runs the Ruff linter. | ||
| - `ruff-format`: Runs the Ruff formatter. | ||
|
|
||
| ## How do I use this template? | ||
|
|
||
| ### Creating your team repository | ||
|
|
||
| One person in the team, preferably the leader, will have to create the repository and add other members as collaborators. | ||
|
|
||
| 1. In the top right corner of your screen, where **Clone** usually is, you have a **Use this template** button to click. | ||
|  | ||
| 2. Give the repository a name and a description. | ||
|  | ||
| 3. Click **Create repository from template**. | ||
| 4. Click **Settings** in your newly created repository. | ||
|  | ||
| 5. In the "Access" section of the sidebar, click **Collaborators**. | ||
|  | ||
| 6. Click **Add people**. | ||
| 7. Insert the names of each of your teammates, and invite them. Once they have accepted the invitation in their email, they will have write access to the repository. | ||
|
|
||
| You are now ready to go! Sit down, relax, and wait for the kickstart! | ||
|
|
||
| > [!IMPORTANT] | ||
| > Don't forget to change the project name, description, and authors at the top of the [`pyproject.toml`](pyproject.toml) file, and swap "Python Discord" in the [`LICENSE.txt`](LICENSE.txt) file for the name of each of your team members or the name of your team *after* the start of the code jam. | ||
|
|
||
| ### Using the default pip setup | ||
|
|
||
| Our default setup includes a dependency group to be used with a [virtual environment](https://docs.python.org/3/library/venv.html). | ||
| It works with pip and uv, and we recommend this if you have never used any other dependency manager, although if you have, feel free to switch to it. | ||
| More on that [below](#how-do-i-adapt-this-template-to-my-project). | ||
|
|
||
| Dependency groups are a relatively new feature, specified in [PEP 735](https://peps.python.org/pep-0735/). | ||
| You can read more about them in the [Python Packaging User Guide](https://packaging.python.org/en/latest/specifications/dependency-groups/). | ||
|
|
||
| #### Creating the environment | ||
|
|
||
| Create a virtual environment in the folder `.venv`. | ||
|
|
||
| ```shell | ||
| python -m venv .venv | ||
| ``` | ||
|
|
||
| #### Entering the environment | ||
|
|
||
| It will change based on your operating system and shell. | ||
|
|
||
| ```shell | ||
| # Linux, Bash | ||
| $ source .venv/bin/activate | ||
| # Linux, Fish | ||
| $ source .venv/bin/activate.fish | ||
| # Linux, Csh | ||
| $ source .venv/bin/activate.csh | ||
| # Linux, PowerShell Core | ||
| $ .venv/bin/Activate.ps1 | ||
| # Windows, cmd.exe | ||
| > .venv\Scripts\activate.bat | ||
| # Windows, PowerShell | ||
| > .venv\Scripts\Activate.ps1 | ||
| ``` | ||
|
|
||
| #### Installing the dependencies | ||
|
|
||
| Once the environment is created and activated, use this command to install the development dependencies. | ||
|
|
||
| ```shell | ||
| pip install --group dev | ||
| ``` | ||
|
|
||
| #### Exiting the environment | ||
|
|
||
| Interestingly enough, it is the same for every platform. | ||
|
|
||
| ```shell | ||
| deactivate | ||
| ``` | ||
|
|
||
| Once the environment is activated, all the commands listed previously should work. | ||
|
|
||
| > [!IMPORTANT] | ||
| > We highly recommend that you run `pre-commit install` as soon as possible. | ||
|
|
||
| ## How do I adapt this template to my project? | ||
|
|
||
| If you wish to use Pipenv or Poetry, you will have to move the dependencies in [`pyproject.toml`](pyproject.toml) to the development dependencies of your tool. | ||
|
|
||
| We've included a porting to both [Poetry](samples/pyproject.toml) and [Pipenv](samples/Pipfile) in the [`samples` folder](samples). | ||
| Note that the Poetry [`pyproject.toml`](samples/pyproject.toml) file does not include the Ruff configuration, so if you simply replace the file then the Ruff configuration will be lost. | ||
|
|
||
| When installing new dependencies, don't forget to [pin](https://pip.pypa.io/en/stable/topics/repeatable-installs/#pinning-the-package-versions) them by adding a version tag at the end. | ||
| For example, if I wish to install [Click](https://click.palletsprojects.com/en/8.1.x/), a quick look at [PyPI](https://pypi.org/project/click/) tells me that `8.1.7` is the latest version. | ||
| I will then add `click~=8.1`, without the last number, to my requirements file or dependency manager. | ||
|
|
||
| > [!IMPORTANT] | ||
| > A code jam project is left unmaintained after the end of the event. If the dependencies aren't pinned, the project will break after any major change in an API. | ||
|
|
||
| ## Final words | ||
|
|
||
| > [!IMPORTANT] | ||
| > Don't forget to replace this README with an actual description of your project! Images are also welcome! | ||
|
|
||
| We hope this template will be helpful. Good luck in the jam! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Monumental Monsteras CJ25 Project | ||
| Monumental Monsteras CJ25 Project is a typing speed test, | ||
| but with a twist: You cannot type with a normal keyboard. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "You" should not be capitalized here. Edit: Nevermind, I don't know what I was thinking here. |
||
| You can only use the **wrong tool for the job**. | ||
|
|
||
| Try different wrong methods of writing text, with a score at | ||
| the end if you would like to flex on your friends. | ||
|
|
||
| Input methods: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where are the input methods? |
||
|
|
||
| # Running the project | ||
| ## Using `uv` (recommended) | ||
|
|
||
| The recommended way to run the project is using `uv`. | ||
|
|
||
| If you do not have `uv` installed, see https://docs.astral.sh/uv/getting-started/installation/ | ||
|
|
||
| ``` | ||
| $ git clone https://github.com/Mannyvv/cj25-monumental-monsteras-team-repo.git | ||
| $ cd cj25-monumental-monsteras-team-repo.git | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is wrong. The |
||
| $ uv run src/main.py | ||
| ``` | ||
|
|
||
| ## Without `uv` | ||
|
|
||
| ``` | ||
| $ git clone https://github.com/Mannyvv/cj25-monumental-monsteras-team-repo.git | ||
| $ cd cj25-monumental-monsteras-team-repo.git | ||
| $ py -3.12 -m venv .venv | ||
| $ py -m pip install . | ||
| $ py src/main.py | ||
| ``` | ||
|
|
||
| # Contributing | ||
| ## Setting up the project for development | ||
| If you do not have `pre-commit` installed, see https://pre-commit.com/#installation | ||
|
|
||
| You can also use `uvx pre-commit` to run `pre-commit` commands without permanently installing it. | ||
|
|
||
| Once you have `pre-commit` installed, run this command to set up the commit hooks. | ||
| ``` | ||
| $ pre-commit install | ||
| ``` | ||
|
|
||
| ## Development process | ||
| If the change you are making is large, open a new | ||
| issue and self-assign to make sure no duplicate work is done. | ||
|
|
||
| When making a change: | ||
| 1. Make a new branch on the main repository | ||
| 2. Make commits to the branch | ||
| 3. Open a PR from that branch to main | ||
|
|
||
| You can run the pre-commit checks locally with: | ||
| ``` | ||
| $ pre-commit run -a | ||
| ``` | ||
| If you installed the commit hook in the previous step, they should also be run locally on commits. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For projects with static typing, mypy should be in here somewhere.