Skip to content
Draft
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
6 changes: 3 additions & 3 deletions .github/workflows/build-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install --no-deps -r requirements.txt
pip install -r requirements.txt --no-cache-dir
pip install uv
uv pip sync --system --no-build pylock.toml
uv pip install --system -e .

- name: Build Binary (Linux)
if: runner.os == 'Linux'
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/build-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install --no-deps -r requirements.txt
pip install -r requirements.txt --no-cache-dir
pip install uv
uv pip sync --system --no-build pylock.toml
uv pip install --system -e .
- name: Update CDISC standards cache
env:
CDISC_LIBRARY_API_KEY: ${{ secrets.CDISC_LIBRARY_API_KEY }}
Expand Down Expand Up @@ -73,9 +73,9 @@ jobs:
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install setuptools wheel twine
# pip install --no-deps -r requirements.txt
# pip install -r requirements.txt --no-cache-dir
# pip install uv
# uv pip sync --system pylock.toml
# uv pip install --system -e .
# - name: Update CDISC standards cache
# env:
# CDISC_LIBRARY_API_KEY: ${{ secrets.CDISC_LIBRARY_API_KEY }}
Expand Down Expand Up @@ -117,9 +117,9 @@ jobs:
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install setuptools wheel twine
# pip install --no-deps -r requirements.txt
# pip install -r requirements.txt --no-cache-dir
# pip install uv
# uv pip sync --system pylock.toml
# uv pip install --system -e .
# - name: Update CDISC standards cache
# env:
# CDISC_LIBRARY_API_KEY: ${{ secrets.CDISC_LIBRARY_API_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
python-version: "3.12"
- name: Install linters
run: |
pip install black flake8 -c requirements-dev.txt
pip install black flake8
- name: Run flake8
run: |
flake8 ${{needs.get_changed_files.outputs.py}} --count --select=E9,F63,F7,F82 --show-source --statistics
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/prerelease-update-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ jobs:
python-version: "3.12"

- name: Install requirements
run: pip install -r requirements.txt
run: |
pip install uv
uv pip sync --system --no-build pylock.toml
pip install -e .

- name: Run Update Cache Script
run: python core.py update-cache
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build setuptools wheel twine
pip install -r requirements.txt
pip install uv build twine
uv pip sync --system --no-build pylock.toml
uv pip install --system -e .
- name: Build package
run: |
python -m build
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build setuptools wheel twine
pip install -r requirements.txt
pip install uv build twine
uv pip sync --system --no-build pylock.toml
uv pip install --system -e .


- name: Build package
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ jobs:
python-version: "3.12"
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install uv
uv pip sync --system --no-build pylock.toml
uv pip install --system -e .
- name: Update rules cache
env:
CDISC_LIBRARY_API_KEY: ${{ secrets.CDISC_LIBRARY_API_KEY }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ jobs:
python-version: "3.12"
- name: Install requirements
run: |
pip install -r requirements-dev.txt
pip install -e .
pip install uv
uv pip sync --system --no-build pylock.dev.toml
uv pip install --system -e .
- name: Running Tests
env:
CDISC_LIBRARY_API_KEY: fakekey12341234
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/validate-published-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ jobs:
- name: Install engine dependencies
run: |
python -m venv venv
./venv/bin/pip install --upgrade pip
./venv/bin/pip install -r engine/requirements.txt

venv/bin/pip install uv
venv/bin/uv pip sync --no-build pylock.dev.toml
venv/bin/uv pip install -e .
# -----------------------------------------------------------------------
# 5. Run validation for every Published rule
# -----------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def build(self):
data_contents_with_vlm["variable_value_length"] = data_contents_with_vlm.data[
["variable_value", "define_vlm_data_type"]
].apply(
lambda row: self.calculate_variable_value_length(
lambda row: ValuesDatasetBuilder.calculate_variable_value_length(
row["variable_value"], row["define_vlm_data_type"]
),
axis=1,
Expand Down
4 changes: 4 additions & 0 deletions cdisc_rules_engine/operations/codelist_extensible.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def _handle_multiple_versions(self) -> pd.Series:
"codelist_code": "string",
}
)
cast_cols = {self.params.ct_version: str}
if self.params.codelist_code in self.evaluation_dataset.columns:
cast_cols[self.params.codelist_code] = str
self.evaluation_dataset = self.evaluation_dataset.astype(cast_cols)
if self.params.codelist_code in self.evaluation_dataset.columns:
is_extensible = self.evaluation_dataset.merge(
ct_df.data,
Expand Down
8 changes: 6 additions & 2 deletions cdisc_rules_engine/operations/codelist_terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ def _handle_multiple_versions(self) -> pd.Series:
ct_df = self.evaluation_dataset.__class__.from_dict(ct_data)
ct_df = ct_df.astype(
{
"version": "string",
"codelist_code": "string",
"version": str,
"codelist_code": str,
}
)
cast_cols = {self.params.ct_version: "string"}
if self.params.codelist_code in self.evaluation_dataset.columns:
cast_cols[self.params.codelist_code] = "string"
self.evaluation_dataset = self.evaluation_dataset.astype(cast_cols)
if self.params.codelist_code in self.evaluation_dataset.columns:
result = self.evaluation_dataset.merge(
ct_df.data,
Expand Down
2 changes: 1 addition & 1 deletion cdisc_rules_engine/services/data_readers/csv_reader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import tempfile

from dask.dataframe import dd
import dask.dataframe as dd

from cdisc_rules_engine.exceptions.custom_exceptions import InvalidCSVFile
from cdisc_rules_engine.interfaces import DataReaderInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ def __read_node_metadata(
}

@staticmethod
def __get_full_path(node: DatumInContext):
return f"{node.full_path}".replace(".[", "[")
def __get_full_path(node: DatumInContext) -> str:
return str(node.full_path).replace(".[", "[")

def __get_datasets_content_index(self) -> List[dict]:
"""
Expand Down
2 changes: 1 addition & 1 deletion cdisc_rules_engine/services/datasetxpt_metadata_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def read(self) -> dict:
"variable_labels": list(metadata.column_labels),
"variable_names": list(metadata.column_names),
"variable_formats": [
"" if data_type == "NULL" else data_type
"" if (data_type == "NULL" or data_type is None) else data_type
for data_type in metadata.original_variable_types.values()
],
"variable_name_to_label_map": metadata.column_names_to_labels,
Expand Down
2 changes: 0 additions & 2 deletions core.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,13 @@ def load_custom_dotenv_from_data_options(_ctx, _param, value):
"-s",
"--standard",
required=True,
default=None,
help="CDISC standard to validate against",
envvar="PRODUCT",
)
@click.option(
"-v",
"--version",
required=True,
default=None,
help="Standard version to validate against",
envvar="VERSION",
)
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This project enforces consistent formatting and linting via pre-commit hooks.
- [`flake8`](https://flake8.pycqa.org/) — Python linter
- [`prettier`](https://prettier.io/) — JSON, YAML, and Markdown formatter

Both `black` and `flake8` are included in `requirements-dev.txt`. After installing dependencies, install the pre-commit hooks:
Both `black` and `flake8` are included in the `dev` dependency group in `pyproject.toml`. After installing dependencies, install the pre-commit hooks:

```bash
pre-commit install
Expand Down
15 changes: 13 additions & 2 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,21 @@ source venv/bin/activate
# Activate (Windows)
.\venv\Scripts\Activate

# Install dependencies
python -m pip install -r requirements-dev.txt
# Install uv (if not already installed)
pip install uv

# Install pinned dependencies from the primary & dev lockfiles
uv pip sync pylock.dev.toml

# Install the package itself in editable mode
pip install -e.
```

> **Note:** `pylock.toml` and `pylock.dev.toml` are standard lockfiles (PEP 751) and can be used
> with any compatible tool. If you prefer not to use uv, you can install core dependencies via
> standard pip (`pip install .`), though dev dependencies will need to be installed separately
> and exact version pinning is only guaranteed when using a tool that supports `pylock.toml`.

---

## Running Tests
Expand Down
8 changes: 7 additions & 1 deletion docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,15 @@ python -m venv venv
### 3. Install Dependencies

```bash
python -m pip install -r requirements-dev.txt
pip install uv
uv pip sync pylock.toml
```

> **Note:** `pylock.toml` is a standard format (PEP 751) and can be used with any compatible tool.
> If you prefer not to use uv, you can install directly from `pyproject.toml` using standard pip
> (`pip install .`) or any other PEP 517-compatible tool such as pip-tools or Poetry. Note that
> exact version pinning is only guaranteed when using a tool that supports `pylock.toml`.

### 4. Populate the Cache

```bash
Expand Down
Loading
Loading