You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This document describes the workflow on how to contribute to the openml-python package.
2
3
If you are interested in connecting a machine learning package with OpenML (i.e.
3
4
write an openml-python extension) or want to find other ways to contribute, see [this page](https://openml.github.io/openml-python/main/contributing.html#contributing).
4
5
5
-
Scope of the package
6
-
--------------------
6
+
## Scope of the package
7
7
8
8
The scope of the OpenML Python package is to provide a Python interface to
9
9
the OpenML platform which integrates well with Python's scientific stack, most
@@ -15,66 +15,112 @@ in Python, [scikit-learn](http://scikit-learn.org/stable/index.html).
15
15
Thereby it will automatically be compatible with many machine learning
16
16
libraries written in Python.
17
17
18
-
We aim to keep the package as light-weight as possible and we will try to
18
+
We aim to keep the package as light-weight as possible, and we will try to
19
19
keep the number of potential installation dependencies as low as possible.
20
20
Therefore, the connection to other machine learning libraries such as
21
21
*pytorch*, *keras* or *tensorflow* should not be done directly inside this
22
22
package, but in a separate package using the OpenML Python connector.
23
23
More information on OpenML Python connectors can be found [here](https://openml.github.io/openml-python/main/contributing.html#contributing).
24
24
25
-
Reporting bugs
26
-
--------------
27
-
We use GitHub issues to track all bugs and feature requests; feel free to
28
-
open an issue if you have found a bug or wish to see a feature implemented.
29
-
30
-
It is recommended to check that your issue complies with the
31
-
following rules before submitting:
32
-
33
-
- Verify that your issue is not being currently addressed by other
Great! You've decided you want to help out. Now what?
56
-
All contributions should be linked to issues on the [Github issue tracker](https://github.com/openml/openml-python/issues).
28
+
All contributions should be linked to issues on the [GitHub issue tracker](https://github.com/openml/openml-python/issues).
57
29
In particular for new contributors, the *good first issue* label should help you find
58
-
issues which are suitable for beginners. Resolving these issues allow you to start
30
+
issues which are suitable for beginners. Resolving these issues allows you to start
59
31
contributing to the project without much prior knowledge. Your assistance in this area
60
32
will be greatly appreciated by the more experienced developers as it helps free up
61
33
their time to concentrate on other issues.
62
34
63
-
If you encountered a particular part of the documentation or code that you want to improve,
35
+
If you encounter a particular part of the documentation or code that you want to improve,
64
36
but there is no related open issue yet, open one first.
65
37
This is important since you can first get feedback or pointers from experienced contributors.
66
38
67
39
To let everyone know you are working on an issue, please leave a comment that states you will work on the issue
68
40
(or, if you have the permission, *assign* yourself to the issue). This avoids double work!
69
41
70
-
General git workflow
71
-
--------------------
42
+
## Contributing Workflow Overview
43
+
To contribute to the openml-python package, follow these steps:
44
+
45
+
0. Determine how you want to contribute (see above).
46
+
1. Set up your local development environment.
47
+
1. Fork and clone the `openml-python` repository. Then, create a new branch from the ``develop`` branch. If you are new to `git`, see our [detailed documentation](#basic-git-workflow), or rely on your favorite IDE.
48
+
2.[Install the local dependencies](#install-local-dependencies) to run the tests for your contribution.
49
+
3.[Test your installation](#testing-your-installation) to ensure everything is set up correctly.
50
+
4. Implement your contribution. If contributing to the documentation, see [here](#contributing-to-the-documentation).
51
+
5.[Create a pull request](#pull-request-checklist).
52
+
53
+
### Install Local Dependencies
54
+
55
+
We recommend following the instructions below to install all requirements locally.
56
+
However, it is also possible to use the [openml-python docker image](https://github.com/openml/openml-python/blob/main/docker/readme.md) for testing and building documentation. Moreover, feel free to use any alternative package managers, such as `pip`.
57
+
58
+
59
+
1. To ensure a smooth development experience, we recommend using the `uv` package manager. Thus, first install `uv`. If any Python version already exists on your system, follow the steps below, otherwise see [here](https://docs.astral.sh/uv/getting-started/installation/).
60
+
```bash
61
+
pip install uv
62
+
```
63
+
2. Create a virtual environment using `uv` and activate it. This will ensure that the dependencies for`openml-python`do not interfere with other Python projects on your system.
To test your new contribution, add [unit tests](https://github.com/openml/openml-python/tree/develop/tests), and, if needed, [examples](https://github.com/openml/openml-python/tree/develop/examples) for any new functionality being introduced. Some notes on unit tests and examples:
95
+
* If a unit test contains an upload to the test server, please ensure that it is followed by a file collection for deletion, to prevent the test server from bulking up. For example, `TestBase._mark_entity_for_removal('data', dataset.dataset_id)`, `TestBase._mark_entity_for_removal('flow', (flow.flow_id, flow.name))`.
96
+
* Please ensure that the example is run on the test server by beginning with the call to `openml.config.start_using_configuration_for_example()`, which is done by default for tests derived from `TestBase`.
97
+
* Add the `@pytest.mark.sklearn` marker to your unit tests if they have a dependency on scikit-learn.
98
+
99
+
### Pull Request Checklist
100
+
101
+
You can go to the `openml-python` GitHub repository to create the pull request by [comparing the branch](https://github.com/openml/openml-python/compare) from your fork with the `develop` branch of the `openml-python` repository. When creating a pull request, make sure to follow the comments and structured provided by the template on GitHub.
102
+
103
+
**An incomplete contribution** -- where you expect to do more work before
104
+
receiving a full review -- should be submitted as a `draft`. These may be useful
105
+
to: indicate you are working on something to avoid duplicated work,
106
+
request broad review of functionality or API, or seek collaborators.
- The max line length is 100 characters instead of 80.
135
-
- When creating a multi-line expression with binary operators, break before the operator.
136
-
- Add type hints to all function signatures.
137
-
(note: not all functions have type hints yet, this is work in progress.)
138
-
- Use the [`str.format`](https://docs.python.org/3/library/stdtypes.html#str.format) over [`printf`](https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting) style formatting.
139
-
E.g. use `"{} {}".format('hello', 'world')` not `"%s %s" % ('hello', 'world')`.
140
-
(note: old code may still use `printf`-formatting, this is work in progress.)
141
-
142
-
- If your pull request addresses an issue, please use the pull request title
143
-
to describe the issue and mention the issue number in the pull request description. This will make sure a link back to the original issue is
144
-
created. Make sure the title is descriptive enough to understand what the pull request does!
145
-
146
-
- An incomplete contribution -- where you expect to do more work before
147
-
receiving a full review -- should be submitted as a `draft`. These may be useful
148
-
to: indicate you are working on something to avoid duplicated work,
149
-
request broad review of functionality or API, or seek collaborators.
- Add [unit tests](https://github.com/openml/openml-python/tree/develop/tests) and [examples](https://github.com/openml/openml-python/tree/develop/examples) for any new functionality being introduced.
155
-
- If an unit test contains an upload to the test server, please ensure that it is followed by a file collection for deletion, to prevent the test server from bulking up. For example, `TestBase._mark_entity_for_removal('data', dataset.dataset_id)`, `TestBase._mark_entity_for_removal('flow', (flow.flow_id, flow.name))`.
156
-
- Please ensure that the example is run on the test server by beginning with the call to `openml.config.start_using_configuration_for_example()`.
157
-
- Add the `@pytest.mark.sklearn` marker to your unit tests if they have a dependency on scikit-learn.
158
-
159
-
- All tests pass when running `pytest`. On
160
-
Unix-like systems, check with (from the toplevel source folder):
161
-
162
-
```bash
163
-
$ pytest
164
-
```
165
-
166
-
For Windows systems, execute the command from an Anaconda Prompt or add `pytest` to PATH before executing the command.
167
-
168
-
- Documentation and high-coverage tests are necessary for enhancements to be
169
-
accepted. Bug-fixes or new features should be provided with
These tests verify the correct behavior of the fix or feature. In this
172
-
manner, further modifications on the code base are granted to be consistent
173
-
with the desired behavior.
174
-
For the Bug-fixes case, at the time of the PR, this tests should fail for
175
-
the code base in develop and pass for the PR code.
176
-
177
-
- If any source file is being added to the repository, please add the BSD 3-Clause license to it.
178
-
179
-
180
-
*Note*: We recommend to follow the instructions below to install all requirements locally.
181
-
However it is also possible to use the [openml-python docker image](https://github.com/openml/openml-python/blob/main/docker/readme.md) for testing and building documentation.
182
-
This can be useful for one-off contributions or when you are experiencing installation issues.
183
-
184
-
First install openml with its test dependencies by running
185
-
```bash
186
-
$ pip install -e .[test]
187
-
```
188
-
from the repository folder.
189
-
Then configure pre-commit through
190
-
```bash
191
-
$ pre-commit install
192
-
```
193
-
This will install dependencies to run unit tests, as well as [pre-commit](https://pre-commit.com/).
194
-
To run the unit tests, and check their code coverage, run:
195
-
```bash
196
-
$ pytest --cov=. path/to/tests_for_package
197
-
```
198
-
Make sure your code has good unittest **coverage** (at least 80%).
199
-
200
-
Pre-commit is used for various style checking and code formatting.
171
+
## Pre-commit Details
172
+
[Pre-commit](https://pre-commit.com/) is used for various style checking and code formatting.
201
173
Before each commit, it will automatically run:
202
174
- [ruff](https://docs.astral.sh/ruff/) a code formatter and linter.
203
175
This will automatically format your code.
@@ -216,23 +188,7 @@ $ pre-commit run --all-files
216
188
```
217
189
Make sure to do this at least once before your first commit to check your setup works.
218
190
219
-
Executing a specific unit test can be done by specifying the module, test case, and test.
220
-
You may then run a specific module, test case, or unit test respectively:
0 commit comments