Skip to content

Commit

Permalink
📝(project) add mkdocs-based documentation
Browse files Browse the repository at this point in the history
We needed a tutorial to guide users step-by-step and a reference guide
for configuration.
  • Loading branch information
jmaupetit committed Jul 3, 2024
1 parent 3fe3361 commit f010a82
Show file tree
Hide file tree
Showing 17 changed files with 1,746 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cli.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: cli
name: CLI

on:
push:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Update documentation

on:
push:
tags:
- "v*"

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "poetry"
- name: Install dependencies
run: poetry install
- name: Update documentation
run: poetry run mkdocs gh-deploy --force
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish python package
name: Publish

on:
push:
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: data7
name: Quality

on:
push:
Expand All @@ -27,6 +24,21 @@ jobs:
- name: Install dependencies
run: poetry install

docs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "poetry"
- name: Build documentation
run: make docs

lint:
needs: build
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ venv.bak/

# -- Tools
.coverage
site

# dynaconf files
.secrets.yaml
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to

## [Unreleased]

### Added

- Add project documentation

## [0.2.0] - 2024-07-01

### Added
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ check: ## check data7 configuration
poetry run data7 check
.PHONY: check


docs: ## build Data7 documentation
poetry run mkdocs build
.PHONY: docs

docs-serve: ## run Data7 documentation server
poetry run mkdocs serve -a localhost:8888
.PHONY: docs-serve

run: ## run the api server
poetry run data7 run --log-level debug
.PHONY: run
Expand Down
97 changes: 34 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,95 +1,66 @@
# Data7 - Dynamic datasets the easy way
# Data7 ⚡ Open your data in minutes

> Pronounced data·set (**7** like **sept** in French).
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/jmaupetit/data7/quality.yml)
![PyPI - Version](https://img.shields.io/pypi/v/data7)


## The idea 💡

**TL;DR** Data7 is a high performance web server that generates dynamic datasets
(in [CSV](https://en.wikipedia.org/wiki/Comma-separated_values) or
[Parquet](https://en.wikipedia.org/wiki/Apache_Parquet) formats) from existing
databases and stream them over HTTP 🎉

### Example usage

Let say you have a `restaurant` table in your `wonderful-places` PostgreSQL
database, and you want to make this table an always-up-to-date dataset that can
be easily used by the rest of the world. All you have to do is edit Data7
configuration as follow:

```yaml
#
# Data7 configuration file
#
# config.yaml
#
datasets:
- basename: restaurants
query: "SELECT * FROM restaurant"
```
Fire up the `data7` server:
## A quick example

```
data7 start
```
And :boom: your dataset is available at:
- [https://data7.wonderful-places.org/d/restaurants.csv](https://data7.wonderful-places.org/d/restaurants.csv)
- [https://data7.wonderful-places.org/d/restaurants.parquet](https://data7.wonderful-places.org/d/restaurants.parquet)
Let say you have a `restaurant` table in your PostgreSQL database, and you want
to make this table an always-up-to-date dataset that can be easily used by the
rest of the world.

## Getting started
To quickly start contributing to this project, we got you covered! Once you've
cloned the project, use GNU Make to ease your life (`make` and `curl` are
required).
All you have to do is to initialize your project:

```sh
# Clone the project somewhere on your system
git clone git@github.com:jmaupetit/data7.git
# Enter the project's root directory
cd data7
# Prepare your working environment
make bootstrap
data7 init
```

You can now start the development server:
✍️ Edit configuration files:

```sh
make run
```yaml
# settings.yaml
production:
host: "https://data7.wonderful-places.org"
port: 80

# .secrets.yaml
production:
DATABASE_URL: "postgresql+asyncpg://user:pass@server:port/wonderful-places"

# data7.yaml
production:
datasets:
- basename: restaurants
query: "SELECT * FROM restaurant"
```
Test development endpoints:
🏎️ Fire up the `data7` server:

```sh
# CSV format (displayed in the terminal)
curl http://localhost:8000/d/invoices.csv

# Parquet format (downloaded locally)
curl -O http://localhost:8000/d/invoices.parquet

# Check that the file exists
ls invoices.parquet
data7 run
```

You can run quality checks using dedicated GNU Make rules:
💥 Your dataset is available at:

```sh
# Run the tests suite
make test
- [https://data7.wonderful-places.org/d/restaurants.csv](https://data7.wonderful-places.org/d/restaurants.csv)
(CSV)
- [https://data7.wonderful-places.org/d/restaurants.parquet](https://data7.wonderful-places.org/d/restaurants.parquet)
(Parquet)

# Linters!
make lint
```
## Documentation

Happy hacking 😻
The complete documentation of the project is avaiable at:
[https://jmaupetit.github.io/data7/](https://jmaupetit.github.io/data7/)

## License

This work is released under the MIT License (see [LICENSE](./LICENSE)).
This work is released under the MIT License.
132 changes: 132 additions & 0 deletions docs/code_of_conduct.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

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

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[abuse+data7@maupetit.net](mailto:abuse+data7@maupetit.net). All complaints will
be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
Loading

0 comments on commit f010a82

Please sign in to comment.