Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Rename project to something more typeable, tyora! #35

Merged
merged 3 commits into from
May 16, 2024
Merged

Conversation

madeddie
Copy link
Owner

@madeddie madeddie commented May 16, 2024

Summary by CodeRabbit

  • New Features

    • Renamed the script to "Tyora: mooc.fi CSES exercise task CLI".
    • Updated all references and links to reflect the new name "Tyora".
  • Documentation

    • Added an explanation of the origin of the name "Tyora" in the README file.
  • Bug Fixes

    • Updated configuration and state directory paths to match the new script name "Tyora".
    • Modified issue tracker URLs to point to the new repository location.

Copy link
Contributor

coderabbitai bot commented May 16, 2024

Warning

Rate Limit Exceeded

@madeddie has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 51 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 4eb6aac and 9e002c4.

Walkthrough

The project has transformed through a rebranding initiative, evolving the CLI tool from "mooc.fi CSES exercise task CLI" to "Tyora". This comprehensive alteration encompasses script names, repository links, logger names, and configuration paths to align with the fresh branding.

Changes

Files Change Summary
README.md Renamed the script to "Tyora: mooc.fi CSES exercise task CLI", updated repository links, and added an explanation for the name "Tyora".
tyora.py Renamed logger, updated configuration and state directory paths, and modified issue tracker URLs.

In the land of code where changes flow,
A rabbit hops with joy to show,
Tyora's name now shines so bright,
In every path and logging light.
Embrace the change, with code so clear,
The future's bright, no need to fear.
🌟🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@senior-dev-bot senior-dev-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback from Senior Dev Bot

Comment on lines 115 to 121
parser.add_argument(
"--config",
help="Location of config file (default: %(default)s)",
default="~/.config/moocfi_cses/config.json",
default="~/.config/tyora/config.json",
)
parser.add_argument(
"--no-state",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CODE REVIEW

The code change correctly updates the default config file location. Consider using an all-uppercase variable name for constants to follow PEP 8 guidelines.

DEFAULT_CONFIG_PATH = "~/.config/tyora/config.json"

parser.add_argument(
    "--config",
    help=f"Location of config file (default: {DEFAULT_CONFIG_PATH})",
    default=DEFAULT_CONFIG_PATH,
)

Comment on lines 14 to 20
import requests


logger = logging.getLogger(name="moocfi_cses")
logger = logging.getLogger(name="tyora")


@dataclass

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CODE REVIEW

  1. Meaningful Change Notification: Changing the logger name without context can be confusing. Ensure the reason for the change is documented.

  2. Consistent Naming: Ensure the new name tyora is consistent across the project.

Example update:

import logging

# Updated logger name to `tyora` to better align with the current module
logger = logging.getLogger(name="tyora")

Include comments to explain changes for code clarity.

Comment on lines 371 to 377
cookiefile = None
cookies = dict()
if not args.no_state:
state_dir = Path("~/.local/state/moocfi_cses").expanduser()
state_dir = Path("~/.local/state/tyora").expanduser()
if not state_dir.exists():
state_dir.mkdir(parents=True, exist_ok=True)
cookiefile = state_dir / "cookies.txt"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CODE REVIEW

  1. Variable Naming: Use more descriptive names for clarity.
  2. Path Handling: Consider using os.path.expanduser for better readability.
# Improved variable naming and path handling
state_directory = Path(os.path.expanduser("~/.local/state/tyora"))
if not args.no_state:
    if not state_directory.exists():
        state_directory.mkdir(parents=True, exist_ok=True)
    cookiefile = state_directory / "cookies.txt"
cookies = {}

Comment on lines +1 to 8
# Tyora: mooc.fi CSES exercise task CLI
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/madeddie/tyora/test.yml)](https://github.com/madeddie/tyora/actions)

This script interacts with the mooc.fi instance of the CSES (https://cses.fi) website to perform various actions such as logging in, retrieving exercise lists, and submitting solutions. It provides a convenient way to view and submit tasks.
This script interacts with the mooc.fi instance of the CSES (https://cses.fi) website to perform various actions such as logging in, retrieving exercise lists, and submitting solutions.
It provides a convenient way to view and submit tasks.

## Features

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CODE REVIEW

The changes rename the project and update relevant links. The added line break enhances readability.

Suggestions:

  1. Consistently use new project name for clarity.
  2. Add a rebranding mention in the project's README.

Revised Example:

-This script interacts with the mooc.fi instance of the CSES (https://cses.fi) website to perform various actions such as logging in, retrieving exercise lists, and submitting solutions.
+`Tyora` interacts with the mooc.fi instance of the CSES (https://cses.fi) website to perform various actions such as logging in, retrieving exercise lists, and submitting solutions.

README.md Outdated
Comment on lines 35 to 65
1. Configure the script by running:

```bash
python moocfi_cses.py configure
python tyora.py configure
```

Follow the prompts to enter your mooc.fi username and password. This information will be stored for future use.

2. List available exercises:

```bash
python moocfi_cses.py list
python tyora.py list
```

This will retrieve and display a list of exercises available on the CSES platform.

3. Submit a solution:

```bash
python moocfi_cses.py submit <exercise_id> <path_to_solution_file>
python tyora.py submit <exercise_id> <path_to_solution_file>
```

Replace `<exercise_id>` with the ID of the exercise you want to submit a solution for, and `<path_to_solution_file>` with the path to your solution file.

## Origin of name

In Finnish, "työ" means "work", "pyörä" means "wheel". "Työrä" would be "work wheel"? Anyway, `pyora` was already taken, so I went with `tyora`... ;)

## Contributing

Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CODE REVIEW

Feedback:

  1. Naming Consistency: Ensure the new name tyora.py is updated consistently across the codebase and documentation.
  2. Avoid Informal Tone: The explanation about the origin of the name is informal. Consider a more professional tone for documentation.

Improvements:

  1. Update Example Commands for consistency.
  2. Professional Documentation: Rewrite the origin description formally.
# Origin of name
# The name "tyora" is derived from Finnish words: "työ" meaning "work" and "pyörä" meaning "wheel".

Comment on lines 15 to 27
1. Clone the repository to your local machine:

```bash
git clone https://github.com/madeddie/moocfi_cses.git
git clone https://github.com/madeddie/tyora.git
```

2. Navigate to the project directory:

```bash
cd moocfi_cses
cd tyora
```

3. Install the required dependencies:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CODE REVIEW

The changes are straightforward updates to repository cloning and navigation. However, ensure the repository link and directory name align with project conventions.

  1. Confirm the new repository and directory name are correct.
  2. Provide context on why the repository and project name changed.

Example:

-   git clone https://github.com/madeddie/moocfi_cses.git
+   git clone https://github.com/madeddie/tyora.git

-   cd moocfi_cses
+   cd tyora

Comment on lines 162 to 168
def write_config(configfile: str, config: dict[str, str]) -> None:
file_path = Path(configfile).expanduser()
if file_path.exists():
# TODO: https://github.com/madeddie/moocfi_cses/issues/28
# TODO: https://github.com/madeddie/tyora/issues/28
...
file_path.parent.mkdir(parents=True, exist_ok=True) # Ensure directory exists
print("Writing config to file")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CODE REVIEW

  1. Logging: Replace print with proper logging for better control and level management.
  2. Typing: Use dict subscript notation for improved type hints (Python 3.9+).
import logging
from pathlib import Path

logging.basicConfig(level=logging.INFO)

def write_config(configfile: str, config: dict[str, str]) -> None:
    file_path = Path(configfile).expanduser()
    if file_path.exists():
        # TODO: https://github.com/madeddie/tyora/issues/28
        ...
    file_path.parent.mkdir(parents=True, exist_ok=True)
    logging.info("Writing config to file")

These changes make the code more robust and up-to-date with best practices.

Copy link

============================= test session starts ==============================
platform linux -- Python 3.10.14, pytest-8.2.0, pluggy-1.5.0
rootdir: /home/runner/work/tyora/tyora
plugins: cov-5.0.0, requests-mock-1.12.1
collected 0 items / 1 error

==================================== ERRORS ====================================
__________________ ERROR collecting tests/test_moocfi_cses.py __________________
ImportError while importing test module '/home/runner/work/tyora/tyora/tests/test_moocfi_cses.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_moocfi_cses.py:1: in <module>
    import moocfi_cses
E   ModuleNotFoundError: No module named 'moocfi_cses'

---------- coverage: platform linux, python 3.10.14-final-0 ----------
Name                        Stmts   Miss  Cover
-----------------------------------------------
tests/__init__.py               0      0   100%
tests/test_moocfi_cses.py      48     47     2%
-----------------------------------------------
TOTAL                          48     47     2%

=========================== short test summary info ============================
ERROR tests/test_moocfi_cses.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.11s ===============================

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between c532e7c and 4399950.
Files selected for processing (2)
  • README.md (3 hunks)
  • tyora.py (4 hunks)
Additional comments not posted (10)
README.md (6)

1-2: LGTM! The project title and GitHub Actions badge link have been updated correctly.


4-5: LGTM! The project description has been updated correctly.


18-18: LGTM! The repository clone URL has been updated correctly.


24-24: LGTM! The directory navigation command has been updated correctly.


38-54: LGTM! The script usage commands have been updated correctly.


59-61: LGTM! The new section explaining the origin of the name "Tyora" has been added correctly.

tyora.py (4)

17-17: LGTM! The logger name has been updated correctly.


118-118: LGTM! The configuration file path has been updated correctly.


165-165: LGTM! The issue tracker URL has been updated correctly.


374-374: LGTM! The state directory path has been updated correctly.

Copy link

============================= test session starts ==============================
platform linux -- Python 3.10.14, pytest-8.2.0, pluggy-1.5.0
rootdir: /home/runner/work/tyora/tyora
plugins: cov-5.0.0, requests-mock-1.12.1
collected 11 items

tests/test_tyora.py ...........                                          [100%]

---------- coverage: platform linux, python 3.10.14-final-0 ----------
Name                  Stmts   Miss  Cover
-----------------------------------------
tests/__init__.py         0      0   100%
tests/test_tyora.py      48      0   100%
tyora.py                219    118    46%
-----------------------------------------
TOTAL                   267    118    56%


============================== 11 passed in 0.10s ==============================

Copy link

============================= test session starts ==============================
platform linux -- Python 3.10.14, pytest-8.2.0, pluggy-1.5.0
rootdir: /home/runner/work/tyora/tyora
plugins: cov-5.0.0, requests-mock-1.12.1
collected 11 items

tests/test_tyora.py ...........                                          [100%]

---------- coverage: platform linux, python 3.10.14-final-0 ----------
Name                  Stmts   Miss  Cover
-----------------------------------------
tests/__init__.py         0      0   100%
tests/test_tyora.py      48      0   100%
tyora.py                219    118    46%
-----------------------------------------
TOTAL                   267    118    56%


============================== 11 passed in 0.12s ==============================

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 4399950 and 4eb6aac.
Files selected for processing (1)
  • tests/test_tyora.py (4 hunks)
Additional comments not posted (9)
tests/test_tyora.py (9)

1-1: Import statement updated correctly.


8-8: Function call updated correctly.


12-12: Function call updated correctly.


29-29: Function call updated correctly.


34-34: Function call updated correctly.


37-37: Function call updated correctly.


54-55: Fixture updated correctly.


62-62: Function signature updated correctly.


73-73: Function signature updated correctly.

@madeddie madeddie merged commit 1227d9d into main May 16, 2024
1 check passed
@madeddie madeddie deleted the rename_project branch May 16, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant