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

Added CONTRIBUTION.md, changed code style to PEP8, docstring style to… #27

Merged
merged 2 commits into from
Mar 12, 2021
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Byte-compiled / optimized / DLL files
__pycache__/
__pycache__
*.py[cod]
*$py.class


# C extensions
*.so

Expand Down
2 changes: 2 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[MASTER]
disable=broad-except, too-many-locals
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true
}
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- ``CHANGELOG.md`` file with (Keep a Changelog)[https://keepachangelog.com/en/1.0.0/] format.

## [1.1.5] - 2021-03-06
## [1.1.6] - 2021-03-11
### Changes
- Changed code style to [PEP8](https://www.python.org/dev/peps/pep-0008/)
- Changed docstring style to [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html)
- Updated README

## Additions
- Added a CONTRIBUTIONS.md

## Fixes
- Fixed a possible bug. Refer to [#26](https://github.com/Prayag2/konsave/issues/26).

## [1.1.5] - 2021-03-08
### Changes
- Changed `print_msg` to `log`.
- Changed `check_error` function to a decorator (Thanks to (this article)[https://medium.com/swlh/handling-exceptions-in-python-a-cleaner-way-using-decorators-fae22aa0abec]) for easier maintenance.
- Improved logging


## [1.1.4] - 2021-03-07
### Changes
- Created a function called `copy` to replace `shutil.copytree`. This would add support for python versions <= 3.7.
Expand Down
94 changes: 94 additions & 0 deletions CONTRIBUTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Contributing

When contributing to this repository, please first discuss the change you wish to make via issue,
email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

## Pull Request Process

1. Ensure any install or build dependencies are removed before the end of the layer when doing a
build.
2. Update the README.md with details of changes to the interface.
3. Increase the version number in `konsave/vars.py`. The versioning scheme we use is [SemVer](http://semver.org/).
4. Introduced changes should be briefly described in `CHANGELOG.md`.
4. Create a pull request and wait for the response.

## Code Guidelines
1. This project uses the [PEP8](https://www.python.org/dev/peps/pep-0008/) code style. Your code must follow the same before you create a pull request. Your [PyLint](https://www.pylint.org/) score should be 10.00/10. You can use [black formatter](https://github.com/psf/black) to format your code quickly.
2. Every function in your code *must* have a docstring that follows [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html). Use [Darglint](https://github.com/terrencepreilly/darglint) to double check.

## Code of Conduct

### Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

### Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

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

### Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

### Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

### Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at prayagjain2@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

### Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# Konsave (Save Plasma Customization)
A CLI program that will let you save and apply your KDE Plasma customizations with just one command! Also, it has a "K" in the name :D
<h1 align=center> Konsave (Save Plasma Customization) </h1>
<p align=center>A CLI program that will let you save and apply your KDE Plasma customizations with just one command! Also, it has a "K" in the name :D</p>

---

![ezgif-7-e0c7257f0aef](https://user-images.githubusercontent.com/39525869/109611033-a6732c80-7b53-11eb-9ece-ffd9cef49047.gif)
<p align="center">
<img src="https://user-images.githubusercontent.com/39525869/109611033-a6732c80-7b53-11eb-9ece-ffd9cef49047.gif" />
</p>

---
## Dependencies
### PyYaml
`pip install pyyaml`

## Installation
Install from PyPI
Install from PyPI
`python -m pip install konsave`

## Usage
Expand All @@ -36,9 +38,13 @@ You may need to log out and log in to see all the changes.
`konsave -v` or `konsave --version`
### Wipe all profiles
`konsave -w` or `konsave --wipe`

## Uninstall Konsave
To uninstall konsave, run the following:
`python -m pip uninstall konsave`

## Contribution
You can contribute by reporting issues or fixing bugs!
Introduced changes should be briefly described in `CHANGELOG.md`.
Please read [CONTRIBUTION.md](https://github.com/Prayag2/konsave/blob/master/CONTRIBUTION.md) for info about contributing.

## License
This project uses GNU General Public License 3.0
97 changes: 80 additions & 17 deletions konsave/__main__.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,93 @@
"""
This is the main module
"""

## IMPORT ##
import argparse
from konsave.funcs import *
from konsave.vars import VERSION
from konsave.funcs import (
list_profiles,
save_profile,
remove_profile,
apply_profile,
export,
import_profile,
wipe,
)
from konsave.vars import VERSION, list_of_profiles, length_of_lop


## MAIN ##
def main():
"""
The main function that handles all the arguments and options
"""
## PARSER SETTINGS ##
parser = argparse.ArgumentParser(
prog='Konsave',
epilog="Please report bugs at https://www.github.com/prayag2/konsave"
prog="Konsave",
epilog="Please report bugs at https://www.github.com/prayag2/konsave",
)

## ADDING ARGS ##
parser.add_argument('-l', '--list', required=False, action='store_true', help='Lists created profiles')
parser.add_argument('-s', '--save', required=False, type=str, help='Save current config as a profile',
metavar='<name>')
parser.add_argument('-r', '--remove', required=False, type=int, help='Remove the specified profile', metavar='<id>')
parser.add_argument('-a', '--apply', required=False, type=int, help='Apply the specified profile', metavar='<id>')
parser.add_argument('-e', '--export-profile', required=False, type=int,
help='Export a profile and share with your friends!', metavar='<id>')
parser.add_argument('-i', '--import-profile', required=False, type=str, help='Import a konsave file',
metavar='<path>')
parser.add_argument('-f', '--force', required=False, action='store_true', help='Overwrite already saved profiles')
parser.add_argument('-v', '--version', required=False, action='store_true', help='Show version')
parser.add_argument('-w', '--wipe', required=False, action='store_true', help='Wipes all profiles.')
parser.add_argument(
"-l",
"--list",
required=False,
action="store_true",
help="Lists created profiles",
)
parser.add_argument(
"-s",
"--save",
required=False,
type=str,
help="Save current config as a profile",
metavar="<name>",
)
parser.add_argument(
"-r",
"--remove",
required=False,
type=int,
help="Remove the specified profile",
metavar="<id>",
)
parser.add_argument(
"-a",
"--apply",
required=False,
type=int,
help="Apply the specified profile",
metavar="<id>",
)
parser.add_argument(
"-e",
"--export-profile",
required=False,
type=int,
help="Export a profile and share with your friends!",
metavar="<id>",
)
parser.add_argument(
"-i",
"--import-profile",
required=False,
type=str,
help="Import a konsave file",
metavar="<path>",
)
parser.add_argument(
"-f",
"--force",
required=False,
action="store_true",
help="Overwrite already saved profiles",
)
parser.add_argument(
"-v", "--version", required=False, action="store_true", help="Show version"
)
parser.add_argument(
"-w", "--wipe", required=False, action="store_true", help="Wipes all profiles."
)

## PARSING ARGS ##
args = parser.parse_args()
Expand All @@ -51,5 +114,5 @@ def main():


## CALLING MAIN ##
if __name__ == '__main__':
if __name__ == "__main__":
main()
Binary file modified konsave/__pycache__/__main__.cpython-39.pyc
Binary file not shown.
Binary file modified konsave/__pycache__/funcs.cpython-39.pyc
Binary file not shown.
Binary file modified konsave/__pycache__/vars.cpython-39.pyc
Binary file not shown.
Loading