Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📝 Add configuration code for termynal #204

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 32 additions & 54 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,27 @@
If you already cloned the repository and you know that you need to deep dive
into the code, here is a guideline to set up your environment:

### Virtual environment with `venv`
## Developing

You can create a virtual environment in a directory using Python's `venv`
If you already cloned the repository and you know that you need to deep dive
into the code, here is a guideline to set up your environment:

### Virtual environment with `uv`

You can create a virtual environment in a directory using Python's [`uv`](https://github.com/astral-sh/uv)
module:

<div class="termy">

```console
python -m venv env
pip install uv

uv venv
```

</div>

That will create a directory `./env/` with the python binaries and then you will
That will create a directory `.venv` with the python binaries and then you will
be able to install packages for that isolated environment.

### Activate the environment
Expand All @@ -28,7 +35,7 @@ Activate the new environment with:
<div class="termy">

```console
$ source ./env/bin/activate
$ source ./.venv/bin/activate
```

</div>
Expand All @@ -38,7 +45,7 @@ Activate the new environment with:
<div class="termy">

```console
$ .\env\Scripts\Activate.ps1
$ .\.venv\Scripts\Activate.ps1
```

</div>
Expand All @@ -50,7 +57,7 @@ Activate the new environment with:
<div class="termy">

```console
$ source ./env/Scripts/activate
$ source ./.venv/Scripts/activate
```

</div>
Expand All @@ -77,20 +84,23 @@ To check it worked, use:

</div>

If it shows the `pip` binary at `env/bin/pip` then it worked. 🎉
If it shows the `pip` binary at `venv/bin/pip` then it worked. 🎉

> Every time you install a new package with `pip` under that environment, activate the environment again.
!!! tip

- This makes sure that if you use a terminal program installed by that package (like `pre-commit`), you use the one from your local environment and not any other that could be installed globally.
Every time you install a new package with `pip` under that environment,
activate the environment again.

This makes sure that if you use a terminal program installed by that package (like `pre-commit`), you use the one from your local environment and not any other that could be installed globally.

### pip

After activating the environment as described above, Now lets install all the package that you need to develop Ormdantic:
After activating the environment as described above, Now lets install all the package that you need to develop ormdantic:

<div class="termy">

```console
$ pip install -e .[sqlite,postgresql,test,lint,docs]
$ uv pip install -r requirements/all.txt

---> 100%
```
Expand All @@ -102,9 +112,9 @@ It will install all the dependencies in your local environment.
#### Including

The Dependencies file contains all the dependencies that you need to develop
Ormdantic, which are:
ormdantic, which are:

- The Base Dependencies - the ones that are needed to run Ormdantic.
- The Base Dependencies - the ones that are needed to run ormdantic.
[See Installation](installation.md).

### Format
Expand All @@ -123,7 +133,7 @@ Now, install the pre-commit hooks in your `.git/hooks/` directory:
<div class="termy">

```console
pre-commit install
$ pre-commit install
```

</div>
Expand All @@ -150,59 +160,27 @@ All the documentation is in Markdown format in the directory `./docs`.

### Including

To Build Ormdantic Documentation we need the following packages, which are:
To Build ormdantic Documentation we need the following packages, which are:

- `mkdocs` - The tool that builds the documentation.
- `mkdocs-material` - The theme that Ormdantic uses.
- `mkdocs-material` - The theme that ormdantic uses.
- `mkdocs-markdownextradata-plugin` - The plugin that allows to add extra data
to the documentation.

#### Tips and guideline

- Check the currently
<a href="https://github.com/yezz123/Ormdantic/pulls" class="external-link" target="_blank">existing
pull requests</a> for your language and add reviews requesting changes or
approving them.

> You can <a href="https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request" class="external-link" target="_blank">add comments with change suggestions</a> to existing pull requests.

> Check the docs about <a href="https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-request-reviews" class="external-link" target="_blank">adding a pull request review</a> to approve it or request changes.

> Check in the <a href="https://github.com/yezz123/Ormdantic/issues" class="external-link" target="_blank">issues</a> to see if there's one coordinating translations for your language.

- Add a single pull request per page translated. That will make it much easier
for others to review it.

For the languages I don't speak, I'll wait for several others to review the
translation before merging.

- You can also check if there are translations for your language and add a
review to them, that will help me know that the translation is correct and I
can merge it.

- Use the same Python examples and only translate the text in the docs. You
don't have to change anything for this to work.

- Use the same images, file names, and links. You don't have to change anything
for it to work.

- To check the 2-letter code for the language you want to translate you can use
the table
<a href="https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes" class="external-link" target="_blank">List
of ISO 639-1 codes</a>.

## Testing

all the dependencies that you need to test Ormdantic, which are:
all the dependencies that you need to test ormdantic, which are:

### Including

- `pytest` - The tool that runs the tests.
- `pytest-asyncio` - The plugin that runs the tests in the background.

and other dependencies that are needed to run the tests.

### Generate a Test Report

As we know, the tests are very important to make sure that Ormdantic works as
As we know, the tests are very important to make sure that ormdantic works as
expected, that why i provide a multi test for and functions to provide a good
test.

Expand All @@ -211,7 +189,7 @@ If you want to generate the test report:
<div class="termy">

```console
bash scripts/test.sh
$ bash scripts/test.sh
```

</div>
20 changes: 20 additions & 0 deletions docs/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.termynal-comment {
color: #4a968f;
font-style: italic;
display: block;
}

.termy {
/* For right to left languages */
direction: ltr;
}

.termy [data-termynal] {
white-space: pre-wrap;
}

/* Right to left languages */
code {
direction: ltr;
display: inline-block;
}
109 changes: 109 additions & 0 deletions docs/css/termynal.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/**
* termynal.js
*
* @author Ines Montani <[email protected]>
* @version 0.0.1
* @license MIT
*/

:root {
--color-bg: #252a33;
--color-text: #eee;
--color-text-subtle: #a2a2a2;
}

[data-termynal] {
width: 750px;
max-width: 100%;
background: var(--color-bg);
color: var(--color-text);
/* font-size: 18px; */
font-size: 15px;
/* font-family: 'Fira Mono', Consolas, Menlo, Monaco, 'Courier New', Courier, monospace; */
font-family: "Roboto Mono", "Fira Mono", Consolas, Menlo, Monaco,
"Courier New", Courier, monospace;
border-radius: 4px;
padding: 75px 45px 35px;
position: relative;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}

[data-termynal]:before {
content: "";
position: absolute;
top: 15px;
left: 15px;
display: inline-block;
width: 15px;
height: 15px;
border-radius: 50%;
/* A little hack to display the window buttons in one pseudo element. */
background: #d9515d;
-webkit-box-shadow: 25px 0 0 #f4c025, 50px 0 0 #3ec930;
box-shadow: 25px 0 0 #f4c025, 50px 0 0 #3ec930;
}

[data-termynal]:after {
content: "bash";
position: absolute;
color: var(--color-text-subtle);
top: 5px;
left: 0;
width: 100%;
text-align: center;
}

a[data-terminal-control] {
text-align: right;
display: block;
color: #aebbff;
}

[data-ty] {
display: block;
line-height: 2;
}

[data-ty]:before {
/* Set up defaults and ensure empty lines are displayed. */
content: "";
display: inline-block;
vertical-align: middle;
}

[data-ty="input"]:before,
[data-ty-prompt]:before {
margin-right: 0.75em;
color: var(--color-text-subtle);
}

[data-ty="input"]:before {
content: "$";
}

[data-ty][data-ty-prompt]:before {
content: attr(data-ty-prompt);
}

[data-ty-cursor]:after {
content: attr(data-ty-cursor);
font-family: monospace;
margin-left: 0.5em;
-webkit-animation: blink 1s infinite;
animation: blink 1s infinite;
}

/* Cursor animation */

@-webkit-keyframes blink {
50% {
opacity: 0;
}
}

@keyframes blink {
50% {
opacity: 0;
}
}
24 changes: 19 additions & 5 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,38 @@ As **Ormdantic** is based on **Pydantic** and **SQLAlchemy** and **Pypika**, it

You can add Ormdantic in a few easy steps. First of all, install the dependency:

```shell
<div class="termy">

```console
$ pip install ormdantic

---> 100%

Successfully installed Ormdantic
```

</div>

* Install The specific Asynchronous ORM library for your database.

### SQLite

```shell
<div class="termy">

```console
$ pip install ormdantic[sqlite]

---> 100%
```

</div>

### PostgreSQL

```shell
<div class="termy">

```console
$ pip install ormdantic[postgresql]

---> 100%
```

</div>
Loading