-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from argoyal/9-publish-as-pip-package
restructuring for pip package
- Loading branch information
Showing
23 changed files
with
200 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Publish to PyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- v[0-9]+.[0-9]+.[0-9]+ | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8' | ||
|
||
- name: Extract version from tag | ||
id: extract_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v} | ||
|
||
- name: Write version to file | ||
run: echo "${{ steps.extract_version.outputs.VERSION }}" > VERSION | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install wheel | ||
- name: Build distribution | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,7 @@ __pycache__ | |
.venv | ||
*.zip | ||
.DS_Store | ||
build/ | ||
dist/ | ||
wbck.egg-info | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) [2024] [Arpit Goyal] | ||
|
||
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. |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import os | ||
from setuptools import setup, find_packages | ||
|
||
with open("README.md", "r", encoding = "utf-8") as fh: | ||
long_description = fh.read() | ||
|
||
|
||
def get_version(): | ||
if not os.path.exists("VERSION"): | ||
raise FileNotFoundError("Version file does not exist") | ||
|
||
with open("VERSION", "r") as f: | ||
version = f.read() | ||
|
||
return version | ||
|
||
|
||
setup( | ||
name='wbck', | ||
version=get_version(), | ||
author="Arpit Goyal", | ||
author_email="[email protected]", | ||
description="a command line utility to perform workspace backup", | ||
long_description_content_type="text/markdown", | ||
long_description=long_description, | ||
url="https://github.com/argoyal/wbck.git", | ||
packages=find_packages(), | ||
install_requires=[ | ||
'boto3' | ||
], | ||
entry_points={ | ||
'console_scripts': [ | ||
'wbck = wbck:cli', | ||
] | ||
}, | ||
python_requires=">=3.6", | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
"Operating System :: OS Independent", | ||
"License :: OSI Approved :: MIT License" | ||
] | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,79 @@ | ||
import os | ||
import argparse | ||
from app.runners import backup_data, restore_data, setup_from_template | ||
from app.load_config import is_config_loadable | ||
|
||
|
||
def restore_workspace(args): | ||
is_config_loadable(args.config_path) | ||
restore_data(args.config_path) | ||
|
||
|
||
def backup_workspace(args): | ||
is_config_loadable(args.config_path) | ||
backup_data(args.config_path) | ||
|
||
|
||
def create_new_workspace(args): | ||
setup_from_template(args.name, args.workspace_path, args.config_folder) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser( | ||
description='Application to backup and restore my workspace data using config files' | ||
) | ||
subparsers = parser.add_subparsers(title="Commands") | ||
|
||
create_parser = subparsers.add_parser( | ||
"create", | ||
help="creates a new workspace" | ||
) | ||
create_parser.add_argument( | ||
"--name", | ||
required=True, | ||
help="name of the new workspace" | ||
) | ||
create_parser.add_argument( | ||
"--workspace-path", | ||
default=os.path.expanduser("~"), | ||
help="path where the workspace needs to be created" | ||
) | ||
create_parser.add_argument( | ||
"--config-folder", | ||
required=True, | ||
help="path where the config for this workspace is" | ||
) | ||
create_parser.set_defaults(func=create_new_workspace) | ||
|
||
backup_parser = subparsers.add_parser( | ||
"backup", | ||
help="commands pertaining to backup of your workspaces" | ||
) | ||
backup_parser.add_argument( | ||
"--config-path", | ||
required=True, | ||
help="path where the config for this workspace is" | ||
) | ||
backup_parser.set_defaults(func=backup_workspace) | ||
|
||
restore_parser = subparsers.add_parser( | ||
"restore", | ||
help="commands pertaining to restore of your workspaces" | ||
) | ||
restore_parser.add_argument( | ||
"--config-path", | ||
required=True, | ||
help="path where the config for this workspace is" | ||
) | ||
restore_parser.set_defaults(func=restore_workspace) | ||
|
||
args = parser.parse_args() | ||
args.func(args) | ||
import os | ||
import argparse | ||
from .runners import backup_data, restore_data, setup_from_template | ||
from .load_config import is_config_loadable | ||
|
||
|
||
def restore_workspace(args): | ||
is_config_loadable(args.config_path) | ||
restore_data(args.config_path) | ||
|
||
|
||
def backup_workspace(args): | ||
is_config_loadable(args.config_path) | ||
backup_data(args.config_path) | ||
|
||
|
||
def create_new_workspace(args): | ||
setup_from_template(args.name, args.workspace_path, args.config_folder) | ||
|
||
|
||
def cli(): | ||
""" | ||
defines the entire cli parsing components of wbck | ||
""" | ||
|
||
parser = argparse.ArgumentParser( | ||
description='Application to backup and restore my workspace data using config files' | ||
) | ||
subparsers = parser.add_subparsers(title="Commands") | ||
|
||
create_parser = subparsers.add_parser( | ||
"create", | ||
help="creates a new workspace" | ||
) | ||
create_parser.add_argument( | ||
"--name", | ||
required=True, | ||
help="name of the new workspace" | ||
) | ||
create_parser.add_argument( | ||
"--workspace-path", | ||
default=os.path.expanduser("~"), | ||
help="path where the workspace needs to be created" | ||
) | ||
create_parser.add_argument( | ||
"--config-folder", | ||
required=True, | ||
help="path where the config for this workspace is" | ||
) | ||
create_parser.set_defaults(func=create_new_workspace) | ||
|
||
backup_parser = subparsers.add_parser( | ||
"backup", | ||
help="commands pertaining to backup of your workspaces" | ||
) | ||
backup_parser.add_argument( | ||
"--config-path", | ||
required=True, | ||
help="path where the config for this workspace is" | ||
) | ||
backup_parser.set_defaults(func=backup_workspace) | ||
|
||
restore_parser = subparsers.add_parser( | ||
"restore", | ||
help="commands pertaining to restore of your workspaces" | ||
) | ||
restore_parser.add_argument( | ||
"--config-path", | ||
required=True, | ||
help="path where the config for this workspace is" | ||
) | ||
restore_parser.set_defaults(func=restore_workspace) | ||
|
||
args = parser.parse_args() | ||
args.func(args) | ||
|
||
|
||
if __name__ == "__main__": | ||
cli() |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from .base import BaseSource | ||
from .aws import AwsSource | ||
from .local import LocalSource | ||
|
||
|
||
__all__ = [ | ||
"BaseSource", | ||
"LocalSource", | ||
"AwsSource" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.