Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@

### 2. Install onion-config package

> [!WARNING] \
> If you wanted to use **Pydantic-v1**, but if you already installed `pydantic-settings` and `pydantic-core`, remove it before installing **Pydantic-v1**:

```sh
pip uninstall -y pydantic-settings
pip uninstall -y pydantic-core

# Then install with Pydantic-v1:
pip install -U onion-config[pydantic-v1]
```

> [!WARNING] \
> If you wanted to use **Pydantic-v2**, but if you already installed `onion-config` package just by '**`pip install -U onion-config`**' command, and this didn't install `pydantic-settings`. \
> For this case, '**`env_prefix`**' **WILL NOT WORK** for `BaseConfig` or `BaseSettings` without `pydantic-settings`! This is Pydantic-v2's problem, and there could be some other problems. \
> So fix these issues re-install `onion-config` with `pydantic-settings`:

```sh
pip install -U onion-config[pydantic-settings]
```

Choose one of the following methods to install the package **[A ~ F]**:

**A.** [**RECOMMENDED**] Install from **PyPi**
Expand Down
4 changes: 2 additions & 2 deletions docs/scripts/6.build.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This script has the following key features:
- **Checking for required tools**: It verifies if Python and the build package are installed on the system. If tests are not disabled, it also checks if pytest is installed. If uploading is enabled, it checks for the presence of Twine.
- **Command-line argument parsing**: It parses `-c` or `--disable-clean` to disable cleaning the build directories, `-t` or `--disable-test` to disable running tests, `-u` or `--upload` to enable publishing the package, and `-p` or `--production` to switch the package repository from staging (default) to production.
- **Clean operation**: Cleans the build directories before and after building (if enabled). If `-c` or `--disable-clean` is passed, the script will not clean the build directories.
- **Testing operation**: Runs pytest tests if not disabled by `-t` or `--disable-test` flag.
- **Testing operation**: Runs pytest tests if enabled by `-t` or `--test` flag.
- **Build operation**: Builds a Python package using the Python build package.
- **Publishing operation**: Publishes the built package to a PyPi repository using Twine if the `-u` or `--upload` flag is passed. Defaults to the TestPyPi (staging) repository, but can be switched to the production (PyPi) repository using the `-p` or `--production` flag.

Expand All @@ -23,7 +23,7 @@ To execute the build script with the different flags, use the following commands
**Examples**:

- To build without cleaning: `./build.sh -c`
- To build without running tests: `./build.sh -t`
- To build with running tests: `./build.sh -t`
- To build and publish to the staging repository: `./build.sh -u`
- To build and publish to the production repository: `./build.sh -u -p`

Expand Down
5 changes: 3 additions & 2 deletions onion_config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
# warnings.simplefilter("default", RuntimeWarning)
warnings.warn(
"`pydantic-settings` is not installed for Pydantic-v2.\n"
"BEWARE: If you didn't install `pydantic-settings`, `env_prefix` for `BaseConfig` or `BaseSettings` WILL NOT WORK! This is Pydantic-v2's problem.\n"
"If you want to use Pydantic-v1 (recommended), use `pip install onion-config[pydantic-v1]` to install it. But if you already installed `pydantic-settings`, remove it before installing Pydantic-v1: `pip uninstall -y pydantic-settings`.\n"
"BEWARE: If you didn't install `pydantic-settings`, `env_prefix` for `BaseConfig` or `BaseSettings` WILL NOT WORK! This is Pydantic-v2's problem, and there could be some other problems.\n"
"If you want to use Pydantic-v1 (recommended), use `pip install onion-config[pydantic-v1]` to install it.\n"
"But if you already installed `pydantic-settings`, remove it before installing Pydantic-v1: `pip uninstall -y pydantic-settings`.\n"
"If you want to use Pydantic-v2, use `pip install onion-config[pydantic-settings]` to install it.\n",
RuntimeWarning,
)
Expand Down