Skip to content

Commit

Permalink
[Feat][CI] Building system of farsante (#19)
Browse files Browse the repository at this point in the history
* Building system of farsante

- replace poetry by maturin
- introduce Makefile for simplify life of devs
- add a maturin action
- refactor the project to the recommended structure
- redefine dependencies as pure pyproject

(see PyO3/maturin#490 for details)

 On branch 18-maturin_build
 Changes to be committed:
	new file:   .github/workflows/release.yaml
	modified:   .gitignore
	renamed:    h2o-data-rust/Cargo.lock -> Cargo.lock
	renamed:    h2o-data-rust/Cargo.toml -> Cargo.toml
	new file:   Makefile
	deleted:    h2o-data-rust/README.md
	modified:   poetry.lock
	modified:   pyproject.toml
	renamed:    farsante/__init__.py -> python/farsante/__init__.py
	renamed:    farsante/h2o_dataset_create.py -> python/farsante/h2o_dataset_create.py
	renamed:    farsante/h2o_dataset_create_all.py -> python/farsante/h2o_dataset_create_all.py
	renamed:    farsante/pandas_dfs.py -> python/farsante/pandas_dfs.py
	renamed:    farsante/pandas_generators.py -> python/farsante/pandas_generators.py
	renamed:    farsante/pyspark_dfs.py -> python/farsante/pyspark_dfs.py
	renamed:    farsante/pyspark_generators.py -> python/farsante/pyspark_generators.py
	renamed:    h2o-data-rust/src/generators.rs -> src/generators.rs
	renamed:    h2o-data-rust/src/helpers.rs -> src/helpers.rs
	renamed:    h2o-data-rust/src/lib.rs -> src/lib.rs
	renamed:    h2o-data-rust/src/main.rs -> src/main.rs

* Drop poetry.lock

By switching to maturing-builds
we do not need poetry.lock anymore

 On branch 18-maturin_build
 Your branch is up to date with 'origin/18-maturin_build'.

 Changes to be committed:
	deleted:    poetry.lock
  • Loading branch information
SemyonSinchenko authored Mar 10, 2024
1 parent fcdd569 commit aa42c75
Show file tree
Hide file tree
Showing 19 changed files with 65 additions and 395 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build release

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Maturin build
uses: PyO3/maturin-action@v1
with:
command: build
args: --release

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ __pycache__/
.pytest_cache/

*.csv
**/target
**/target

.env
.venv
22 changes: 11 additions & 11 deletions h2o-data-rust/Cargo.lock → Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions h2o-data-rust/Cargo.toml → Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "h2o_data_rust"
name = "farsante"
version = "0.1.0"
edition = "2021"

[lib]
name = "h2o"
name = "farsante"
crate-type = ["cdylib"]

[dependencies]
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.PHONY: install_dev
install_dev:
maturin develop --extras=test

14 changes: 0 additions & 14 deletions h2o-data-rust/README.md

This file was deleted.

348 changes: 0 additions & 348 deletions poetry.lock

This file was deleted.

37 changes: 20 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
[tool.poetry]
[build-system]
requires = ["maturin>=1.0,<2.0"]
build-backend = "maturin"

[project]
name = "farsante"
version = "0.2.0"
description = "Fake DataFrame generators for Pandas and PySpark"
authors = ["MrPowers <matthewkevinpowers@gmail.com>"]

[tool.poetry.dependencies]
python = ">=3.8 <4.0"
mimesis = "6.0.0"
pyspark = "^3.3.1"
pandas = ">=1.0.0"
pyarrow = "11.0.0"
maturin = "^1.3.2"
authors = [{ name = "MrPowers", email = "matthewkevinpowers@gmail.com" }]
requires-python = ">=3.8,<4.0"
dependencies = [
"mimesis == 6.0.0",
"pyspark >= 3.3",
"pandas >=1.0.0",
"pyarrow >= 11.0.0",
"maturin >= 1.3.2",
]

[tool.poetry.dev-dependencies]
pytest = "7.2.0"

[build-system]
requires = ["maturin>=1.0,<2.0"]
build-backend = "maturin"
# requires = ["poetry>=0.12"]
[project.optional-dependencies]
test = ["pytest >= 7.2"]

[tool.maturin]
# "extension-module" tells pyo3 we want to build an extension module (skips linking against libpython.so)
features = ["pyo3/extension-module"]
python-source = "python"
python-packages = ["farsante"]
module-name = "farsante_rs"
bindings = "pyo3"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from h2o import generate_csv_py
from concurrent.futures import ProcessPoolExecutor
from itertools import repeat

from farsante_rs import generate_csv_py


def pretty_sci(n: int) -> str:
if n == 0:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from farsante import generate_all_h2o_datasets
import argparse

from farsante import generate_all_h2o_datasets


def main():
parser = argparse.ArgumentParser(description="Generate all h2o datasets")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions h2o-data-rust/src/lib.rs → src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ fn hello_rust() -> () {
}

#[pymodule]
#[pyo3(name = "farsante_rs")]
fn h2o(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(generate_csv_py, m)?)?;
m.add_function(wrap_pyfunction!(hello_rust, m)?)?;
Expand Down
File renamed without changes.

0 comments on commit aa42c75

Please sign in to comment.