Skip to content

Commit

Permalink
chore: sync project template
Browse files Browse the repository at this point in the history
  • Loading branch information
makkus committed Jan 22, 2024
1 parent ecf8f6d commit 5a6dcee
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 150 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/DHARPA-Project/kiara_plugin.develop.git",
"commit": "e2d43d57283f53eaf5144915075567eff38d738a",
"commit": "96e37df1692a56068082857a41318dc7d17f1643",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ jobs:
runs-on: macos-11
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python_version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: "Set up Python ${{ matrix.python_version }}"
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python_version }}"
- uses: actions/checkout@v3
- name: install kiara_plugin.topic_modelling
run: pip install -U --extra-index-url https://pypi.fury.io/dharpa/ .[all,dev_testing]
run: pip install -U .[dev_testing]
- name: display installed kiara and module package versions
run: pip list | grep kiara
- name: Test with pytest
Expand Down
84 changes: 41 additions & 43 deletions .github/workflows/build-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,56 +18,54 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python_version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: "Set up Python ${{ matrix.python_version }}"
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python_version }}"
- uses: actions/checkout@v3
- name: install kiara_plugin.topic_modelling
run: pip install -U .[all,dev_testing]
run: pip install -U .[dev_testing]
- name: display installed kiara and module package versions
run: pip list | grep kiara
- name: Test with pytest
run: make test
- name: test with pytest
run: pytest --cov-report=xml --cov=kiara_plugin.topic_modelling tests
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
parallel: true
flag-name: run ${{ join(matrix.*, ' - ') }}
format: cobertura
file: coverage.xml

# Uncomment this if you have coveralls.io setup with this repo
# coverage:
# name: create and publish test coverage
# runs-on: ubuntu-latest
# steps:
# - name: "Set up Python 3.9"
# uses: actions/setup-python@v4
# with:
# python-version: "3.9"
# - uses: actions/checkout@v3
# - name: install kiara
# run: pip install -U .[all,dev_testing]
# - name: display installed kiara and module package versions
# run: pip list | grep kiara
# - name: Run coverage
# run: coverage run -m pytest tests
# - name: coveralls
# uses: coverallsapp/github-action@v2
coverage:
name: test coverage
runs-on: ubuntu-latest
needs:
- test-linux
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true

# Uncomment this if you want to run mypy
# mypy-linux:
# name: mypy check on linux
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
# steps:
# - name: "Set up Python ${{ matrix.python_version }}"
# uses: actions/setup-python@v4
# with:
# python-version: "${{ matrix.python_version }}"
# - uses: actions/checkout@v3
# - name: install kiara_plugin.topic_modelling
# run: pip install -U .[all,dev_testing]
# - name: Test with mypy
# run: make mypy
mypy-linux:
name: mypy check on linux
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: "Set up Python ${{ matrix.python_version }}"
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python_version }}"
- uses: actions/checkout@v3
- name: install kiara_plugin.topic_modelling
run: pip install -U .[dev_testing]
- name: Test with mypy
run: make mypy

linting-linux:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -96,8 +94,8 @@ jobs:
runs-on: ubuntu-latest
needs:
- test-linux
# - mypy-linux
# - linting-linux
- mypy-linux
- linting-linux
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v4
Expand Down Expand Up @@ -138,8 +136,8 @@ jobs:
runs-on: ubuntu-latest
needs:
- test-linux
# - mypy-linux # uncomment if this step is enabled
# - linting-linux # uncomment if this step is enabled
- mypy-linux
- linting-linux
steps:
- name: "Set up Python 3.11"
uses: actions/setup-python@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python_version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: "Set up Python ${{ matrix.python_version }}"
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python_version }}"
- uses: actions/checkout@v3
- name: install kiara_plugin.topic_modelling
run: pip install -U --extra-index-url https://pypi.fury.io/dharpa/ .[all,dev_testing]
run: pip install -U .[dev_testing]
- name: Test with pytest
run: make test
76 changes: 29 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,75 +32,57 @@ TODO
If you only want to work on the modules, and not the core *Kiara* codebase, follow the instructions below. Otherwise, please
check the notes on how to setup a *Kiara* development environment under (TODO).

#### Linux & Mac OS X (using make)
#### Using `pixi` (recommended)

For *NIX-like operating system, setting up a development environment is relatively easy:
The recommended way to setup a development environment is to use [pixi](https://github.com/prefix-dev/pixi). Check out [their install instructions](https://github.com/prefix-dev/pixi#installation).

```console
git clone https://github.com/DHARPA-Project/kiara_plugin.topic_modelling.git
cd kiara_plugin.topic_modelling
python3 -m venv .venv
source .venv/bin/activate
make init
```
Once you have `pixi` installed, you need to initialize the environment once:

#### Windows (or manual pip install)
```
pixi run install-dev-env
```

It's impossible to lay out all the ways Python can be installed on a machine, and virtual- (or conda-)envs can be created, so I'll assume you know how to do this.
One simple way is to install the [Anaconda (individual edition)](https://docs.anaconda.com/anaconda/install/index.html), then use the Anaconda navigator to create a new environment, install the 'git' package in it (if your system does not already have it), and use the 'Open Terminal' option of that environment to start up a terminal that has that virtual-/conda-environment activated.
You also need to do this whenever a depdendency of this plugin is updated (for example the core `kiara` package).

Once that is done, `cd` into a directory where you want this project folder to live, and do:
Once that is done, you can enter the environment with:

```console
# make sure your virtual env is activated!!!
git clone https://github.com/DHARPA-Project/kiara_plugin.topic_modelling.git
cd kiara_plugin.topic_modelling
pip install --extra-index-url https://pypi.fury.io/dharpa/ -U -e .[all_dev]
```
pixi shell
```

#### Try it out

After this is done, you should be able to run the included example module via:
This will start a sub-shell with the virtual environment activated, and all dependencies of the plugin package installed. To confirm it works, you can run any `kiara` command:

```console
kiara run topic_modelling_example text_1="xxx" text_2="yyy"
```
kiara --version
# or
kiara operation list
# or
...
...
```

### Re-activate the development environment

The 'prepare' step from above only has to be done once. After that, to re-enable your virtual environment,
you'll need to navigate to the directory again (wherever that is, in your case), and run the ``source`` command from before again:
Once you are finished with your development session, you can exit the sub-shell as you would normally do in such cases:

```console
cd path/to/kiara_plugin.topic_modelling
source .venv/bin/activate # if it isn't activated already, for example by the Anaconda navigator
kiara --help # or whatever, point is, kiara should be available for you now,
```
exit
```

### ``make`` targets (Linux & Mac OS X)
Alternatively, you can also run the `kiara` executable directly, it is located in `.pixi/env/bin/kiara`. So either adapt your `PATH` variable, or do something like:

- ``init``: init development project (install project & dev dependencies into virtualenv, as well as pre-commit git hook)
- ``update-dependencies``: update development dependencies (mainly the core ``kiara`` package from git)
- ``flake``: run *flake8* tests
- ``mypy``: run mypy tests
- ``test``: run unit tests
- ``docs``: create static documentation pages (under ``build/site``)
- ``serve-docs``: serve documentation pages (incl. auto-reload) for getting direct feedback when working on documentation
- ``clean``: clean build directories
```
.pixi/env/bin/kiara operation list
```

For details (and other, minor targets), check the ``Makefile``.
In most cases it's recommended to use a pixi shell though.


### Running tests
### Using pre-defined development-related tasks

``` console
> make test
# or
> make coverage
```
The included `pixi.toml` file includes some useful tasks that help with development:

- `pixi run pre-commit-check`: runs a set of checks against all files
- `pixi run tests`: runs the unit tests
- `pixi run mypy`: run mypy checks

## Copyright & license

Expand Down
7 changes: 5 additions & 2 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ name = "kiara-plugin-topic_modelling"
version = "0.1.0"
description = "A Kiara plugin toho create a Topic Modelling workflow."
authors = ["Mariella De Crouy Chanel <mariella.decrouychanel@uni.lu>"]
channels = ["conda-forge", "dharpa"]
channels = ["dharpa", "conda-forge"]
platforms = ["linux-64", "win-64", "osx-64", "osx-arm64"]

[tasks]
install-dev-env = "pip install -e '.[dev_utils]'"
install-dev-env = "pip install --upgrade -e '.[dev_utils]'"
pre-commit-check = ".pixi/env/bin/pre-commit run --all-files"
tests = "py.test"
mypy = "mypy --namespace-packages --explicit-package-base src/kiara_plugin/topic_modelling"
kiara = ".pixi/env/bin/kiara"
show-versions = ".pixi/env/bin/kiara --version"
delete-context = ".pixi/env/bin/kiara context delete"
install-dev-dependency = ".pixi/env/bin/pip install -e"

[dependencies]
python = "3.11.*"
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ classifiers = [
"Programming Language :: Python :: 3.12"
]
dependencies = [
"kiara>=0.5.6,<0.6.0",
"kiara>=0.5.9,<0.6.0",
"kiara_plugin.core_types>=0.5.0,<0.6.0",
"kiara-plugin.tabular>=0.5.1,<0.6.0",
]
Expand Down Expand Up @@ -240,5 +240,9 @@ plugins = [

# mypy per-module options:
[[tool.mypy.overrides]]
module = ["placholder.dummy.*"]
module = [
"appdirs.*",
"pyarrow.*",
"ruamel.*"
]
ignore_missing_imports = true
Loading

0 comments on commit 5a6dcee

Please sign in to comment.