ngpt 1.1.3__tar.gz → 1.1.4__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,116 @@
1
+ # Commit Message Guidelines
2
+
3
+ ## Introduction
4
+
5
+ Consistent and well-formatted commit messages provide a better project history, make it easier to understand changes, facilitate automatic changelog generation, and help identify bugs. These guidelines ensure that our commit messages remain uniform, descriptive, and useful to all project contributors.
6
+
7
+ ## Message Format
8
+
9
+ ```
10
+ type: <brief summary (max 50 chars)>
11
+
12
+ - [type] key change 1 (max 60 chars per line)
13
+ - [type] key change 2
14
+ - [type] key change N (include all significant changes)
15
+ ```
16
+
17
+ ## Best Practices
18
+
19
+ - Use the imperative mood in the subject line (e.g., "Add feature" not "Added feature")
20
+ - Don't end the subject line with a period
21
+ - Start with a capital letter
22
+ - Separate subject from body with a blank line
23
+ - Wrap body text at 72 characters
24
+ - Use the body to explain what and why vs. how
25
+
26
+ ## Atomic Commits
27
+
28
+ Each commit should represent a single logical change:
29
+ - Make focused commits that address a single concern
30
+ - Split work into multiple commits when appropriate
31
+ - Avoid mixing unrelated changes in the same commit
32
+
33
+ ## Issue References
34
+
35
+ Link to issues in your commit messages:
36
+ - Use "Fixes #123" to automatically close an issue
37
+ - Use "Relates to #123" for changes related to but not resolving an issue
38
+ - Always include issue numbers for bug fixes
39
+
40
+ ## Valid Types
41
+
42
+ Choose the most specific type for your changes:
43
+
44
+ - `feat`: New user features (not for new files without user features)
45
+ - `fix`: Bug fixes/corrections to errors
46
+ - `refactor`: Restructured code (no behavior change)
47
+ - `style`: Formatting/whitespace changes
48
+ - `docs`: Documentation only
49
+ - `test`: Test-related changes
50
+ - `perf`: Performance improvements
51
+ - `build`: Build system changes
52
+ - `ci`: CI pipeline changes
53
+ - `chore`: Routine maintenance tasks
54
+ - `revert`: Reverting previous changes
55
+ - `add`: New files/resources with no user-facing features
56
+ - `remove`: Removing files/code
57
+ - `update`: Changes to existing functionality
58
+ - `security`: Security-related changes
59
+ - `i18n`: Internationalization
60
+ - `a11y`: Accessibility improvements
61
+ - `api`: API-related changes
62
+ - `ui`: User interface changes
63
+ - `data`: Database changes
64
+ - `config`: Configuration changes
65
+ - `init`: Initial commit/project setup
66
+
67
+ ## Examples
68
+
69
+ ### Good Examples
70
+
71
+ #### Bug Fix:
72
+ ```
73
+ fix: Address memory leak in data processing pipeline
74
+
75
+ - [fix] Release resources in DataProcessor.cleanUp()
76
+ - [fix] Add null checks to prevent NPE in edge cases
77
+ - [perf] Optimize large dataset handling
78
+
79
+ Fixes #456
80
+ ```
81
+
82
+ #### New Feature:
83
+ ```
84
+ feat: Add user profile export functionality
85
+
86
+ - [feat] Create export button in profile settings
87
+ - [feat] Implement JSON and CSV export options
88
+ - [security] Apply rate limiting to prevent abuse
89
+
90
+ Relates to #789
91
+ ```
92
+
93
+ #### Refactoring:
94
+ ```
95
+ refactor: Simplify authentication flow
96
+
97
+ - [refactor] Extract login logic to separate service
98
+ - [refactor] Reduce complexity in AuthManager
99
+ - [test] Add unit tests for new service
100
+
101
+ Part of #234
102
+ ```
103
+
104
+ ### Poor Example:
105
+ ```
106
+ Made some changes to fix stuff
107
+
108
+ Changed a bunch of files to make the login work better.
109
+ Also fixed that other bug people were complaining about.
110
+ ```
111
+
112
+ ## Additional Resources
113
+
114
+ - [Conventional Commits](https://www.conventionalcommits.org/)
115
+ - [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/)
116
+ - [A Note About Git Commit Messages](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
@@ -0,0 +1,90 @@
1
+ # Contributing to NGPT
2
+
3
+ Thank you for your interest in contributing to NGPT! This document provides guidelines and instructions for contributing to this project.
4
+
5
+ ## Development Setup
6
+
7
+ 1. Fork the repository
8
+ 2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/ngpt.git`
9
+ 3. Navigate to the project directory: `cd ngpt`
10
+ 4. Set up Python environment:
11
+ - It's recommended to use a virtual environment
12
+ - Create a virtual environment: `python -m venv .venv`
13
+ - Activate the virtual environment:
14
+ - Windows: `.venv\Scripts\activate`
15
+ - Unix/MacOS: `source .venv/bin/activate`
16
+ 5. Install dependencies: `pip install -e .`
17
+ 6. Open the project in your preferred code editor
18
+
19
+ ## Code Structure
20
+
21
+ - `ngpt/` - Main package directory
22
+ - `__init__.py` - Package initialization
23
+ - `cli.py` - Command-line interface implementation
24
+ - `config.py` - Configuration management
25
+ - `client.py` - Client implementation
26
+ - `.github/` - GitHub workflows and templates
27
+ - `pyproject.toml` - Project configuration and dependencies
28
+
29
+ ## Code Style Guidelines
30
+
31
+ - Follow PEP 8 style guidelines for Python code
32
+ - Use consistent indentation (4 spaces)
33
+ - Write descriptive docstrings for functions and classes
34
+ - Add type hints where appropriate
35
+ - Add comments for complex logic
36
+
37
+ ## Pull Request Guidelines
38
+
39
+ Before submitting a pull request, please make sure that:
40
+
41
+ - Your code follows the project's coding conventions
42
+ - You have tested your changes thoroughly
43
+ - All existing tests pass (if applicable)
44
+ - The commit messages are clear and follow conventional commit guidelines as specified in [COMMIT_GUIDELINES.md](COMMIT_GUIDELINES.md)
45
+ - You have provided a detailed explanation of the changes in the pull request description
46
+
47
+ ## Submitting Changes
48
+
49
+ 1. Create a new branch: `git checkout -b feature/your-feature-name`
50
+ 2. Make your changes
51
+ 3. Test thoroughly
52
+ 4. Commit with clear messages: `git commit -m "feat: description"`
53
+ 5. Push to your fork: `git push origin feature/your-feature-name`
54
+ 6. Open a Pull Request against the main repository
55
+
56
+ ## Testing
57
+
58
+ Before submitting your changes, please test:
59
+
60
+ - Basic functionality
61
+ - Any new features you've added
62
+ - Any components you've modified
63
+ - Ensure all tests pass if there's a test suite
64
+
65
+ ## Issue Reporting
66
+
67
+ When opening an issue, please:
68
+
69
+ - Use a clear and descriptive title
70
+ - Provide a detailed description of the issue, including the environment and steps to reproduce
71
+ - Include any relevant logs or code snippets
72
+ - Specify your Python version and operating system
73
+ - Search the repository for similar issues before creating a new one
74
+
75
+ ## Feature Requests
76
+
77
+ Feature requests are welcome! To submit a feature request:
78
+
79
+ - Use a clear and descriptive title
80
+ - Provide a detailed description of the proposed feature
81
+ - Explain why this feature would be useful to NGPT users
82
+ - If possible, suggest how it might be implemented
83
+
84
+ ## Questions and Discussions
85
+
86
+ For questions about the project that aren't bugs or feature requests, please use GitHub Discussions instead of opening an issue. This helps keep the issue tracker focused on bugs and features.
87
+
88
+ ## License
89
+
90
+ By contributing to this project, you agree that your contributions will be licensed under the same [LICENSE](LICENSE) as the project.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngpt
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: A lightweight Python CLI and library for interacting with OpenAI-compatible APIs, supporting both official and self-hosted LLM endpoints.
5
5
  Project-URL: Homepage, https://github.com/nazdridoy/ngpt
6
6
  Project-URL: Repository, https://github.com/nazdridoy/ngpt
@@ -48,8 +48,10 @@ A lightweight Python CLI and library for interacting with OpenAI-compatible APIs
48
48
  - [Python Library](#as-a-library)
49
49
  - [Configuration](#configuration)
50
50
  - [Command Line Options](#command-line-options)
51
+ - [Interactive Configuration](#interactive-configuration)
51
52
  - [Configuration File](#configuration-file)
52
53
  - [Configuration Priority](#configuration-priority)
54
+ - [Contributing](#contributing)
53
55
  - [License](#license)
54
56
 
55
57
  ## Quick Start
@@ -191,7 +193,7 @@ You can configure the client using the following options:
191
193
  | `--base-url` | Base URL for the API |
192
194
  | `--model` | Model to use |
193
195
  | `--web-search` | Enable web search capability |
194
- | `--config` | Path to a custom configuration file |
196
+ | `--config` | Path to a custom configuration file or, when used without a value, enters interactive configuration mode |
195
197
  | `--config-index` | Index of the configuration to use (default: 0) |
196
198
  | `--show-config` | Show configuration details and exit |
197
199
  | `--all` | Used with `--show-config` to display all configurations |
@@ -199,6 +201,23 @@ You can configure the client using the following options:
199
201
  | `-c, --code` | Generate clean code output |
200
202
  | `-v, --version` | Show version information |
201
203
 
204
+ ### Interactive Configuration
205
+
206
+ The `--config` option without arguments enters interactive configuration mode, allowing you to add or edit configurations:
207
+
208
+ ```bash
209
+ # Add a new configuration
210
+ ngpt --config
211
+
212
+ # Edit an existing configuration at index 1
213
+ ngpt --config --config-index 1
214
+ ```
215
+
216
+ In interactive mode:
217
+ - When editing an existing configuration, press Enter to keep the current values
218
+ - When creating a new configuration, press Enter to use default values
219
+ - For security, your API key is not displayed when editing configurations
220
+
202
221
  ### Configuration File
203
222
 
204
223
  nGPT uses a configuration file stored in the standard user config directory for your operating system:
@@ -242,6 +261,20 @@ nGPT determines configuration values in the following order (highest priority fi
242
261
  3. Configuration file (selected by `--config-index`, defaults to index 0)
243
262
  4. Default values
244
263
 
264
+ ## Contributing
265
+
266
+ We welcome contributions to nGPT! Whether it's bug fixes, feature additions, or documentation improvements, your help is appreciated.
267
+
268
+ To contribute:
269
+
270
+ 1. Fork the repository
271
+ 2. Create a feature branch: `git checkout -b feature/your-feature-name`
272
+ 3. Make your changes
273
+ 4. Commit with clear messages following conventional commit guidelines
274
+ 5. Push to your fork and submit a pull request
275
+
276
+ Please check the [CONTRIBUTING.md](CONTRIBUTING.md) file for detailed guidelines on code style, pull request process, and development setup.
277
+
245
278
  ## License
246
279
 
247
280
  This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
@@ -15,8 +15,10 @@ A lightweight Python CLI and library for interacting with OpenAI-compatible APIs
15
15
  - [Python Library](#as-a-library)
16
16
  - [Configuration](#configuration)
17
17
  - [Command Line Options](#command-line-options)
18
+ - [Interactive Configuration](#interactive-configuration)
18
19
  - [Configuration File](#configuration-file)
19
20
  - [Configuration Priority](#configuration-priority)
21
+ - [Contributing](#contributing)
20
22
  - [License](#license)
21
23
 
22
24
  ## Quick Start
@@ -158,7 +160,7 @@ You can configure the client using the following options:
158
160
  | `--base-url` | Base URL for the API |
159
161
  | `--model` | Model to use |
160
162
  | `--web-search` | Enable web search capability |
161
- | `--config` | Path to a custom configuration file |
163
+ | `--config` | Path to a custom configuration file or, when used without a value, enters interactive configuration mode |
162
164
  | `--config-index` | Index of the configuration to use (default: 0) |
163
165
  | `--show-config` | Show configuration details and exit |
164
166
  | `--all` | Used with `--show-config` to display all configurations |
@@ -166,6 +168,23 @@ You can configure the client using the following options:
166
168
  | `-c, --code` | Generate clean code output |
167
169
  | `-v, --version` | Show version information |
168
170
 
171
+ ### Interactive Configuration
172
+
173
+ The `--config` option without arguments enters interactive configuration mode, allowing you to add or edit configurations:
174
+
175
+ ```bash
176
+ # Add a new configuration
177
+ ngpt --config
178
+
179
+ # Edit an existing configuration at index 1
180
+ ngpt --config --config-index 1
181
+ ```
182
+
183
+ In interactive mode:
184
+ - When editing an existing configuration, press Enter to keep the current values
185
+ - When creating a new configuration, press Enter to use default values
186
+ - For security, your API key is not displayed when editing configurations
187
+
169
188
  ### Configuration File
170
189
 
171
190
  nGPT uses a configuration file stored in the standard user config directory for your operating system:
@@ -209,6 +228,20 @@ nGPT determines configuration values in the following order (highest priority fi
209
228
  3. Configuration file (selected by `--config-index`, defaults to index 0)
210
229
  4. Default values
211
230
 
231
+ ## Contributing
232
+
233
+ We welcome contributions to nGPT! Whether it's bug fixes, feature additions, or documentation improvements, your help is appreciated.
234
+
235
+ To contribute:
236
+
237
+ 1. Fork the repository
238
+ 2. Create a feature branch: `git checkout -b feature/your-feature-name`
239
+ 3. Make your changes
240
+ 4. Commit with clear messages following conventional commit guidelines
241
+ 5. Push to your fork and submit a pull request
242
+
243
+ Please check the [CONTRIBUTING.md](CONTRIBUTING.md) file for detailed guidelines on code style, pull request process, and development setup.
244
+
212
245
  ## License
213
246
 
214
247
  This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
@@ -10,7 +10,7 @@ class NGPTClient:
10
10
  self,
11
11
  api_key: str = "",
12
12
  base_url: str = "https://api.openai.com/v1/",
13
- provider: str = "OpenAI", # Provider is now just a label, kept for potential future use/logging
13
+ provider: str = "OpenAI",
14
14
  model: str = "gpt-3.5-turbo"
15
15
  ):
16
16
  self.api_key = api_key
@@ -51,23 +51,44 @@ def add_config_entry(config_path: Path, config_index: Optional[int] = None) -> N
51
51
  """Add a new configuration entry or update existing one at the specified index."""
52
52
  configs = load_configs(custom_path=str(config_path))
53
53
 
54
- # Create a new entry based on the default
55
- new_entry = DEFAULT_CONFIG_ENTRY.copy()
54
+ # Determine if we're editing an existing config or creating a new one
55
+ is_existing_config = config_index is not None and config_index < len(configs)
56
+
57
+ # Set up entry based on whether we're editing or creating
58
+ if is_existing_config:
59
+ # Use existing config as the base when editing
60
+ entry = configs[config_index].copy()
61
+ print("Enter configuration details (press Enter to keep current values):")
62
+ else:
63
+ # Use default config as the base when creating new
64
+ entry = DEFAULT_CONFIG_ENTRY.copy()
65
+ print("Enter configuration details (press Enter to use default values):")
56
66
 
57
- # Interactive configuration
58
- print("Enter configuration details (press Enter to use default values):")
59
67
  try:
60
- new_entry["api_key"] = input(f"API Key: ") or new_entry["api_key"]
61
- new_entry["base_url"] = input(f"Base URL [{new_entry['base_url']}]: ") or new_entry["base_url"]
62
- new_entry["provider"] = input(f"Provider [{new_entry['provider']}]: ") or new_entry["provider"]
63
- new_entry["model"] = input(f"Model [{new_entry['model']}]: ") or new_entry["model"]
68
+ # For API key, just show the prompt without the current value for security
69
+ user_input = input(f"API Key: ")
70
+ if user_input:
71
+ entry["api_key"] = user_input
72
+
73
+ # For other fields, show current/default value and keep it if Enter is pressed
74
+ user_input = input(f"Base URL [{entry['base_url']}]: ")
75
+ if user_input:
76
+ entry["base_url"] = user_input
77
+
78
+ user_input = input(f"Provider [{entry['provider']}]: ")
79
+ if user_input:
80
+ entry["provider"] = user_input
81
+
82
+ user_input = input(f"Model [{entry['model']}]: ")
83
+ if user_input:
84
+ entry["model"] = user_input
64
85
 
65
86
  # Add or update the entry
66
- if config_index is not None and config_index < len(configs):
67
- configs[config_index] = new_entry
87
+ if is_existing_config:
88
+ configs[config_index] = entry
68
89
  print(f"Updated configuration at index {config_index}")
69
90
  else:
70
- configs.append(new_entry)
91
+ configs.append(entry)
71
92
  print(f"Added new configuration at index {len(configs)-1}")
72
93
 
73
94
  # Save the updated configs
@@ -128,8 +149,7 @@ def load_config(custom_path: Optional[str] = None, config_index: int = 0) -> Dic
128
149
  # Override with environment variables if they exist
129
150
  env_mapping = {
130
151
  "OPENAI_API_KEY": "api_key",
131
- "OPENAI_BASE_URL": "base_url",
132
- "OPENAI_PROVIDER": "provider",
152
+ "OPENAI_BASE_URL": "base_url",
133
153
  "OPENAI_MODEL": "model"
134
154
  }
135
155
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ngpt"
3
- version = "1.1.3"
3
+ version = "1.1.4"
4
4
  description = "A lightweight Python CLI and library for interacting with OpenAI-compatible APIs, supporting both official and self-hosted LLM endpoints."
5
5
  authors = [
6
6
  {name = "nazDridoy", email = "nazdridoy399@gmail.com"},
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes