Skip to content

Commit

Permalink
Pick better names.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigogiraoserrao committed Sep 20, 2024
1 parent 36d7a62 commit 4d3f2c6
Show file tree
Hide file tree
Showing 200 changed files with 142 additions and 143 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/docs-global.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
ref: ${{ github.event.client_payload.sha }}
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
config-file: docs/docs/mlc-config.json
config-file: docs/source/mlc-config.json
folder-path: docs

lint:
Expand All @@ -39,13 +39,13 @@ jobs:
- uses: chartboost/ruff-action@v1
with:
src: docs/docs/
src: docs/source/
version: ${{ steps.version.outputs.version }}
args: check --no-fix

- uses: chartboost/ruff-action@v1
with:
src: docs/docs/
src: docs/source/
version: ${{ steps.version.outputs.version }}
args: format --diff

Expand All @@ -69,7 +69,7 @@ jobs:
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/.venv" >> $GITHUB_ENV
- name: Install Python dependencies
run: uv pip install -r py-polars/requirements-dev.txt -r docs/docs/requirements.txt
run: uv pip install -r py-polars/requirements-dev.txt -r docs/source/requirements.txt

- name: Set up Rust
run: rustup show
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
paths:
- crates/**
- docs/docs/src/rust/**
- docs/source/src/rust/**
- examples/**
- py-polars/src/**
- py-polars/Cargo.toml
Expand All @@ -15,7 +15,7 @@ on:
- main
paths:
- crates/**
- docs/docs/src/rust/**
- docs/source/src/rust/**
- examples/**
- py-polars/src/**
- py-polars/Cargo.toml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
paths:
- Cargo.lock
- py-polars/**
- docs/docs/src/python/**
- docs/source/src/python/**
- crates/**
- .github/workflows/test-python.yml
push:
Expand All @@ -14,7 +14,7 @@ on:
paths:
- Cargo.lock
- crates/**
- docs/docs/src/python/**
- docs/source/src/python/**
- py-polars/**
- .github/workflows/test-python.yml

Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ target/
*.tbl

# Project
/docs/docs-res/data/
/docs/docs-res/people.md
/docs/assets/data/
/docs/assets/people.md
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
resolver = "2"
members = [
"crates/*",
"docs/docs/src/rust",
"docs/source/src/rust",
# "examples/*",
"py-polars",
]
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ requirements: .venv ## Install/refresh Python project requirements
-r py-polars/requirements-dev.txt \
-r py-polars/requirements-lint.txt \
-r py-polars/docs/requirements-docs.txt \
-r docs/docs/requirements.txt
-r docs/source/requirements.txt

.PHONY: requirements-all
requirements-all: .venv ## Install/refresh all Python requirements (including those needed for CI tests)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ shape: (5, 8)
## SQL

```python
>>> df = pl.scan_csv("docs/docs-res/data/iris.csv")
>>> df = pl.scan_csv("docs/assets/data/iris.csv")
>>> ## OPTION 1
>>> # run SQL queries on frame-level
>>> df.sql("""
Expand Down Expand Up @@ -141,14 +141,14 @@ SQL commands can also be run directly from your terminal using the Polars CLI:

```bash
# run an inline SQL query
> polars -c "SELECT species, AVG(sepal_length) AS avg_sepal_length, AVG(sepal_width) AS avg_sepal_width FROM read_csv('docs/docs-res/data/iris.csv') GROUP BY species;"
> polars -c "SELECT species, AVG(sepal_length) AS avg_sepal_length, AVG(sepal_width) AS avg_sepal_width FROM read_csv('docs/assets/data/iris.csv') GROUP BY species;"

# run interactively
> polars
Polars CLI v0.3.0
Type .help for help.

> SELECT species, AVG(sepal_length) AS avg_sepal_length, AVG(sepal_width) AS avg_sepal_width FROM read_csv('docs/docs-res/data/iris.csv') GROUP BY species;
> SELECT species, AVG(sepal_length) AS avg_sepal_length, AVG(sepal_width) AS avg_sepal_width FROM read_csv('docs/assets/data/iris.csv') GROUP BY species;
```

Refer to the [Polars CLI repository](https://github.com/pola-rs/polars-cli) for more information.
Expand Down
4 changes: 2 additions & 2 deletions crates/polars/tests/it/io/parquet/arrow/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn all_types() -> PolarsResult<()> {
use crate::io::parquet::read::file::FileReader;

let dir = env!("CARGO_MANIFEST_DIR");
let path = PathBuf::from(dir).join("../../docs/docs-res/data/alltypes_plain.parquet");
let path = PathBuf::from(dir).join("../../docs/assets/data/alltypes_plain.parquet");

let mut reader = std::fs::File::open(path)?;

Expand Down Expand Up @@ -55,7 +55,7 @@ fn all_types_chunked() -> PolarsResult<()> {

use crate::io::parquet::read::file::FileReader;
let dir = env!("CARGO_MANIFEST_DIR");
let path = PathBuf::from(dir).join("../../docs/docs-res/data/alltypes_plain.parquet");
let path = PathBuf::from(dir).join("../../docs/assets/data/alltypes_plain.parquet");
let mut reader = std::fs::File::open(path)?;

let metadata = read_metadata(&mut reader)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/polars/tests/it/io/parquet/read/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn hybrid_rle_iter(d: HybridRleDecoder) -> ParquetResult<std::vec::IntoIter<

pub fn get_path() -> PathBuf {
let dir = env!("CARGO_MANIFEST_DIR");
PathBuf::from(dir).join("../../docs/docs-res/data")
PathBuf::from(dir).join("../../docs/assets/data")
}

/// Reads a page into an [`Array`].
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions docs/docs/user-guide/lazy/streaming.md

This file was deleted.

File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
)

# Load all links to reference docs
with open("docs/docs/_build/API_REFERENCE_LINKS.yml", "r") as f:
with open("docs/source/_build/API_REFERENCE_LINKS.yml", "r") as f:
API_REFERENCE_LINKS = yaml.load(f, Loader=yaml.CLoader)


Expand Down Expand Up @@ -169,7 +169,7 @@ def code_block(

for language, info in LANGUAGES.items():
base_path = f"{language}/{path}{info['extension']}"
full_path = "docs/docs/src/" + base_path
full_path = "docs/source/src/" + base_path
# Check if file exists for the language
if os.path.exists(full_path):
result.append(code_tab(base_path, section, info, api_functions))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
def get_people_md():
repo = g.get_repo("pola-rs/polars")
contributors = repo.get_contributors()
with open("./docs/docs-res/people.md", "w") as f:
with open("./docs/assets/people.md", "w") as f:
for c in itertools.islice(contributors, 50):
# We love dependabot, but he doesn't need a spot on our website
if c.login == "dependabot[bot]":
Expand All @@ -29,11 +29,11 @@ def get_people_md():


def on_startup(command, dirty):
"""Mkdocs hook to autogenerate docs/docs-res/people.md on startup"""
"""Mkdocs hook to autogenerate docs/assets/people.md on startup"""
try:
get_people_md()
except Exception as e:
msg = f"WARNING:{__file__}: Could not generate docs/docs-res/people.md. Got error: {str(e)}"
msg = f"WARNING:{__file__}: Could not generate docs/assets/people.md. Got error: {str(e)}"
print(msg)


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ The most important components of Polars documentation are the [user guide](https

### User guide

The user guide is maintained in the `docs/user-guide` folder. Before creating a PR first raise an issue to discuss what you feel is missing or could be improved.
The user guide is maintained in the `docs/source/user-guide` folder. Before creating a PR first raise an issue to discuss what you feel is missing or could be improved.

#### Building and serving the user guide

Expand Down Expand Up @@ -244,15 +244,15 @@ To add a code block with code to be run in a shell with tabs for Python and Rust

#### Adding a code block

The snippets for Python and Rust code blocks are in the `docs/src/python/` and `docs/src/rust/` directories, respectively. To add a code snippet with Python or Rust code to a `.md` page, use the following format:
The snippets for Python and Rust code blocks are in the `docs/assets/src/python/` and `docs/assets/src/rust/` directories, respectively. To add a code snippet with Python or Rust code to a `.md` page, use the following format:

```
{{code_block('user-guide/io/cloud-storage','read_parquet',['read_parquet','read_csv'])}}
```

- The first argument is a path to either or both files called `docs/src/python/user-guide/io/cloud-storage.py` and `docs/src/rust/user-guide/io/cloud-storage.rs`.
- The first argument is a path to either or both files called `docs/assets/src/python/user-guide/io/cloud-storage.py` and `docs/assets/src/rust/user-guide/io/cloud-storage.rs`.
- The second argument is the name given at the start and end of each snippet in the `.py` or `.rs` file
- The third argument is a list of links to functions in the API docs. For each element of the list there must be a corresponding entry in `docs/_build/API_REFERENCE_LINKS.yml`
- The third argument is a list of links to functions in the API docs. For each element of the list there must be a corresponding entry in `docs/source/_build/API_REFERENCE_LINKS.yml`

If the corresponding `.py` and `.rs` snippet files both exist then each snippet named in the second argument to `code_block` above must exist or the build will fail. An empty snippet should be added to the `.py` or `.rs` file if the snippet is not needed.

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/docs/index.md → docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ A more extensive introduction can be found in the [next chapter](user-guide/gett

Polars has a very active community with frequent releases (approximately weekly). Below are some of the top contributors to the project:

--8<-- "docs/docs-res/people.md"
--8<-- "docs/assets/people.md"

## Contributing

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.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import polars as pl

q = (
pl.scan_csv("docs/docs-res/data/iris.csv")
pl.scan_csv("docs/assets/data/iris.csv")
.filter(pl.col("sepal_length") > 5)
.group_by("species")
.agg(pl.all().sum())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

# --8<-- [start:eager]

df = pl.read_csv("docs/docs-res/data/iris.csv")
df = pl.read_csv("docs/assets/data/iris.csv")
df_small = df.filter(pl.col("sepal_length") > 5)
df_agg = df_small.group_by("species").agg(pl.col("sepal_width").mean())
print(df_agg)
# --8<-- [end:eager]

# --8<-- [start:lazy]
q = (
pl.scan_csv("docs/docs-res/data/iris.csv")
pl.scan_csv("docs/assets/data/iris.csv")
.filter(pl.col("sepal_length") > 5)
.group_by("species")
.agg(pl.col("sepal_width").mean())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# --8<-- [start:streaming]
q1 = (
pl.scan_csv("docs/docs-res/data/iris.csv")
pl.scan_csv("docs/assets/data/iris.csv")
.filter(pl.col("sepal_length") > 5)
.group_by("species")
.agg(pl.col("sepal_width").mean())
Expand All @@ -19,7 +19,7 @@
# --8<-- [end:example]

# --8<-- [start:example2]
q2 = pl.scan_csv("docs/docs-res/data/iris.csv").with_columns(
q2 = pl.scan_csv("docs/assets/data/iris.csv").with_columns(
pl.col("sepal_length").mean().over("species")
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@
# --8<-- [end:dataframe]

# --8<-- [start:csv]
df.write_csv("docs/docs-res/data/output.csv")
df_csv = pl.read_csv("docs/docs-res/data/output.csv")
df.write_csv("docs/assets/data/output.csv")
df_csv = pl.read_csv("docs/assets/data/output.csv")
print(df_csv)
# --8<-- [end:csv]

# --8<-- [start:csv2]
df_csv = pl.read_csv("docs/docs-res/data/output.csv", try_parse_dates=True)
df_csv = pl.read_csv("docs/assets/data/output.csv", try_parse_dates=True)
print(df_csv)
# --8<-- [end:csv2]

# --8<-- [start:json]
df.write_json("docs/docs-res/data/output.json")
df_json = pl.read_json("docs/docs-res/data/output.json")
df.write_json("docs/assets/data/output.json")
df_json = pl.read_json("docs/assets/data/output.json")
print(df_json)
# --8<-- [end:json]

# --8<-- [start:parquet]
df.write_parquet("docs/docs-res/data/output.parquet")
df_parquet = pl.read_parquet("docs/docs-res/data/output.parquet")
df.write_parquet("docs/assets/data/output.parquet")
df_parquet = pl.read_parquet("docs/assets/data/output.parquet")
print(df_parquet)
# --8<-- [end:parquet]
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

"""
# --8<-- [start:read]
df = pl.read_csv("docs/docs-res/data/path.csv")
df = pl.read_csv("docs/assets/data/path.csv")
# --8<-- [end:read]
"""

# --8<-- [start:write]
df = pl.DataFrame({"foo": [1, 2, 3], "bar": [None, "bak", "baz"]})
df.write_csv("docs/docs-res/data/path.csv")
df.write_csv("docs/assets/data/path.csv")
# --8<-- [end:write]

# --8<-- [start:scan]
df = pl.scan_csv("docs/docs-res/data/path.csv")
df = pl.scan_csv("docs/assets/data/path.csv")
# --8<-- [end:scan]
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@

"""
# --8<-- [start:read]
df = pl.read_excel("docs/docs-res/data/path.xlsx")
df = pl.read_excel("docs/assets/data/path.xlsx")
# --8<-- [end:read]
# --8<-- [start:read_sheet_name]
df = pl.read_excel("docs/docs-res/data/path.xlsx", sheet_name="Sales")
df = pl.read_excel("docs/assets/data/path.xlsx", sheet_name="Sales")
# --8<-- [end:read_sheet_name]
"""

# --8<-- [start:write]
df = pl.DataFrame({"foo": [1, 2, 3], "bar": [None, "bak", "baz"]})
df.write_excel("docs/docs-res/data/path.xlsx")
df.write_excel("docs/assets/data/path.xlsx")
# --8<-- [end:write]

"""
# --8<-- [start:write_sheet_name]
df = pl.DataFrame({"foo": [1, 2, 3], "bar": [None, "bak", "baz"]})
df.write_excel("docs/docs-res/data/path.xlsx", worksheet="Sales")
df.write_excel("docs/assets/data/path.xlsx", worksheet="Sales")
# --8<-- [end:write_sheet_name]
"""
Loading

0 comments on commit 4d3f2c6

Please sign in to comment.