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

[MAINTENANCE] update pre-commit #26

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
______________________________________________________________________

name: Bug report
about: Create a report to help us improve
title: "[BUG]"
title: "\[BUG\]"
labels: bug
assignees: ''

---
______________________________________________________________________
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/documentation_issue.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
______________________________________________________________________

name: Documentation issue
about: Suggest how we can improve our documentation
title: "[DOCS]"
title: "\[DOCS\]"
labels: documentation
assignees: ''

---
______________________________________________________________________
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/enhancement_report.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
______________________________________________________________________

name: Enhancement
about: Make something existing better
title: "[ENHANCEMENT]"
title: "\[ENHANCEMENT\]"
labels: enhancement
assignees: ''

---
______________________________________________________________________
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
______________________________________________________________________

name: Feature request
about: Suggest an idea for this project
title: "[FEATURE]"
title: "\[FEATURE\]"
labels: feature
assignees: ''

---
______________________________________________________________________
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/maintenance_issue.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
______________________________________________________________________

name: Maintenance issue
about: Suggest a maintenance update
title: "[MAINTENANCE]"
title: "\[MAINTENANCE\]"
labels: maintenance
assignees: ''

---
______________________________________________________________________
5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
______________________________________________________________________

name: Question
about: Help is wanted
title: ""
labels: question
assignees: ''

---
______________________________________________________________________
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
______________________________________________________________________

name: Report all other issues or questions
about: Let us know about anything else not covered by one of our specific issue types.
title: ''
labels: needs triage
assignees: ''

---

______________________________________________________________________
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
- [ ] Documentation is update.
- [ ] Changelog is update.
- [ ] If it is the case, the PR is linked to relative issue.
- [ ] If it is a release, the version number is increased.
- [ ] If it is a release, the version number is increased.
15 changes: 9 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0 # pre-commit version
hooks:
- id: check-toml # checks toml files for parseable syntax.
- id: name-tests-test # verifies that test files are named correctly.
args: [--pytest-test-first]
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.4.3
rev: v0.4.4 # ruff version
hooks:
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format
- id: ruff # run the linter
- id: ruff-format # run the formatter
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ The version is represented by three digits: a.b.c.
## Unreleased

MAINTENANCE:

- `.github`: add workflows `tests.yml`, `code-style.yml`, `release.yml` and `check-pr-title.yml`
- `.github.pull_request_template.md`: add pull request template
- `.github.ISSUE_TEMPLATE`: add templates for issues
- `tests`: in module tests we import as in the API
- `.pre-commit-config.yml`: add `check-toml` and `name-tests-test`

## \[0.0.0\] - 2024-05-01

## [0.0.0] - 2024-05-01

🎉🚀 First version of ``symmetria`` 🚀🎉
🎉🚀 First version of `symmetria` 🚀🎉
24 changes: 12 additions & 12 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down Expand Up @@ -121,8 +121,8 @@ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

[homepage]: https://www.contributor-covenant.org
41 changes: 21 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,33 @@

If you would like to contribute to the project, please take a moment to read the following points.

1. Checks if there is an [issue](https://github.com/VascoSch92/symmetria/issues) where the contribution
you had in mind is already discussed.
1. Checks if there is an [issue](https://github.com/VascoSch92/symmetria/issues) where the contribution
you had in mind is already discussed.
If it is not the case, open a new [issue](https://github.com/VascoSch92/symmetria/issues).
you would like to contribute but are unsure what to work on, take a look at the
[issue](https://github.com/VascoSch92/symmetria/issues) section.
There are plenty of ideas we would like to implement here.
2. Time to code. Once you have finished coding your implementation, open a pull-request (PR) to the ``main`` branch.
you would like to contribute but are unsure what to work on, take a look at the
[issue](https://github.com/VascoSch92/symmetria/issues) section.
There are plenty of ideas we would like to implement here.

1. Time to code. Once you have finished coding your implementation, open a pull-request (PR) to the `main` branch.
Note that the PR title should start with one of the following (included parentheses):

1. [API_CHANGE]: If there is a change to the project's API.
2. [DEPRECATED]: If the PR deprecate some functionalities.
3. [DOC]: If the PR improves the documentation.
4. [ENHANCEMENT]: if the PR improve and existing functionality.
5. [FEATURE]: if the PR add a new feature.
6. [FIX]: If the PR solve issues, bugs, or unexpected behavior.
7. [MAINTENANCE]: If the PR has to do with CI/CD or setup.
8. [RELEASE]: If the PR is a preparation for a release.
- \[API_CHANGE\]: If there is a change to the project's API.
- \[DEPRECATED\]: If the PR deprecate some functionalities.
- \[DOC\]: If the PR improves the documentation.
- \[ENHANCEMENT\]: if the PR improve and existing functionality.
- \[FEATURE\]: if the PR add a new feature.
- \[FIX\]: If the PR solve issues, bugs, or unexpected behavior.
- \[MAINTENANCE\]: If the PR has to do with CI/CD or setup.
- \[RELEASE\]: If the PR is a preparation for a release.

An example is

```text
[FEATURE] Add method AAA to class BBB
```
3. However, before opening a PR, it is a good practice to have pre-commit installed.
To use the pre-commit hook, you first need to install ``pre-commit`` using the command:

1. However, before opening a PR, it is a good practice to have pre-commit installed.
To use the pre-commit hook, you first need to install `pre-commit` using the command:

```bash
pip install pre-commit
Expand All @@ -40,13 +41,13 @@ If you would like to contribute to the project, please take a moment to read the
pre-commit install
```

You can also run the pre-commit locally by running the following command
You can also run the pre-commit locally by running the following command
from the project's working directory:

```bash
pre-commit run --all-files
```

4. Now your PR is ready for review!
1. Now your PR is ready for review!

Thanks for your contribution ❤️
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Welcome to symmetria

---
______________________________________________________________________

Symmetria provides an intuitive, thorough, and comprehensive framework for interacting
Symmetria provides an intuitive, thorough, and comprehensive framework for interacting
with the symmetric group and its elements.

- 📦 - installable via pip
Expand All @@ -12,14 +12,13 @@ with the symmetric group and its elements.
- ✅ - 100% of test coverage

You can give a look at how to work with symmetria in the section [quickstart](#quickstart),
or you can check (almost) all the functionality implemented
or you can check (almost) all the functionality implemented
[here](#list-of-implemented-functionality).

Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change, and give a look to the
to discuss what you would like to change, and give a look to the
[contribution guidelines](https://github.com/VascoSch92/symmetria/blob/main/CONTRIBUTING.md).


## Installation

Symmetria can be comfortably installed from PyPI using the command
Expand All @@ -34,7 +33,7 @@ or directly from the source GitHub code with
pip install git+https://github.com/VascoSch92/symmetria@xxx
```

where ``xxx`` is the name of the branch or the tag you would like to install.
where `xxx` is the name of the branch or the tag you would like to install.

You can check that `symmetria` was successfully installed by typing the command

Expand All @@ -44,11 +43,11 @@ symmetria --version

## Quickstart

Let's get started with symmetria. First and foremost, we can import the `Permutation`
class from `symmetria`. The Permutation class serves as the fundamental class for
working with elements of the symmetric group, representing permutations as
bijective maps. Additionally, you can utilize the `Cycle` class and `CycleDecomposition`
class to work with cycle permutations and permutations represented as cycle
Let's get started with symmetria. First and foremost, we can import the `Permutation`
class from `symmetria`. The Permutation class serves as the fundamental class for
working with elements of the symmetric group, representing permutations as
bijective maps. Additionally, you can utilize the `Cycle` class and `CycleDecomposition`
class to work with cycle permutations and permutations represented as cycle
decompositions, respectively.

```python
Expand Down Expand Up @@ -76,15 +75,16 @@ if len(permutation) == 6:
print("The permutation acts on 6 elements.")
print(permutation * permutation)
```
Furthermore, we can decompose a permutation into its cycle decomposition

Furthermore, we can decompose a permutation into its cycle decomposition
(`CycleDecomposition`) and compute its order and support.

```python
permuttation.cycle_decomposition()
permuttation.cycle_decomposition()
# returns CycleDecomposition(Cycle(1), Cycle(2, 3, 4, 5), Cycle(6))
permutation.order() # 4
permutation.support() # {2, 3, 4, 5}
permutation.is_derangement() # True
permutation.order() # 4
permutation.support() # {2, 3, 4, 5}
permutation.is_derangement() # True
```

## List of implemented functionality
Expand All @@ -93,7 +93,7 @@ A list of (some) of the functionality implemented for the various classes repres
Here, `P` is for `Permutation`, `C`for `Cycle`, and `CD` for `CycleDecomposition`.

| Feature | Description | P | C | CD |
|-----------------------|---------------------------------------------------------|-----|-----|-----|
| --------------------- | ------------------------------------------------------- | --- | --- | --- |
| `__call__` | Call a permutation on an object | ✅ | ✅ | ✅ |
| `__mul__` | Multiplication (composition) between permutations | ✅ | ❌ | ✅ |
| `cycle_decomposition` | Cycle decomposition of the permutation | ✅ | ✅ | ✅ |
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/tests_cycle/test_generic_method.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from tests.tests_factory import (
from tests.test_factory import (
validate_map,
validate_orbit,
validate_order,
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_cycle/test_magic_methods.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from tests.tests_factory import (
from tests.test_factory import (
validate_eq,
validate_int,
validate_len,
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_cycle_decomposition/test_generic_methods.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from tests.tests_factory import (
from tests.test_factory import (
validate_map,
validate_orbit,
validate_order,
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_cycle_decomposition/test_magic_methods.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from symmetria import Cycle, CycleDecomposition
from tests.tests_factory import (
from tests.test_factory import (
validate_eq,
validate_bool,
validate_call,
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_permutation/test_constructors.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from symmetria import Permutation
from tests.tests_factory import (
from tests.test_factory import (
validate_from_dict,
validate_from_cycle,
validate_from_cycle_decomposition,
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_permutation/test_generic_methods.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from tests.tests_factory import (
from tests.test_factory import (
validate_map,
validate_orbit,
validate_order,
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_permutation/test_magic_methods.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from tests.tests_factory import (
from tests.test_factory import (
validate_eq,
validate_int,
validate_len,
Expand Down
Loading