-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
636 additions
and
107 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
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,46 +1,46 @@ | ||
[build-system] | ||
requires = ["setuptools>=42", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "claudesync" | ||
version = "0.3.7" | ||
authors = [ | ||
{name = "Jahziah Wagner", email = "[email protected]"}, | ||
] | ||
description = "A tool to synchronize local files with Claude.ai projects" | ||
license = {file = "LICENSE"} | ||
readme = "README.md" | ||
requires-python = ">=3.7" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
] | ||
dependencies = [ | ||
"Click", | ||
"requests", | ||
"pathspec", | ||
"crontab", | ||
"setuptools", | ||
"pytest", | ||
"pytest-cov", | ||
"click_completion", | ||
] | ||
|
||
[project.urls] | ||
"Homepage" = "https://github.com/jahwag/claudesync" | ||
"Bug Tracker" = "https://github.com/jahwag/claudesync/issues" | ||
|
||
[project.scripts] | ||
claudesync = "claudesync.cli.main:cli" | ||
|
||
[tool.setuptools.packages.find] | ||
where = ["src"] | ||
include = ["claudesync*"] | ||
|
||
|
||
[tool.pytest.ini_options] | ||
testpaths = ["tests"] | ||
python_files = "test_*.py" | ||
addopts = "-v --cov=claudesync --cov-report=term-missing" | ||
[build-system] | ||
requires = ["setuptools>=42", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "claudesync" | ||
version = "0.3.8" | ||
authors = [ | ||
{name = "Jahziah Wagner", email = "[email protected]"}, | ||
] | ||
description = "A tool to synchronize local files with Claude.ai projects" | ||
license = {file = "LICENSE"} | ||
readme = "README.md" | ||
requires-python = ">=3.7" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
] | ||
dependencies = [ | ||
"Click", | ||
"requests", | ||
"pathspec", | ||
"crontab", | ||
"setuptools", | ||
"pytest", | ||
"pytest-cov", | ||
"click_completion", | ||
] | ||
|
||
[project.urls] | ||
"Homepage" = "https://github.com/jahwag/claudesync" | ||
"Bug Tracker" = "https://github.com/jahwag/claudesync/issues" | ||
|
||
[project.scripts] | ||
claudesync = "claudesync.cli.main:cli" | ||
|
||
[tool.setuptools.packages.find] | ||
where = ["src"] | ||
include = ["claudesync*"] | ||
|
||
|
||
[tool.pytest.ini_options] | ||
testpaths = ["tests"] | ||
python_files = "test_*.py" | ||
addopts = "-v --cov=claudesync --cov-report=term-missing" |
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,41 +1,43 @@ | ||
# src/claudesync/provider_factory.py | ||
|
||
from .providers.base_provider import BaseProvider | ||
from .providers.claude_ai import ClaudeAIProvider | ||
|
||
|
||
def get_provider(provider_name=None, session_key=None) -> BaseProvider: | ||
""" | ||
Retrieve an instance of a provider class based on the provider name and session key. | ||
This function serves as a factory to instantiate provider classes. It maintains a registry of available | ||
providers. If a provider name is not specified, it returns a list of available provider names. If a provider | ||
name is specified but not found in the registry, it raises a ValueError. If a session key is provided, it | ||
is passed to the provider class constructor. | ||
Args: | ||
provider_name (str, optional): The name of the provider to retrieve. If None, returns a list of available | ||
provider names. | ||
session_key (str, optional): The session key to be used by the provider for authentication. | ||
Defaults to None. | ||
Returns: | ||
BaseProvider: An instance of the requested provider class if both provider_name and session_key are provided. | ||
list: A list of available provider names if provider_name is None. | ||
Raises: | ||
ValueError: If the specified provider_name is not found in the registry of providers. | ||
""" | ||
providers = { | ||
"claude.ai": ClaudeAIProvider, | ||
# Add other providers here as they are implemented | ||
} | ||
|
||
if provider_name is None: | ||
return list(providers.keys()) | ||
|
||
provider_class = providers.get(provider_name) | ||
if provider_class is None: | ||
raise ValueError(f"Unsupported provider: {provider_name}") | ||
|
||
return provider_class(session_key) if session_key else provider_class() | ||
# src/claudesync/provider_factory.py | ||
|
||
from .providers.base_provider import BaseProvider | ||
from .providers.claude_ai import ClaudeAIProvider | ||
from .providers.claude_ai_curl import ClaudeAICurlProvider | ||
|
||
|
||
def get_provider(provider_name=None, session_key=None) -> BaseProvider: | ||
""" | ||
Retrieve an instance of a provider class based on the provider name and session key. | ||
This function serves as a factory to instantiate provider classes. It maintains a registry of available | ||
providers. If a provider name is not specified, it returns a list of available provider names. If a provider | ||
name is specified but not found in the registry, it raises a ValueError. If a session key is provided, it | ||
is passed to the provider class constructor. | ||
Args: | ||
provider_name (str, optional): The name of the provider to retrieve. If None, returns a list of available | ||
provider names. | ||
session_key (str, optional): The session key to be used by the provider for authentication. | ||
Defaults to None. | ||
Returns: | ||
BaseProvider: An instance of the requested provider class if both provider_name and session_key are provided. | ||
list: A list of available provider names if provider_name is None. | ||
Raises: | ||
ValueError: If the specified provider_name is not found in the registry of providers. | ||
""" | ||
providers = { | ||
"claude.ai": ClaudeAIProvider, | ||
"claude.ai-curl": ClaudeAICurlProvider, | ||
# Add other providers here as they are implemented | ||
} | ||
|
||
if provider_name is None: | ||
return list(providers.keys()) | ||
|
||
provider_class = providers.get(provider_name) | ||
if provider_class is None: | ||
raise ValueError(f"Unsupported provider: {provider_name}") | ||
|
||
return provider_class(session_key) if session_key else provider_class() |
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
Oops, something went wrong.