Skip to content

Commit

Permalink
chore: Add MarkDown linter support via dprint. (#5576)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghuls committed Nov 22, 2022
1 parent a2e4702 commit 4e35d9c
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-global.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Lint global
on:
pull_request:
paths:
- '**.toml' # This workflow currently only lints TOML files
- ['**.md', '**.toml'] # This workflow currently only lints markdown and TOML files
- '.github/workflows/lint-global.yaml'

concurrency:
Expand Down
20 changes: 10 additions & 10 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities
Expand Down
5 changes: 1 addition & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ If you're unclear on how to proceed after reading this guide, please contact us
- [Contributing to the codebase](#contributing-to-the-codebase)
- [Contributing to documentation](#contributing-to-documentation)


## Reporting bugs

We use [GitHub issues](https://github.com/pola-rs/polars/issues) to track bugs and suggested enhancements.
Expand All @@ -22,7 +21,6 @@ If you find a closed issue that seems to report the same bug you're experiencing

Please include as many details as possible in your bug report. The information helps the maintainers resolve the issue faster.


## Suggesting enhancements

We use [GitHub issues](https://github.com/pola-rs/polars/issues) to track bugs and suggested enhancements.
Expand All @@ -31,7 +29,6 @@ Before creating an enhancement suggestion, please check that a similar issue doe

Please describe the behavior you want and why, and provide examples of how Polars would be used if your feature were added.


## Contributing to the codebase

### Picking an issue
Expand Down Expand Up @@ -87,6 +84,7 @@ make test
```

This will do a number of things:

- Use Python to create a virtual environment in the `py-polars/venv` folder.
- Use [pip](https://pip.pypa.io/) to install all Python dependencies for development, linting, and building documentation.
- Use Rust to compile and install Polars in your virtual environment.
Expand Down Expand Up @@ -148,7 +146,6 @@ Once all issues are resolved, the maintainer will merge your pull request, and y
Keep in mind that your work does not have to be perfect right away!
If you are stuck or unsure about your solution, feel free to open a draft pull request and ask for help.


## Contributing to documentation

The most important components of Polars documentation are the [user guide](https://pola-rs.github.io/polars-book/user-guide/), the API references, and the database of questions on [StackOverflow](https://stackoverflow.com/).
Expand Down
96 changes: 46 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@
</p>

## Polars: Blazingly fast DataFrames in Rust, Python & Node.js

Polars is a blazingly fast DataFrames library implemented in Rust using
[Apache Arrow Columnar Format](https://arrow.apache.org/docs/format/Columnar.html) as the memory model.

* Lazy | eager execution
* Multi-threaded
* SIMD
* Query optimization
* Powerful expression API
* Hybrid Streaming (larger than RAM datasets)
* Rust | Python | NodeJS | ...
- Lazy | eager execution
- Multi-threaded
- SIMD
- Query optimization
- Powerful expression API
- Hybrid Streaming (larger than RAM datasets)
- Rust | Python | NodeJS | ...

To learn more, read the [User Guide](https://pola-rs.github.io/polars-book/).

Expand Down Expand Up @@ -96,10 +97,8 @@ shape: (5, 8)
├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
"banana""beetle""fruits"114811
└──────────┴──────────┴──────────────┴─────┴─────────────┴─────────────┴─────────────┴─────────────┘

```


## Performance 🚀🚀

Polars is very fast. In fact, it is one of the best performing solutions available.
Expand All @@ -111,11 +110,11 @@ on full queries (including IO).
Besides fast, polars is also very lightweight. It comes with zero required dependencies, and this shows in the import times:

### import time measurements:

- polars: 70ms
- numpy: 104ms
- pandas: 520ms


## Python setup

Install the latest polars version with:
Expand All @@ -127,27 +126,27 @@ pip install polars
We also have a conda package (`conda install polars`), however pip is the preferred way to install Polars.

### Install Polars with all optional dependencies.

```sh
pip install 'polars[all]'
pip install 'polars[numpy,pandas,pyarrow]' # install a subset of all optional dependencies
```
You can also install the dependencies directly.

| Tag | Description |
| ----------- | ----------- |
| all | Install all optional dependencies (all of the following) |
| pandas | Install with Pandas for converting data to and from Pandas Dataframes/Series |
| numpy | Install with numpy for converting data to and from numpy arrays |
| pyarrow | Reading data formats using PyArrow |
| fsspec | Support for reading from remote file systems |
| connectorx | Support for reading from SQL databases |
| xlsx2csv | Support for reading from Excel files |
| timezone | Timezone support, only needed if 1. you are on Python < 3.9 and/or 2. you are on Windows, otherwise no dependencies will be installed |
You can also install the dependencies directly.

| Tag | Description |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| all | Install all optional dependencies (all of the following) |
| pandas | Install with Pandas for converting data to and from Pandas Dataframes/Series |
| numpy | Install with numpy for converting data to and from numpy arrays |
| pyarrow | Reading data formats using PyArrow |
| fsspec | Support for reading from remote file systems |
| connectorx | Support for reading from SQL databases |
| xlsx2csv | Support for reading from Excel files |
| timezone | Timezone support, only needed if 1. you are on Python < 3.9 and/or 2. you are on Windows, otherwise no dependencies will be installed |

Releases happen quite often (weekly / every few days) at the moment, so updating polars regularly to get the latest bugfixes / features might not be a bad idea.


## Rust setup

You can take latest release from `crates.io`, or if you want to use the latest features / performance improvements
Expand All @@ -157,97 +156,94 @@ point to the `master` branch of this repo.
polars = { git = "https://github.com/pola-rs/polars", rev = "<optional git tag>" }
```


#### Rust version

Required Rust version `>=1.58`


## Documentation

Want to know about all the features Polars supports? Read the docs!

## Larger than RAM data

If you have data that does not fit into memory, polars lazy is able to process your query (or parts of your query) in a
streaming fashion, this drastically reduces memory requirements you might be able to process your 250GB dataset on your
laptop. Collect with `collect(allow_streaming=True)` to run the query streaming. (This might be a little slower, but
it is still very fast!)

#### Python

* Installation guide: `pip install polars`
* [Python documentation](https://pola-rs.github.io/polars/py-polars/html/reference/index.html)
* [User guide](https://pola-rs.github.io/polars-book/)
- Installation guide: `pip install polars`
- [Python documentation](https://pola-rs.github.io/polars/py-polars/html/reference/index.html)
- [User guide](https://pola-rs.github.io/polars-book/)

#### Rust

* [Rust documentation (master branch)](https://pola-rs.github.io/polars/polars/index.html)
* [User guide](https://pola-rs.github.io/polars-book/)
- [Rust documentation (master branch)](https://pola-rs.github.io/polars/polars/index.html)
- [User guide](https://pola-rs.github.io/polars-book/)

#### Node

* Installation guide: `yarn add nodejs-polars`
* [Node documentation](https://pola-rs.github.io/nodejs-polars/index.html)
* [User guide](https://pola-rs.github.io/polars-book/)
* [Github](https://github.com/pola-rs/nodejs-polars)

- Installation guide: `yarn add nodejs-polars`
- [Node documentation](https://pola-rs.github.io/nodejs-polars/index.html)
- [User guide](https://pola-rs.github.io/polars-book/)
- [Github](https://github.com/pola-rs/nodejs-polars)

## Contribution

Want to contribute? Read our [contribution guideline](https://github.com/pola-rs/polars/blob/master/CONTRIBUTING.md).


## \[Python\]: compile polars from source

If you want a bleeding edge release or maximal performance you should compile **polars** from source.

This can be done by going through the following steps in sequence:

1. Install the latest [Rust compiler](https://www.rust-lang.org/tools/install)
2. Install [maturin](https://maturin.rs/): `pip install maturin`
3. Choose any of:
* Fastest binary, very long compile times:
```sh
$ cd py-polars && maturin develop --release -- -C target-cpu=native
```
* Fast binary, Shorter compile times:
```sh
$ cd py-polars && maturin develop --release -- -C codegen-units=16 -C lto=thin -C target-cpu=native
```
1. Install the latest [Rust compiler](https://www.rust-lang.org/tools/install)
2. Install [maturin](https://maturin.rs/): `pip install maturin`
3. Choose any of:
- Fastest binary, very long compile times:
```sh
$ cd py-polars && maturin develop --release -- -C target-cpu=native
```
- Fast binary, Shorter compile times:
```sh
$ cd py-polars && maturin develop --release -- -C codegen-units=16 -C lto=thin -C target-cpu=native
```

Note that the Rust crate implementing the Python bindings is called `py-polars` to distinguish from the wrapped
Rust crate `polars` itself. However, both the Python package and the Python module are named `polars`, so you
can `pip install polars` and `import polars`.


## Arrow2

Polars has transitioned to [arrow2](https://crates.io/crates/arrow2).
Arrow2 is a faster and safer implementation of the [Apache Arrow Columnar Format](https://arrow.apache.org/docs/format/Columnar.html).
Arrow2 also has a more granular code base, helping to reduce the compiler bloat.

## Use custom Rust function in python?

See [this example](./examples/python_rust_compiled_function).

# Going big...

Do you expect more than `2^32` ~4,2 billion rows? Compile polars with the `bigidx` feature flag.

Or for python users install `pip install polars-u64-idx`.

Don't use this unless you hit the row boundary as the default polars is faster and consumes less memory.

# Legacy
Do you want polars to run on an old CPU (e.g. dating from before 2011)? Install `pip polars-lts-cpu`. This polars project is

Do you want polars to run on an old CPU (e.g. dating from before 2011)? Install `pip polars-lts-cpu`. This polars project is
compiled without [avx](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions) target features.

## Acknowledgements

Development of Polars is proudly powered by


[![Xomnia](https://raw.githubusercontent.com/pola-rs/polars-static/master/sponsors/xomnia.png)](https://www.xomnia.com/)


## Sponsors

[<img src="https://raw.githubusercontent.com/pola-rs/polars-static/master/sponsors/xomnia.png" height="40" />](https://www.xomnia.com/) &emsp; [<img src="https://www.jetbrains.com/company/brand/img/jetbrains_logo.png" height="50" />](https://www.jetbrains.com)
5 changes: 3 additions & 2 deletions dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
"incremental": true,
"toml": {},
"includes": [
"**/*.{toml}"
"**/*.{md,toml}"
],
"excludes": [],
"plugins": [
"https://plugins.dprint.dev/toml-0.5.4.wasm"
"https://plugins.dprint.dev/markdown-0.14.1.wasm"
"https://plugins.dprint.dev/toml-0.5.4.wasm",
]
}
14 changes: 11 additions & 3 deletions examples/python_rust_compiled_function/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Compile Custom Rust functions and use in python polars

## Compile a development binary in your current environment
`$ pip install -U maturin && maturin develop`

```sh
pip install -U maturin && maturin develop
```

## Run
`$ python example.py`

```sh
python example.py
```

## Compile a **release** build
`$ maturin develop --release`

```sh
maturin develop --release
```
4 changes: 2 additions & 2 deletions polars/polars-sql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ shape: (14863778, 18)
Or pipe your SQL command directly inline:

```bash
$ echo "SELECT MIN(Close) as low, MAX(Close) as high from '/home/ritchie46/example/BTUSD.csv' WHERE Date > '2014' AND Date < '2015'" | ./polars-sql
```
$ echo "SELECT MIN(Close) as low, MAX(Close) as high from '/home/ritchie46/example/BTUSD.csv' WHERE Date > '2014' AND Date < '2015'" | ./polars-sql
```

0 comments on commit 4e35d9c

Please sign in to comment.