Skip to content

Commit

Permalink
Merge branch 'rename_functs_2' into rename_functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Meganton committed Dec 31, 2024
2 parents 42af969 + a85a6f9 commit 95b9cc9
Show file tree
Hide file tree
Showing 110 changed files with 2,586 additions and 1,201 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/pr-conventional-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: PR Conventional Commit Validation

on:
pull_request:
types: [opened, synchronize, reopened, edited]

jobs:
validate-pr-title:
runs-on: ubuntu-latest
steps:
- name: PR Conventional Commit Validation
uses: ytanikin/[email protected]
with:
task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert"]'
add_label: 'false'
16 changes: 11 additions & 5 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: install the latest version uv
uses: astral-sh/setup-uv@v3
with:
python-version: '3.10'
- run: pip install pre-commit
- run: pre-commit install
- run: pre-commit run --all-files
version: latest
- name: create virtual environment
run: uv venv --python '3.10'
- name: install pre-commit
run: uv pip install pre-commit
- name: install pre-commit hooks
run: uv run pre-commit install
- name: Run pre-commit hooks
run: uv run pre-commit run --all-files
20 changes: 11 additions & 9 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11']
python-version: ['3.10', '3.11', '3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
defaults:
run:
Expand All @@ -25,12 +25,14 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: pipx install poetry
- uses: actions/setup-python@v5
- name: install the latest version uv
uses: astral-sh/setup-uv@v3
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
cache-dependency-path: '**/pyproject.toml'
- run: poetry install
- run: poetry run pytest -m "" # Run all markers

version: latest
- name: create venv
run: uv venv --python ${{ matrix.python-version }}
- name: install dependencies
run: uv pip install -e ".[dev]"
- name: run tests
run: uv run pytest -m "" # Run all markers

6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#False Python
# False Python
__pycache__
dist
**/*.egg-info

# Log files
*.out
Expand All @@ -19,9 +20,6 @@ site/*
.vscode/
.idea/

# Poetry
poetry.lock

# Misc
*.sh
*.model
Expand Down
8 changes: 2 additions & 6 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@ authors:
given-names: Carl
- family-names: Binxin
given-names: Ru
- family-names: Kober
given-names: Nils
- family-names: Vallaeys
given-names: Théophane
- family-names: Hutter
given-names: Frank
title: "Neural Pipeline Search (NePS)"
version: 0.12.1
date-released: 2024-07-03
version: 0.12.2
date-released: 2024-07-09
url: "https://github.com/automl/neps"
128 changes: 49 additions & 79 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,67 +16,49 @@ Automatic checks are run on every pull request and on every commit to `master`.

There are three required steps and one optional:

1. Optional: Install miniconda and create an environment
1. Install poetry
1. Install the neps package using poetry
1. Install uv
1. Install the neps package using uv
1. Activate pre-commit for the repository

For instructions see below.

## 1. Optional: Install miniconda and create a virtual environment
## 1. Install uv

To manage python versions install e.g., miniconda with
First, install uv, e.g., via

```bash
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O install_miniconda.sh
bash install_miniconda.sh -b -p $HOME/.conda # Change to place of preference
rm install_miniconda.sh
# On macOS and Linux.
curl -LsSf https://astral.sh/uv/install.sh | sh
```

Consider running `~/.conda/bin/conda init` or `~/.conda/bin/conda init zsh` .

Then finally create the environment and activate it

```bash
conda create -n neps python=3.10
conda activate neps
# On Windows.
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```

## 2. Install poetry

First, install poetry, e.g., via
## 2. Clone the neps repository

```bash
curl -sSL https://install.python-poetry.org | python3 -
# or directly into your virtual env using `pip install poetry`
git clone https://github.com/automl/neps.git
cd neps
```

Then consider appending
## 3. Create a virtual environment and install the neps package

```bash
export PATH="$HOME/.local/bin:$PATH"
```

to your `.zshrc` / `.bashrc` or alternatively simply running the export manually.

## 3. Install the neps Package Using poetry

Clone the repository, e.g.,

```bash
git clone https://github.com/automl/neps.git
cd neps
uv venv --python 3.11
source .venv/bin/activate
```

Then, inside the main directory of neps run

```bash
poetry install
uv pip install -e ".[dev]"
```

This will installthe neps package but also additional dev dependencies.

## 4. Activate pre-commit for the repository
### 4. Activate pre-commit for the repository

With the python environment used to install the neps package run in the main directory of neps

Expand All @@ -93,9 +75,6 @@ your choice, e.g.
[VSCode](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff),
[PyCharm](https://plugins.jetbrains.com/plugin/20574-ruff).


# Checks and Tests

We have setup checks and tests at several points in the development flow:

- At every commit we automatically run a suite of [pre-commit](https://pre-commit.com/) hooks that perform static code analysis, autoformating, and sanity checks.
Expand All @@ -104,11 +83,13 @@ This is setup during our [installation process](https://automl.github.io/neps/co
The tests correspond directly to examples in [neps_examples](https://github.com/automl/neps/tree/master/neps_examples) and only check for crash-causing errors.
- At every push all integration tests and regression tests are run automatically using [github actions](https://github.com/automl/neps/actions).

## Linting (Ruff)
## Checks and tests

### Linting (Ruff)
For linting we use `ruff` for checking code quality. You can install it locally and use it as so:

```bash
pip install ruff
uv pip install ruff
ruff check --fix neps # the --fix flag will try to fix issues it can automatically
```

Expand All @@ -127,11 +108,11 @@ The configuration of `ruff` is in the `pyproject.toml` file and we refer you to

There you can find the documentation for all of the rules employed.

## Type Checking (Mypy)
### Type Checking (Mypy)
For type checking we use `mypy`. You can install it locally and use it as so:

```bash
pip install mypy
uv pip install mypy
mypy neps
```

Expand Down Expand Up @@ -159,15 +140,15 @@ or types defined from NePS, there is probably a good reason for a mypy error.
If you have issues regarding typing, please feel free to reach out for help `@eddiebergman`.


## Examples and Integration Tests
### Examples and Integration Tests

We use examples in [neps_examples](https://github.com/automl/neps/tree/master/neps_examples) as integration tests, which we run from the main directory via
We use some examples in [neps_examples](https://github.com/automl/neps/tree/master/neps_examples) as integration tests, which we run from the main directory via

```bash
pytest
```

If tests fail for you on the master, please raise an issue on github, preferabbly with some informationon the error,
If tests fail for you on the master, please raise an issue on github, preferably with some information on the error,
traceback and the environment in which you are running, i.e. python version, OS, etc.

## Regression Tests
Expand Down Expand Up @@ -212,11 +193,12 @@ In the case of regression test failure, try running it again first, if the probl
You can also run tests locally by running:

```
poetry run pytest -m regression_all
uv run pytest -m regression_all
```

## Disabling and Skipping Checks etc.


### Pre-commit: How to not run hooks?

To commit without running `pre-commit` use `git commit --no-verify -m <COMMIT MESSAGE>`.
Expand All @@ -231,32 +213,31 @@ There are two options:
code = "foo" # type: ignore
```

## Managing Dependencies
### Managing Dependencies

To manage dependencies and for package distribution we use [poetry](https://python-poetry.org/docs/) (replaces pip).
To manage dependencies we use [uv](https://docs.astral.sh/uv/getting-started/) (replaces pip).

## Add dependencies
#### Add dependencies

To install a dependency use

```bash
poetry add dependency
uv add dependency
```

and commit the updated `pyproject.toml` to git.

For more advanced dependency management see examples in `pyproject.toml` or have a look at the [poetry documentation](https://python-poetry.org/).
For more advanced dependency management see examples in `pyproject.toml` or have a look at the [uv documentation](https://docs.astral.sh/uv/getting-started/).

## Install dependencies added by others
#### Install dependencies added by others

When other contributors added dependencies to `pyproject.toml`, you can install them via

```bash
poetry lock
poetry install
uv pip install -e ".[dev]"
```

# Documentation
## Documentation

We use [MkDocs](https://www.mkdocs.org/getting-started/), more specifically [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) for documentation.
To support documentation for multiple versions, we use the plugin [mike](https://github.com/jimporter/mike).
Expand All @@ -278,7 +259,7 @@ To publish the documentation run
mike deploy 0.5.1 latest -p
```

# Releasing a New Version
## Releasing a New Version

There are four steps to releasing a new version of neps:

Expand All @@ -288,42 +269,30 @@ There are four steps to releasing a new version of neps:
3. Update Documentation
4. Publish on PyPI

## 0. Understand Semantic Versioning
### 0. Understand Semantic Versioning

We follow the [semantic versioning](https://semver.org) scheme.

## 1. Update the Package Version and CITATION.cff
## 1. Run tests

```bash
poetry version v0.9.0
uv run pytest
```

and manually change the version specified in `CITATION.cff`.

## 2. Commit with a Version Tag

First commit and test
## 2. Update the Package Version and CITATION.cff

```bash
git add pyproject.toml
git commit -m "Bump version from v0.8.4 to v0.9.0"
pytest
bump-my-version bump <major | minor | patch>
```

Then tag and push

```bash
git tag v0.9.0
git push --tags
git push
```
This will automatically update the version in `pyproject.toml` and `CITATION.cff`, tag the commit and push it to the remote repository.

## 3. Update Documentation
### 3. Update Documentation

First check if the documentation has any issues via

```bash
mike deploy 0.9.0 latest -u
mike deploy <current version> latest -u
mike serve
```

Expand All @@ -332,19 +301,20 @@ and then looking at it.
Afterwards, publish it via

```bash
mike deploy 0.9.0 latest -up
mike deploy <current version> latest -up
```

## 4. Publish on PyPI
### 4. Publish on PyPI

To publish to PyPI:

1. Get publishing rights, e.g., asking Danny or Maciej or Neeratyoy.
1. Get publishing rights, e.g., asking Danny or Neeratyoy.
2. Be careful, once on PyPI we can not change things.
3. Run

```bash
poetry publish --build
uv build
uv publish
```

This will ask for your PyPI credentials.
Loading

0 comments on commit 95b9cc9

Please sign in to comment.