@@ -14,8 +14,8 @@ This document provides instructions for setting up the development environment,
14
14
15
15
1 . ** Clone the repository** :
16
16
``` bash
17
- git clone https://github.com/LangbaseInc/langbase-sdk- python
18
- cd langbase-sdk- python
17
+ git clone https://github.com/LangbaseInc/langbase-python-sdk
18
+ cd langbase-python-sdk
19
19
```
20
20
21
21
2 . ** Create and activate a virtual environment** :
@@ -31,8 +31,6 @@ This document provides instructions for setting up the development environment,
31
31
32
32
3 . ** Install development dependencies** :
33
33
``` bash
34
- pip install -e " .[dev]"
35
- # Or
36
34
pip install -r requirements-dev.txt
37
35
```
38
36
@@ -48,12 +46,8 @@ This document provides instructions for setting up the development environment,
48
46
black .
49
47
isort .
50
48
```
51
-
52
- 6 . Run the tests:
53
-
54
- ## Running Tests
55
49
56
- The SDK uses pytest for testing. To run the tests:
50
+ 6 . Run the tests:
57
51
58
52
``` bash
59
53
# Run all tests
@@ -66,19 +60,9 @@ pytest tests/test_langbase.py
66
60
pytest --cov=langbase
67
61
```
68
62
69
- ## Building the Package
70
-
71
- To build the package:
72
-
73
- ``` bash
74
- python -m build
75
- ```
76
-
77
- This will create both source distributions and wheel distributions in the ` dist/ ` directory.
78
63
79
- ## Testing the Package Locally
64
+ ## Running and Testing Examples Locally
80
65
81
- You can test the package locally without publishing to PyPI:
82
66
83
67
``` bash
84
68
# Install in development mode
@@ -88,118 +72,50 @@ pip install -e .
88
72
Then you can run examples:
89
73
90
74
```
91
- ./venv/bin/python examples/pipes/pipes.run.py
92
- ```
93
-
94
- ## Publishing to PyPI
95
-
96
- ### Prerequisites
97
-
98
- - A PyPI account
99
- - twine package (` pip install twine ` )
100
-
101
- ### Steps to Publish
102
-
103
- 1 . ** Make sure your package version is updated** :
104
- - Update the version number in ` langbase/__init__.py `
105
-
106
- 2 . ** Build the package** :
107
- ``` bash
108
- python -m build
109
- ```
110
-
111
- If it doesn't work, try installing the latest version of ` build ` :
112
-
113
- ``` bash
114
- pip install build
115
- ```
116
-
117
- And then run:
118
-
119
- ``` bash
120
- ./venv/bin/python -m build
121
- ```
122
-
123
- 3 . ** Check the package** :
124
- ``` bash
125
- twine check dist/*
126
- ```
127
-
128
- 4 . ** Upload to TestPyPI (optional but recommended)** :
129
- ``` bash
130
- twine upload --repository-url https://test.pypi.org/legacy/ dist/*
131
- ```
132
-
133
- 5 . ** Test the TestPyPI package** :
134
- ``` bash
135
- pip install --index-url https://test.pypi.org/simple/ langbase
136
- ```
137
-
138
- 6 . ** Upload to PyPI** :
139
- ``` bash
140
- twine upload dist/*
141
- ```
142
-
143
- ## Automating Releases with GitHub Actions
144
-
145
- For automated releases, you can use GitHub Actions. Create a workflow file at ` .github/workflows/publish.yml ` with the following content:
146
-
147
- ``` yaml
148
- name : Publish to PyPI
149
-
150
- on :
151
- release :
152
- types : [published]
153
-
154
- jobs :
155
- build-and-publish :
156
- runs-on : ubuntu-latest
157
- steps :
158
- - uses : actions/checkout@v3
159
- - name : Set up Python
160
- uses : actions/setup-python@v4
161
- with :
162
- python-version : ' 3.x'
163
- - name : Install dependencies
164
- run : |
165
- python -m pip install --upgrade pip
166
- pip install build twine
167
- - name : Build and publish
168
- env :
169
- TWINE_USERNAME : ${{ secrets.PYPI_USERNAME }}
170
- TWINE_PASSWORD : ${{ secrets.PYPI_PASSWORD }}
171
- run : |
172
- python -m build
173
- twine upload dist/*
75
+ python examples/pipes/pipes.run.py
174
76
```
175
77
176
78
## Project Structure
177
79
178
80
The project follows this structure:
179
81
180
82
```
181
- langbase-python/
182
- ├── langbase/ # Main package
183
- │ ├── __init__.py # Package initialization
184
- │ ├── langbase.py # Main client implementation
185
- │ ├── request.py # HTTP request handling
186
- │ ├── errors.py # Error classes
187
- │ ├── types.py # Type definitions (not used)
188
- │ └── utils.py # Utility functions
189
- │ └── workflow.py # Workflow implementation
83
+ langbase-python-sdk/
84
+ ├── langbase/ # Main package
85
+ │ ├── __init__.py # Package initialization
86
+ │ ├── errors.py # Error classes
87
+ │ ├── helper.py # Helper functions
88
+ │ ├── langbase.py # Main client implementation
89
+ │ ├── request.py # HTTP request handling
90
+ │ ├── types.py # Type definitions
91
+ │ ├── utils.py # Utility functions
92
+ │ └── workflow.py # Workflow implementation
190
93
├── tests/ # Test package
191
94
│ ├── __init__.py # Test package initialization
192
- │ ├── test_client.py # Tests for the client
193
- │ ├── test_request.py # Tests for request handling
95
+ │ ├── conftest.py # Test configuration
194
96
│ ├── test_errors.py # Tests for error classes
195
- │ └── test_utils.py # Tests for utility functions
97
+ │ ├── test_langbase_client.py # Tests for the client
98
+ │ ├── test_memories.py # Tests for memory functionality
99
+ │ ├── test_pipes.py # Tests for pipes
100
+ │ ├── test_threads.py # Tests for threads
101
+ │ ├── test_tools.py # Tests for tools
102
+ │ ├── test_utilities.py # Tests for utility functions
196
103
│ └── test_workflow.py # Tests for workflow
197
104
├── examples/ # Example scripts
198
- ├── setup.py # Package setup script
105
+ │ ├── agent/ # Agent examples
106
+ │ ├── chunker/ # Chunker examples
107
+ │ ├── embed/ # Embed examples
108
+ │ ├── memory/ # Memory examples
109
+ │ ├── parser/ # Parser examples
110
+ │ ├── pipes/ # Pipe examples
111
+ │ ├── threads/ # Thread examples
112
+ │ ├── tools/ # Tool examples
113
+ │ └── workflow/ # Workflow examples
199
114
├── pyproject.toml # Project configuration
200
115
├── requirements.txt # Package dependencies
201
116
├── requirements-dev.txt # Development dependencies
202
- ├── LICENSE # MIT license
117
+ ├── LICENCE # MIT license
118
+ ├── CONTRIBUTION.md # Contribution guidelines
203
119
└── README.md # Main documentation
204
120
```
205
121
@@ -212,28 +128,3 @@ Contributions are welcome! Please feel free to submit a Pull Request.
212
128
3 . Commit your changes (` git commit -m 'Add some amazing feature' ` )
213
129
4 . Push to the branch (` git push origin feature/amazing-feature ` )
214
130
5 . Open a Pull Request
215
-
216
- ## Troubleshooting
217
-
218
- ### Common Issues
219
-
220
- 1 . ** Package not found after installation** :
221
- - Make sure your virtual environment is activated
222
- - Try running ` pip list ` to confirm installation
223
-
224
- 2 . ** Build errors** :
225
- - Make sure you have the latest ` build ` package: ` pip install --upgrade build `
226
- - Check for syntax errors in your code
227
-
228
- 3 . ** Test failures** :
229
- - Run specific failing tests to get more details
230
- - Check for API key issues if integration tests are failing
231
-
232
- ### Getting Help
233
-
234
- If you encounter issues not covered here, please open an issue on GitHub with detailed information about the problem, including:
235
-
236
- - Your Python version
237
- - Your operating system
238
- - Any error messages
239
- - Steps to reproduce the issue
0 commit comments