langchain-opentutorial 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.1
2
+ Name: langchain_opentutorial
3
+ Version: 0.0.1
4
+ Summary: LangChain-OpenTutorial(https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial) Packages
5
+ Home-page: https://github.com/LangChain-OpenTutorial/langchain-opentutorial-pypi
6
+ Author: LangChain-OpenTutorial
7
+ Author-email: langchain.opentutorial@gmail.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
@@ -0,0 +1,36 @@
1
+ # LangChain-OpenTutorial PyPi
2
+ - This is a package for LangChain-OpenTutorial.
3
+
4
+ ## Package File Creation
5
+ 1. Install Dependency Packages (First Time Only)
6
+ - Ensure that `setuptools` and `wheel` are up-to-date.
7
+ ```bash
8
+ pip install --upgrade setuptools wheel
9
+ ```
10
+
11
+ 2. Create Package
12
+ - Move to the project root directory in the terminal and execute the following command:
13
+ ```bash
14
+ python setup.py sdist bdist_wheel
15
+ ```
16
+ - This command generates distribution-ready package files (.tar.gz and .whl) in the `dist/` directory.
17
+
18
+ 3. Test Package Installation
19
+ - Install the generated package locally for testing.
20
+ ```bash
21
+ pip install dist/mypackage-0.1.0-py3-none-any.whl
22
+ ```
23
+ - After local testing, upload the package to PyPI using `twine`.
24
+
25
+ 4. Install `twine`
26
+ - Install `twine` to upload the package to PyPI.
27
+ ```bash
28
+ pip install twine
29
+ ```
30
+
31
+ 5. Upload to PyPI
32
+ - Use `twine` to upload the package to PyPI.
33
+ ```bash
34
+ twine upload dist/*
35
+ ```
36
+ - A PyPI account is required, and login credentials will be needed.
@@ -0,0 +1,5 @@
1
+ from .env import set_env
2
+ from .package import install
3
+
4
+ __version__ = "0.0.1"
5
+ __all__ = ["set_env", "install"]
@@ -0,0 +1,12 @@
1
+ import os
2
+
3
+ def set_env(config: dict):
4
+ """
5
+ Set environment variables for the langchain_opentutorial package.
6
+
7
+ Args:
8
+ config (dict): A dictionary containing key-value pairs for configuration.
9
+ """
10
+ for key, value in config.items():
11
+ os.environ[key] = str(value)
12
+ print("Environment variables have been set successfully.")
@@ -0,0 +1,159 @@
1
+ # langchain_opentutorial/package.py
2
+ import subprocess
3
+ import sys
4
+ from enum import Enum
5
+ from typing import Optional
6
+
7
+ class ReleaseType(Enum):
8
+ """Enum class defining release types."""
9
+ STABLE = "stable"
10
+ NIGHTLY = "nightly"
11
+
12
+ def get_environment_key() -> str:
13
+ """
14
+ Returns a unique key combining the current environment's OS and Python version.
15
+ """
16
+ platform_map = {
17
+ 'win32': 'windows',
18
+ 'darwin': 'mac',
19
+ 'linux': 'linux'
20
+ }
21
+ os_name = platform_map.get(sys.platform, 'unknown')
22
+ python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
23
+ return f"{os_name}-py{python_version}"
24
+
25
+ class PackageVersions:
26
+ """Class for managing package version information."""
27
+ # Dictionary containing version information for different environments and release types
28
+ VERSIONS = {
29
+ 'windows-py3.12': {
30
+ "stable": {
31
+ "langchain":"0.3.13",
32
+ "langchain-community":"0.3.13",
33
+ "langchain-core":"0.3.27",
34
+ "langchain-openai":"0.2.13",
35
+ "langchain-text-splitters":"0.3.4",
36
+ "langsmith":"0.2.4"
37
+ },
38
+ "nightly": {
39
+ "langchain":"0.3.13",
40
+ "langchain-community":"0.3.13",
41
+ "langchain-core":"0.3.27",
42
+ "langchain-openai":"0.2.13",
43
+ "langchain-text-splitters":"0.3.4",
44
+ "langsmith":"0.2.4"
45
+ },
46
+ "2024-12-19": {
47
+ "langchain":"0.3.13",
48
+ "langchain-community":"0.3.13",
49
+ "langchain-core":"0.3.27",
50
+ "langchain-openai":"0.2.13",
51
+ "langchain-text-splitters":"0.3.4",
52
+ "langsmith":"0.2.4"
53
+ },
54
+ },
55
+ # 'mac-py3.9': {
56
+ # "stable": {
57
+ # 'langchain-core': '0.0.0',
58
+ # 'langchain-openai': '0.0.0',
59
+ # },
60
+ # "nightly": {
61
+ # 'langchain-core': '0.0.0',
62
+ # 'langchain-openai': '0.0.0',
63
+ # },
64
+ # "2024-12-19": {
65
+ # 'langchain-core': '0.0.0',
66
+ # 'langchain-openai': '0.0.0',
67
+ # },
68
+ # },
69
+ # 'linux-py3.9': {
70
+ # "stable": {
71
+ # 'langchain-core': '0.0.0',
72
+ # 'langchain-openai': '0.0.0',
73
+ # },
74
+ # "nightly": {
75
+ # 'langchain-core': '0.0.0',
76
+ # 'langchain-openai': '0.0.0',
77
+ # },
78
+ # "2024-12-19": {
79
+ # 'langchain-core': '0.0.0',
80
+ # 'langchain-openai': '0.0.0',
81
+ # },
82
+ # }
83
+ }
84
+
85
+ @classmethod
86
+ def get_version(cls, package: str, env_key: str,
87
+ release_type_or_date: Optional[str] = None) -> Optional[str]:
88
+ """
89
+ Returns the package version for a specific date or release type.
90
+ If release_type_or_date is None, returns the stable version by default.
91
+ If it's a date format, returns the version for that date.
92
+ """
93
+ if release_type_or_date:
94
+ # Check if it's a date format
95
+ if release_type_or_date in cls.VERSIONS[env_key]:
96
+ return cls.VERSIONS[env_key][release_type_or_date].get(package)
97
+ else:
98
+ # Consider it as release_type
99
+ release_versions = cls.VERSIONS[env_key].get(release_type_or_date, {})
100
+ return release_versions.get(package)
101
+ else:
102
+ # Return stable by default
103
+ release_versions = cls.VERSIONS[env_key].get(ReleaseType.STABLE.value, {})
104
+ return release_versions.get(package)
105
+
106
+ def install(packages: list, verbose: bool = True, upgrade: bool = False,
107
+ release_type_or_date: Optional[str] = ReleaseType.STABLE.value) -> None:
108
+ """
109
+ Installs specific versions of Python packages based on environment and release type.
110
+
111
+ Args:
112
+ packages (list): List of package names to install.
113
+ verbose (bool): Whether to output installation messages.
114
+ upgrade (bool): Whether to upgrade the packages.
115
+ release_type_or_date (str, optional): Release type (stable or nightly) or specific date (format: YYYY-MM-DD).
116
+ """
117
+ # Validate input parameters
118
+ if not isinstance(packages, list):
119
+ raise ValueError("Packages must be provided as a list.")
120
+ if not packages:
121
+ print("No packages to install.")
122
+ return
123
+
124
+ try:
125
+ # Get environment key and prepare installation
126
+ env_key = get_environment_key()
127
+ if verbose:
128
+ print(f"Current environment: {env_key}")
129
+ print(f"Release type or date: {release_type_or_date}")
130
+ print(f"Installing packages: {', '.join(packages)}...")
131
+
132
+ # Prepare pip command
133
+ cmd = [sys.executable, "-m", "pip", "install"]
134
+ if upgrade:
135
+ cmd.append("--upgrade")
136
+
137
+ # Get versioned package strings
138
+ versioned_packages = []
139
+ for package in packages:
140
+ version = PackageVersions.get_version(
141
+ package, env_key, release_type_or_date
142
+ )
143
+ if version:
144
+ versioned_packages.append(f"{package}=={version}")
145
+ else:
146
+ versioned_packages.append(package)
147
+ if verbose:
148
+ print(f"Warning: No specific version found for {package}, using latest")
149
+
150
+ # Execute pip install command
151
+ cmd.extend(versioned_packages)
152
+ subprocess.check_call(cmd, stdout=subprocess.DEVNULL if not verbose else None)
153
+
154
+ if verbose:
155
+ print(f"Successfully installed: {', '.join(versioned_packages)}")
156
+ except subprocess.CalledProcessError as e:
157
+ if verbose:
158
+ print(f"Failed to install packages: {', '.join(packages)}")
159
+ print(f"Error: {e}")
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.1
2
+ Name: langchain_opentutorial
3
+ Version: 0.0.1
4
+ Summary: LangChain-OpenTutorial(https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial) Packages
5
+ Home-page: https://github.com/LangChain-OpenTutorial/langchain-opentutorial-pypi
6
+ Author: LangChain-OpenTutorial
7
+ Author-email: langchain.opentutorial@gmail.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
@@ -0,0 +1,9 @@
1
+ README.md
2
+ setup.py
3
+ langchain_opentutorial/__init__.py
4
+ langchain_opentutorial/env.py
5
+ langchain_opentutorial/package.py
6
+ langchain_opentutorial.egg-info/PKG-INFO
7
+ langchain_opentutorial.egg-info/SOURCES.txt
8
+ langchain_opentutorial.egg-info/dependency_links.txt
9
+ langchain_opentutorial.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ langchain_opentutorial
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,30 @@
1
+ import re
2
+ from pathlib import Path
3
+ from setuptools import find_packages, setup
4
+
5
+ # 패키지의 __init__.py 파일에서 __version__을 추출
6
+ def get_version():
7
+ init_file = Path(__file__).parent / "langchain_opentutorial" / "__init__.py"
8
+ with init_file.open() as f:
9
+ for line in f:
10
+ match = re.match(r"^__version__ = ['\"]([^'\"]+)['\"]", line)
11
+ if match:
12
+ return match.group(1)
13
+ raise RuntimeError("Version information not found.")
14
+
15
+ setup(
16
+ name="langchain_opentutorial", # 패키지의 이름
17
+ version=get_version(), # 버전을 __init__.py에서 가져옴
18
+ packages=find_packages(), # 패키지 내의 모든 파이썬 패키지를 자동으로 찾아서 포함
19
+ install_requires=[], # 패키지의 의존성 목록
20
+ description="LangChain-OpenTutorial(https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial) Packages", # 패키지에 대한 간단한 설명
21
+ author="LangChain-OpenTutorial", # 패키지 작성자 이름
22
+ author_email="langchain.opentutorial@gmail.com", # 패키지 작성자 이메일
23
+ url="https://github.com/LangChain-OpenTutorial/langchain-opentutorial-pypi", # 패키지의 홈페이지 URL
24
+ classifiers=[ # 패키지의 메타데이터를 분류하는 태그들
25
+ "Programming Language :: Python :: 3", # 지원하는 파이썬 버전
26
+ "License :: OSI Approved :: MIT License", # 라이선스 종류
27
+ "Operating System :: OS Independent", # 지원하는 운영체제
28
+ ],
29
+ python_requires=">=3.6", # 필요한 최소 파이썬 버전
30
+ )