Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev,rdd]
pip install -e ".[rdd]" --group dev

- name: Run pre-commit checks
run: |
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ share/python-wheels/
*.vscode
MANIFEST
*.idea
*.vscode
.flake8
.coverage

# Setuptools SCM
doubleml/_version.py

# uv
.venv/
uv.lock
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
33 changes: 21 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DoubleML is a community effort.
Everyone is welcome to contribute.
All contributors should adhere to this contributing guidelines
All contributors should adhere to these contributing guidelines
and our [code of conduct](https://github.com/DoubleML/doubleml-for-py/blob/main/CODE_OF_CONDUCT.md).
The contributing guidelines are particularly helpful to get started for your first contribution.

Expand Down Expand Up @@ -34,7 +34,7 @@ In case of an exception the full traceback is appreciated.
```python
import platform; print(platform.platform())
import sys; print("Python", sys.version)
import doubleml; print("DoubleML", sklearn.__version__)
import doubleml; print("DoubleML", doubleml.__version__)
import sklearn; print("Scikit-Learn", sklearn.__version__)
```

Expand Down Expand Up @@ -79,10 +79,19 @@ $ git merge upstream/main
```

5. **Install DoubleML in editable mode** (more details can be found
[here](https://docs.doubleml.org/stable/intro/install.html#python-building-the-package-from-source))
via
[here](https://docs.doubleml.org/stable/intro/install.html#python-building-the-package-from-source)).

We recommend [uv](https://docs.astral.sh/uv/) for development. The following command creates a virtual
environment, provisions Python 3.12 (as pinned in `.python-version`), and installs DoubleML in editable
mode together with the `dev` dependency group and the `rdd` extra:
Comment thread
SvenKlaassen marked this conversation as resolved.
```bash
$ uv sync --extra rdd
```
Prefix tooling commands with `uv run` to execute them inside this environment (e.g. `uv run pytest .`).

Alternatively, you can use `pip` (requires pip >= 25.1 for the `--group` flag):
```bash
$ pip install --editable .[dev, rdd]
$ pip install --editable ".[rdd]" --group dev
```

6. **Develop** your code changes. The changes can be added and pushed via
Expand All @@ -109,7 +118,7 @@ When opening the PR you will be guided with a checklist.
for details).
To check, please run
```bash
$ pytest .
$ uv run pytest . # or, without uv: pytest .
```

- [x] If you add an **enhancements** or **new feature**, **unit tests**
Expand All @@ -118,13 +127,13 @@ $ pytest .
- [x] Check whether your changes adhere to the **PEP8 standards**.
For the check you can use the following code
```bash
$ git diff upstream/main -u -- "*.py" | ruff check --diff
$ git diff upstream/main -u -- "*.py" | uv run ruff check --diff # or: ... | ruff check --diff
```

- [x] Check wether the code formatting adheres to the **Black code style**
- [x] Check whether the code formatting adheres to the **Black code style**
by running
```bash
$ black . --check --diff
$ uv run black . --check --diff # or, without uv: black . --check --diff
```

If your PR is still **work in progress**, please consider marking it a **draft PR**
Expand All @@ -137,13 +146,13 @@ To ensure code quality and consistency before committing your changes, we recomm
1. **Install hooks**:
If you haven't already, install the required hooks by running:
```bash
$ pre-commit install
$ uv run pre-commit install # or, without uv: pre-commit install
```

2. **Run pre-commit manually**:
To run the pre-commit checks manually, use:
```bash
$ pre-commit run --all-files
$ uv run pre-commit run --all-files # or, without uv: pre-commit run --all-files
```

### Unit Tests and Test Coverage
Expand All @@ -156,7 +165,7 @@ Coverage reports for the package, PRs, branches etc. are available from
It is mandatory to equip new features with an appropriate level of unit test coverage.
To **run all unit tests** (for further option see the [pytest docu](https://docs.pytest.org)) call
```bash
$ pytest --cov .
$ uv run pytest --cov . # or, without uv: pytest --cov .
```
If `pytest` is called with the `--cov` flag, a unit test coverage report is being generated.

Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ It further can be readily extended with regards to
**DoubleML** requires

- Python
- sklearn
- scikit-learn
- numpy
- scipy
- pandas
Expand All @@ -82,6 +82,15 @@ cd doubleml-for-py
pip install --editable .
```

For development we recommend [uv](https://docs.astral.sh/uv/), which sets up the
environment (including the `dev` dependency group) in one step:
Comment thread
SvenKlaassen marked this conversation as resolved.

```
git clone git@github.com:DoubleML/doubleml-for-py.git
cd doubleml-for-py
uv sync --extra rdd
```

Detailed [installation instructions](https://docs.doubleml.org/stable/intro/install.html) can be found in the documentation.

## Contributing
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ dependencies = [
"optuna>=4.6.0",
"matplotlib>=3.9.0",
"seaborn>=0.13",
"plotly>=5.0.0",
"mypy>=1.18.0"
"plotly>=5.0.0"
]
classifiers = [
"Programming Language :: Python :: 3",
Expand All @@ -42,6 +41,8 @@ classifiers = [
rdd = [
"rdrobust>=1.3.0"
]

[dependency-groups]
dev = [
"pytest>=8.3.0",
"pytest-cov>=6.0.0",
Expand All @@ -50,6 +51,7 @@ dev = [
"black>=25.1.0",
"ruff>=0.11.1",
"pre-commit>=4.2.0",
"mypy>=1.18.0",
]

[project.urls]
Expand Down
Loading