basebender 0.1.5__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.
Potentially problematic release.
This version of basebender might be problematic. Click here for more details.
- basebender-0.1.5/LICENSE +9 -0
- basebender-0.1.5/PKG-INFO +171 -0
- basebender-0.1.5/README.md +141 -0
- basebender-0.1.5/bin/generate_resources.py +82 -0
- basebender-0.1.5/pyproject.toml +64 -0
- basebender-0.1.5/src/basebender/STRUCTURE.md +13 -0
- basebender-0.1.5/src/basebender/__init__.py +11 -0
- basebender-0.1.5/src/basebender/api/STRUCTURE.md +7 -0
- basebender-0.1.5/src/basebender/api/main.py +273 -0
- basebender-0.1.5/src/basebender/cli.py +249 -0
- basebender-0.1.5/src/basebender/gui/STRUCTURE.md +8 -0
- basebender-0.1.5/src/basebender/gui/__init__.py +3 -0
- basebender-0.1.5/src/basebender/gui/main_window.py +653 -0
- basebender-0.1.5/src/basebender/rebaser/STRUCTURE.md +16 -0
- basebender-0.1.5/src/basebender/rebaser/__init__.py +4 -0
- basebender-0.1.5/src/basebender/rebaser/config_loader.py +291 -0
- basebender-0.1.5/src/basebender/rebaser/digit_set_rebaser.py +333 -0
- basebender-0.1.5/src/basebender/rebaser/digit_sets.py +107 -0
- basebender-0.1.5/src/basebender/rebaser/generated/STRUCTURE.md +10 -0
- basebender-0.1.5/src/basebender/rebaser/generated/__init__.py +0 -0
- basebender-0.1.5/src/basebender/rebaser/generated/app_resources_rc.py +204 -0
- basebender-0.1.5/src/basebender/rebaser/models.py +28 -0
- basebender-0.1.5/src/basebender/rebaser/resources/STRUCTURE.md +12 -0
- basebender-0.1.5/src/basebender/rebaser/resources/app_resources.qrc +8 -0
- basebender-0.1.5/src/basebender/rebaser/resources/data/STRUCTURE.md +7 -0
- basebender-0.1.5/src/basebender/rebaser/resources/data/default_digit_sets.toml +27 -0
- basebender-0.1.5/src/basebender/rebaser/resources/icons/STRUCTURE.md +10 -0
- basebender-0.1.5/src/basebender/rebaser/resources/icons/input.svg +5 -0
- basebender-0.1.5/src/basebender/rebaser/resources/icons/output.svg +4 -0
- basebender-0.1.5/src/basebender/rebaser/resources/icons/source.svg +5 -0
- basebender-0.1.5/src/basebender/rebaser/resources/icons/target.svg +5 -0
basebender-0.1.5/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright 2025 @mexc
|
|
4
|
+
|
|
5
|
+
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:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
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.
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: basebender
|
|
3
|
+
Version: 0.1.5
|
|
4
|
+
Summary: A Python module for rebaseing strings between different digit sets (positional number systems).
|
|
5
|
+
License: MIT License
|
|
6
|
+
|
|
7
|
+
Copyright 2025 @mexc
|
|
8
|
+
|
|
9
|
+
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:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
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.
|
|
14
|
+
Author: by.a.mexc@gmail.com
|
|
15
|
+
Requires-Python: >=3.13,<3.14
|
|
16
|
+
Classifier: License :: Other/Proprietary License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Requires-Dist: fastapi (>=0.115.12,<0.116.0)
|
|
20
|
+
Requires-Dist: platformdirs (>=4.2.0,<5.0.0)
|
|
21
|
+
Requires-Dist: pyside6 (>=6.9.0,<7.0.0)
|
|
22
|
+
Requires-Dist: pytest (>=8.3.5,<9.0.0)
|
|
23
|
+
Requires-Dist: toml (>=0.10.2,<0.11.0)
|
|
24
|
+
Requires-Dist: uvicorn (>=0.34.3,<0.35.0)
|
|
25
|
+
Project-URL: Homepage, https://github.com/meXc/BaseBender
|
|
26
|
+
Project-URL: Issues, https://github.com/meXc/BaseBender/issues
|
|
27
|
+
Project-URL: Repository, https://github.com/meXc/BaseBender.git
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# BaseBender
|
|
31
|
+
|
|
32
|
+
This project provides a Python module for rebaseing strings between different digit sets (positional number systems). It also includes a command-line interface (CLI) for easy usage.
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
## Project Goal
|
|
37
|
+
n
|
|
38
|
+
The primary goal is to provide a flexible and efficient tool for rebaseing numbers between different digit sets.
|
|
39
|
+
|
|
40
|
+
## Features
|
|
41
|
+
|
|
42
|
+
* **Flexible Digit Set Definition**: Define source and target digit sets using simple strings, supporting rebaseing between standard and non-standard positional number systems (e.g., different Unicode symbol sets of varying lengths).
|
|
43
|
+
* **Tiered Configuration for Digit Sets**: Load pre-defined digit sets from package, system, and user-specific TOML configuration files, allowing for easy extension and customization.
|
|
44
|
+
* **Intelligent Digit Set Discovery**: Suggests relevant pre-defined digit sets based on the input string's content, enhancing usability for the GUI.
|
|
45
|
+
* **Dynamic Input Digit Set**: Automatically derives the input digit set from the input string if not explicitly provided. In the GUI, selecting "Derived from Input" from the preset dropdown will populate the input digit set field with the currently derived digit set. When the input digit set field is empty and the input string is not empty, its placeholder text will dynamically display the derived digit set from the input string, along with a visual cue. If both the input string and input digit set field are empty, the default placeholder text will be shown.
|
|
46
|
+
* **Efficient Rebaseing**: Utilizes bit-packing to minimize space during intermediate rebase.
|
|
47
|
+
* **Enhanced Error Handling**: Provides clear and informative error messages across CLI, API, and GUI, with structured error responses for the API.
|
|
48
|
+
* **Command-Line Interface (CLI)**: Rebase strings directly from the terminal with improved help text and error reporting.
|
|
49
|
+
* **Graphical User Interface (GUI)**: An intuitive interface for rebaseing, featuring digit set manipulation, tooltips, and a clear status bar for error messages.
|
|
50
|
+
* **Flexible Rebase Behavior**: Handles empty input strings, empty output digit sets, and single-character output digit sets gracefully.
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
1. **Clone the repository**:
|
|
55
|
+
```bash
|
|
56
|
+
git clone https://github.com/mexc/base-bender.git
|
|
57
|
+
cd base-bender
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
2. **Install Poetry**:
|
|
61
|
+
If you don't have Poetry installed, follow the instructions on its official website: [https://python-poetry.org/docs/#installation](https://python-poetry.org/docs/#installation)
|
|
62
|
+
|
|
63
|
+
3. **Install dependencies using Poetry**:
|
|
64
|
+
```bash
|
|
65
|
+
poetry install
|
|
66
|
+
```
|
|
67
|
+
This will create a virtual environment and install all project dependencies, including `pytest` and `toml`.
|
|
68
|
+
|
|
69
|
+
After installing dependencies, run the update script to generate the GUI asset source files:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
./bin/update
|
|
73
|
+
```
|
|
74
|
+
## Running the Application
|
|
75
|
+
|
|
76
|
+
This project provides several entry points for different interfaces: a command-line interface (CLI), a graphical user interface (GUI), and a web API. You can run them using Poetry scripts:
|
|
77
|
+
|
|
78
|
+
* **Command-Line Interface (CLI)**:
|
|
79
|
+
```bash
|
|
80
|
+
poetry run basebender --help
|
|
81
|
+
```
|
|
82
|
+
This will display the help message for the CLI. For detailed usage examples, refer to [CLI Examples](docs/cli_examples.md).
|
|
83
|
+
|
|
84
|
+
* **Graphical User Interface (GUI)**:
|
|
85
|
+
```bash
|
|
86
|
+
poetry run basebender-gui
|
|
87
|
+
```
|
|
88
|
+
This will launch the desktop application.
|
|
89
|
+
|
|
90
|
+
* **Web API**:
|
|
91
|
+
```bash
|
|
92
|
+
poetry run basebender-api
|
|
93
|
+
```
|
|
94
|
+
This will start the FastAPI server, typically accessible at `http://127.0.0.1:8000`. For detailed API usage examples, refer to [API Examples](docs/api_examples.md).
|
|
95
|
+
|
|
96
|
+
## Configuration
|
|
97
|
+
|
|
98
|
+
The BaseBender supports loading pre-defined digit sets from tiered TOML configuration files. This allows for a flexible and extensible way to manage common digit sets.
|
|
99
|
+
|
|
100
|
+
### Configuration File Locations (in order of precedence: User > System > Package)
|
|
101
|
+
|
|
102
|
+
* **Package Configuration**:
|
|
103
|
+
* Location: `rebaser/resources/data/default_digit_sets.toml` within the installed package.
|
|
104
|
+
* Purpose: Contains a comprehensive set of standard, built-in digit sets (e.g., Binary, Decimal, Hexadecimal, Base64, ASCII Printable).
|
|
105
|
+
* Example content:
|
|
106
|
+
```toml
|
|
107
|
+
[[digit_sets]]
|
|
108
|
+
name = "Binary"
|
|
109
|
+
digits = "01"
|
|
110
|
+
|
|
111
|
+
[[digit_sets]]
|
|
112
|
+
name = "Decimal"
|
|
113
|
+
digits = "0123456789"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
* **System Configuration**:
|
|
117
|
+
* Location (Linux/macOS): `/etc/digit_set_rebaser/digit_sets.toml`
|
|
118
|
+
* Location (Windows): `%PROGRAMDATA%\digit_set_rebaser\digit_sets.toml`
|
|
119
|
+
* Purpose: Allows system administrators to define digit sets available to all users on the system.
|
|
120
|
+
|
|
121
|
+
* **User Configuration**:
|
|
122
|
+
* Location (Linux/macOS): `~/.config/digit_set_rebaser/digit_sets.toml`
|
|
123
|
+
* Location (Windows): `%APPDATA%\digit_set_rebaser\digit_sets.toml`
|
|
124
|
+
* Purpose: Allows individual users to define their own custom digit sets or override system/package defaults.
|
|
125
|
+
|
|
126
|
+
### Adding Custom Digit Sets
|
|
127
|
+
|
|
128
|
+
To add your own custom digit sets, create or edit the `digit_sets.toml` file in your user configuration directory (or system directory for system-wide availability). Follow the TOML format shown in the example above. Digit sets defined in higher precedence tiers will override those with the same `name` in lower tiers.
|
|
129
|
+
|
|
130
|
+
## Usage
|
|
131
|
+
|
|
132
|
+
For detailed CLI usage examples, refer to [CLI Examples](docs/cli_examples.md).
|
|
133
|
+
For detailed API usage examples, refer to [API Examples](docs/api_examples.md).
|
|
134
|
+
|
|
135
|
+
## Running Tests
|
|
136
|
+
|
|
137
|
+
To run the unit tests, use Poetry:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
poetry run pytest
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Project Structure
|
|
144
|
+
|
|
145
|
+
This project is organized into several key directories and files at the root level. For detailed descriptions of files within subdirectories, please refer to their respective `STRUCTURE.md` files:
|
|
146
|
+
|
|
147
|
+
* [bin/](bin/STRUCTURE.md) - Contains utility scripts for project setup and updates.
|
|
148
|
+
* [docs/](docs/STRUCTURE.md) - Houses documentation files, including API and CLI usage examples.
|
|
149
|
+
* [src/](src/STRUCTURE.md) - Contains the core source code for the application, including API, CLI, GUI, and rebaser logic.
|
|
150
|
+
* [tests/](tests/STRUCTURE.md) - Holds unit tests for the project's modules.
|
|
151
|
+
|
|
152
|
+
### Root Level Files:
|
|
153
|
+
|
|
154
|
+
* `.gitattributes`: Configures Git attributes for various paths.
|
|
155
|
+
* `.gitignore`: Specifies intentionally untracked files to ignore.
|
|
156
|
+
* `.pre-commit-config.yaml`: Configuration for pre-commit hooks to enforce code quality.
|
|
157
|
+
* `.pylintrc`: Configuration file for Pylint, a Python static code analysis tool.
|
|
158
|
+
* `CONTRIBUTING.md`: Guidelines for contributing to the project.
|
|
159
|
+
* `LICENSE`: The project's license file (MIT License).
|
|
160
|
+
* `README.md`: The main project README, providing an overview and entry point.
|
|
161
|
+
* `poetry.lock`: Locks the exact versions of project dependencies.
|
|
162
|
+
* `pyproject.toml`: Project metadata and dependencies managed by Poetry.
|
|
163
|
+
|
|
164
|
+
## Contributing
|
|
165
|
+
|
|
166
|
+
Contributions are welcome! Please refer to the [Contribution Guidelines](CONTRIBUTING.md) for more details.
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
171
|
+
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# BaseBender
|
|
2
|
+
|
|
3
|
+
This project provides a Python module for rebaseing strings between different digit sets (positional number systems). It also includes a command-line interface (CLI) for easy usage.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Project Goal
|
|
8
|
+
n
|
|
9
|
+
The primary goal is to provide a flexible and efficient tool for rebaseing numbers between different digit sets.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
* **Flexible Digit Set Definition**: Define source and target digit sets using simple strings, supporting rebaseing between standard and non-standard positional number systems (e.g., different Unicode symbol sets of varying lengths).
|
|
14
|
+
* **Tiered Configuration for Digit Sets**: Load pre-defined digit sets from package, system, and user-specific TOML configuration files, allowing for easy extension and customization.
|
|
15
|
+
* **Intelligent Digit Set Discovery**: Suggests relevant pre-defined digit sets based on the input string's content, enhancing usability for the GUI.
|
|
16
|
+
* **Dynamic Input Digit Set**: Automatically derives the input digit set from the input string if not explicitly provided. In the GUI, selecting "Derived from Input" from the preset dropdown will populate the input digit set field with the currently derived digit set. When the input digit set field is empty and the input string is not empty, its placeholder text will dynamically display the derived digit set from the input string, along with a visual cue. If both the input string and input digit set field are empty, the default placeholder text will be shown.
|
|
17
|
+
* **Efficient Rebaseing**: Utilizes bit-packing to minimize space during intermediate rebase.
|
|
18
|
+
* **Enhanced Error Handling**: Provides clear and informative error messages across CLI, API, and GUI, with structured error responses for the API.
|
|
19
|
+
* **Command-Line Interface (CLI)**: Rebase strings directly from the terminal with improved help text and error reporting.
|
|
20
|
+
* **Graphical User Interface (GUI)**: An intuitive interface for rebaseing, featuring digit set manipulation, tooltips, and a clear status bar for error messages.
|
|
21
|
+
* **Flexible Rebase Behavior**: Handles empty input strings, empty output digit sets, and single-character output digit sets gracefully.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
1. **Clone the repository**:
|
|
26
|
+
```bash
|
|
27
|
+
git clone https://github.com/mexc/base-bender.git
|
|
28
|
+
cd base-bender
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
2. **Install Poetry**:
|
|
32
|
+
If you don't have Poetry installed, follow the instructions on its official website: [https://python-poetry.org/docs/#installation](https://python-poetry.org/docs/#installation)
|
|
33
|
+
|
|
34
|
+
3. **Install dependencies using Poetry**:
|
|
35
|
+
```bash
|
|
36
|
+
poetry install
|
|
37
|
+
```
|
|
38
|
+
This will create a virtual environment and install all project dependencies, including `pytest` and `toml`.
|
|
39
|
+
|
|
40
|
+
After installing dependencies, run the update script to generate the GUI asset source files:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
./bin/update
|
|
44
|
+
```
|
|
45
|
+
## Running the Application
|
|
46
|
+
|
|
47
|
+
This project provides several entry points for different interfaces: a command-line interface (CLI), a graphical user interface (GUI), and a web API. You can run them using Poetry scripts:
|
|
48
|
+
|
|
49
|
+
* **Command-Line Interface (CLI)**:
|
|
50
|
+
```bash
|
|
51
|
+
poetry run basebender --help
|
|
52
|
+
```
|
|
53
|
+
This will display the help message for the CLI. For detailed usage examples, refer to [CLI Examples](docs/cli_examples.md).
|
|
54
|
+
|
|
55
|
+
* **Graphical User Interface (GUI)**:
|
|
56
|
+
```bash
|
|
57
|
+
poetry run basebender-gui
|
|
58
|
+
```
|
|
59
|
+
This will launch the desktop application.
|
|
60
|
+
|
|
61
|
+
* **Web API**:
|
|
62
|
+
```bash
|
|
63
|
+
poetry run basebender-api
|
|
64
|
+
```
|
|
65
|
+
This will start the FastAPI server, typically accessible at `http://127.0.0.1:8000`. For detailed API usage examples, refer to [API Examples](docs/api_examples.md).
|
|
66
|
+
|
|
67
|
+
## Configuration
|
|
68
|
+
|
|
69
|
+
The BaseBender supports loading pre-defined digit sets from tiered TOML configuration files. This allows for a flexible and extensible way to manage common digit sets.
|
|
70
|
+
|
|
71
|
+
### Configuration File Locations (in order of precedence: User > System > Package)
|
|
72
|
+
|
|
73
|
+
* **Package Configuration**:
|
|
74
|
+
* Location: `rebaser/resources/data/default_digit_sets.toml` within the installed package.
|
|
75
|
+
* Purpose: Contains a comprehensive set of standard, built-in digit sets (e.g., Binary, Decimal, Hexadecimal, Base64, ASCII Printable).
|
|
76
|
+
* Example content:
|
|
77
|
+
```toml
|
|
78
|
+
[[digit_sets]]
|
|
79
|
+
name = "Binary"
|
|
80
|
+
digits = "01"
|
|
81
|
+
|
|
82
|
+
[[digit_sets]]
|
|
83
|
+
name = "Decimal"
|
|
84
|
+
digits = "0123456789"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
* **System Configuration**:
|
|
88
|
+
* Location (Linux/macOS): `/etc/digit_set_rebaser/digit_sets.toml`
|
|
89
|
+
* Location (Windows): `%PROGRAMDATA%\digit_set_rebaser\digit_sets.toml`
|
|
90
|
+
* Purpose: Allows system administrators to define digit sets available to all users on the system.
|
|
91
|
+
|
|
92
|
+
* **User Configuration**:
|
|
93
|
+
* Location (Linux/macOS): `~/.config/digit_set_rebaser/digit_sets.toml`
|
|
94
|
+
* Location (Windows): `%APPDATA%\digit_set_rebaser\digit_sets.toml`
|
|
95
|
+
* Purpose: Allows individual users to define their own custom digit sets or override system/package defaults.
|
|
96
|
+
|
|
97
|
+
### Adding Custom Digit Sets
|
|
98
|
+
|
|
99
|
+
To add your own custom digit sets, create or edit the `digit_sets.toml` file in your user configuration directory (or system directory for system-wide availability). Follow the TOML format shown in the example above. Digit sets defined in higher precedence tiers will override those with the same `name` in lower tiers.
|
|
100
|
+
|
|
101
|
+
## Usage
|
|
102
|
+
|
|
103
|
+
For detailed CLI usage examples, refer to [CLI Examples](docs/cli_examples.md).
|
|
104
|
+
For detailed API usage examples, refer to [API Examples](docs/api_examples.md).
|
|
105
|
+
|
|
106
|
+
## Running Tests
|
|
107
|
+
|
|
108
|
+
To run the unit tests, use Poetry:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
poetry run pytest
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Project Structure
|
|
115
|
+
|
|
116
|
+
This project is organized into several key directories and files at the root level. For detailed descriptions of files within subdirectories, please refer to their respective `STRUCTURE.md` files:
|
|
117
|
+
|
|
118
|
+
* [bin/](bin/STRUCTURE.md) - Contains utility scripts for project setup and updates.
|
|
119
|
+
* [docs/](docs/STRUCTURE.md) - Houses documentation files, including API and CLI usage examples.
|
|
120
|
+
* [src/](src/STRUCTURE.md) - Contains the core source code for the application, including API, CLI, GUI, and rebaser logic.
|
|
121
|
+
* [tests/](tests/STRUCTURE.md) - Holds unit tests for the project's modules.
|
|
122
|
+
|
|
123
|
+
### Root Level Files:
|
|
124
|
+
|
|
125
|
+
* `.gitattributes`: Configures Git attributes for various paths.
|
|
126
|
+
* `.gitignore`: Specifies intentionally untracked files to ignore.
|
|
127
|
+
* `.pre-commit-config.yaml`: Configuration for pre-commit hooks to enforce code quality.
|
|
128
|
+
* `.pylintrc`: Configuration file for Pylint, a Python static code analysis tool.
|
|
129
|
+
* `CONTRIBUTING.md`: Guidelines for contributing to the project.
|
|
130
|
+
* `LICENSE`: The project's license file (MIT License).
|
|
131
|
+
* `README.md`: The main project README, providing an overview and entry point.
|
|
132
|
+
* `poetry.lock`: Locks the exact versions of project dependencies.
|
|
133
|
+
* `pyproject.toml`: Project metadata and dependencies managed by Poetry.
|
|
134
|
+
|
|
135
|
+
## Contributing
|
|
136
|
+
|
|
137
|
+
Contributions are welcome! Please refer to the [Contribution Guidelines](CONTRIBUTING.md) for more details.
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
This script generates Python resource files from Qt .qrc files using pyside6-rcc.
|
|
4
|
+
It is intended to be run as part of the project's build process, e.g., by Poetry.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
import subprocess
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def main():
|
|
13
|
+
"""
|
|
14
|
+
Main function to generate application resources.
|
|
15
|
+
|
|
16
|
+
It defines paths, ensures the output directory exists, and then
|
|
17
|
+
executes the pyside6-rcc command to compile the .qrc file into a Python module.
|
|
18
|
+
Handles FileNotFoundError for missing pyside6-rcc and CalledProcessError
|
|
19
|
+
for command execution failures, providing informative error messages.
|
|
20
|
+
"""
|
|
21
|
+
# Define paths relative to the project root.
|
|
22
|
+
# When 'poetry build' executes this script, it runs from the project root.
|
|
23
|
+
qrc_file = "src/basebender/rebaser/resources/app_resources.qrc"
|
|
24
|
+
output_dir = "src/basebender/rebaser/generated"
|
|
25
|
+
output_file = os.path.join(output_dir, "app_resources_rc.py")
|
|
26
|
+
|
|
27
|
+
print(f"Starting resource generation from: {qrc_file}")
|
|
28
|
+
print(f"Output will be saved to: {output_file}")
|
|
29
|
+
|
|
30
|
+
# 1. Ensure the output directory exists
|
|
31
|
+
os.makedirs(output_dir, exist_ok=True)
|
|
32
|
+
|
|
33
|
+
try:
|
|
34
|
+
# 2. Construct the command to run pyside6-rcc
|
|
35
|
+
# We need 'poetry run' here because pyside6-rcc might not be directly in the PATH
|
|
36
|
+
# when this script is executed in certain environments (e.g., GitHub Actions).
|
|
37
|
+
command = ["poetry", "run", "pyside6-rcc", qrc_file, "-o", output_file]
|
|
38
|
+
|
|
39
|
+
print(f"Executing command: {' '.join(command)}")
|
|
40
|
+
|
|
41
|
+
# 3. Run the command using subprocess
|
|
42
|
+
# 'check=True' will raise a CalledProcessError if the command returns a non-zero exit code.
|
|
43
|
+
# 'capture_output=True' captures stdout and stderr.
|
|
44
|
+
# 'text=True' decodes stdout/stderr as text.
|
|
45
|
+
result = subprocess.run(
|
|
46
|
+
command, check=True, capture_output=True, text=True
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
if result.stdout:
|
|
50
|
+
print("pyside6-rcc stdout:")
|
|
51
|
+
print(result.stdout)
|
|
52
|
+
if result.stderr:
|
|
53
|
+
print("pyside6-rcc stderr:")
|
|
54
|
+
print(result.stderr)
|
|
55
|
+
|
|
56
|
+
print(f"Successfully generated {output_file}")
|
|
57
|
+
|
|
58
|
+
except FileNotFoundError:
|
|
59
|
+
print(
|
|
60
|
+
"Error: 'pyside6-rcc' command not found. "
|
|
61
|
+
"Ensure PySide6 is installed in your Poetry environment.",
|
|
62
|
+
file=sys.stderr,
|
|
63
|
+
)
|
|
64
|
+
print("You can install it with: poetry add pyside6", file=sys.stderr)
|
|
65
|
+
sys.exit(1) # Exit with an error code
|
|
66
|
+
except subprocess.CalledProcessError as process_error:
|
|
67
|
+
print(
|
|
68
|
+
f"Error generating resources: Command failed with exit code {process_error.returncode}",
|
|
69
|
+
file=sys.stderr,
|
|
70
|
+
)
|
|
71
|
+
print(f"Command: {' '.join(process_error.cmd)}", file=sys.stderr)
|
|
72
|
+
print(f"Stdout: {process_error.stdout}", file=sys.stderr)
|
|
73
|
+
print(f"Stderr: {process_error.stderr}", file=sys.stderr)
|
|
74
|
+
sys.exit(1) # Exit with an error code
|
|
75
|
+
except Exception as general_error: # pylint: disable=W0718
|
|
76
|
+
# Catching a broad exception here as a final fallback for unexpected issues.
|
|
77
|
+
print(f"An unexpected error occurred: {general_error}", file=sys.stderr)
|
|
78
|
+
sys.exit(1) # Exit with an error code
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
main()
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
[tool.pytest.ini_options]
|
|
2
|
+
pythonpath = ["src/basebender"]
|
|
3
|
+
[project]
|
|
4
|
+
name = "basebender"
|
|
5
|
+
version = "0.1.5"
|
|
6
|
+
description = "A Python module for rebaseing strings between different digit sets (positional number systems)."
|
|
7
|
+
authors = [
|
|
8
|
+
{name = "by.a.mexc@gmail.com"}
|
|
9
|
+
]
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
requires-python = ">=3.13,<3.14"
|
|
13
|
+
dependencies = [
|
|
14
|
+
"pytest (>=8.3.5,<9.0.0)",
|
|
15
|
+
"toml (>=0.10.2,<0.11.0)",
|
|
16
|
+
"platformdirs (>=4.2.0,<5.0.0)",
|
|
17
|
+
"pyside6 (>=6.9.0,<7.0.0)",
|
|
18
|
+
"fastapi (>=0.115.12,<0.116.0)",
|
|
19
|
+
"uvicorn (>=0.34.3,<0.35.0)"
|
|
20
|
+
]
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://github.com/meXc/BaseBender"
|
|
23
|
+
Repository = "https://github.com/meXc/BaseBender.git"
|
|
24
|
+
Issues = "https://github.com/meXc/BaseBender/issues"
|
|
25
|
+
|
|
26
|
+
[tool.poetry]
|
|
27
|
+
|
|
28
|
+
packages = [{ include = "basebender", from = "src" }]
|
|
29
|
+
|
|
30
|
+
include = [
|
|
31
|
+
"src/basebender/rebaser/generated/app_resources_rc.py"
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
[tool.poetry.build]
|
|
36
|
+
script = "bin/generate_resources.py"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
[tool.poetry.scripts]
|
|
40
|
+
basebender = "basebender.cli:main"
|
|
41
|
+
basebender-gui = "basebender.gui.main_window:run_gui"
|
|
42
|
+
basebender-api = "basebender.api.main:start_api"
|
|
43
|
+
|
|
44
|
+
[tool.poetry.group.dev.dependencies]
|
|
45
|
+
pytest = "^8.3.5"
|
|
46
|
+
pylint = "^3.2.5"
|
|
47
|
+
black = "^24.4.2"
|
|
48
|
+
isort = "^5.13.2"
|
|
49
|
+
pre-commit = "^3.7.1"
|
|
50
|
+
twine = "^5.1.1"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
[tool.isort]
|
|
54
|
+
profile = "black"
|
|
55
|
+
|
|
56
|
+
[tool.black]
|
|
57
|
+
line-length = 80
|
|
58
|
+
|
|
59
|
+
[build-system]
|
|
60
|
+
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
61
|
+
build-backend = "poetry.core.masonry.api"
|
|
62
|
+
|
|
63
|
+
[tool.setuptools.packages.find]
|
|
64
|
+
where = ["src"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# `src/` Directory Structure
|
|
2
|
+
|
|
3
|
+
This directory contains the core source code for the application.
|
|
4
|
+
|
|
5
|
+
## Folders:
|
|
6
|
+
|
|
7
|
+
* [`api/`](src/api/STRUCTURE.md): Contains the FastAPI application for the project's API.
|
|
8
|
+
* [`gui/`](src/gui/STRUCTURE.md): Contains the graphical user interface components.
|
|
9
|
+
* [`rebaser/`](src/rebaser/STRUCTURE.md): Contains the core rebase logic and related modules.
|
|
10
|
+
|
|
11
|
+
## Files:
|
|
12
|
+
|
|
13
|
+
* [`cli.py`](src/cli.py): Implements the command-line interface for the application.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Basebender: A Python package. Refer to the documentation for more details."""
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
5
|
+
|
|
6
|
+
VERSION = version(
|
|
7
|
+
"basebender"
|
|
8
|
+
) # <--- Replace "basebender" with your actual package name
|
|
9
|
+
except (PackageNotFoundError, ImportError):
|
|
10
|
+
|
|
11
|
+
VERSION = "0.0.0+unknown"
|