Skip to content

Commit

Permalink
Merge pull request #43 from PyDataCZ/farewell-to-poetry
Browse files Browse the repository at this point in the history
Farewell to poetry
  • Loading branch information
janpipek authored Sep 16, 2024
2 parents 5c0862d + 599fff1 commit 74fe820
Show file tree
Hide file tree
Showing 4 changed files with 1,353 additions and 40 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,22 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Poetry cache
uses: actions/cache@v2
- uses: astral-sh/setup-uv@v1
with:
path: ~/.cache/pypoetry
key: poetry-cache-${{ runner.os }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }}
- name: Pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-cache-${{ runner.os }}-${{ hashFiles('.github/workflows/*.yml') }}
version: "latest"
- name: Install dependencies
run: |
python -m pip install poetry
poetry install
uv sync
- name: Compile the course
run: |
poetry run python -m naucse_render compile _compiled \
uv run python -m naucse_render compile _compiled \
--edit-repo-url https://github.com/${{ github.repository }} \
--edit-repo-branch main
- if: ${{ github.ref == 'refs/heads/main' }}
name: Publish compiled course
run: |
git fetch origin compiled2024
poetry run python -m ghp_import -m "Compiled" -b compiled2024 --push _compiled/
uv run python -m ghp_import -m "Compiled" -b compiled2024 --push _compiled/
curl -H 'Content-Type: application/json' \
--data '{"repository": "https://github.com/${{ github.repository }}", "branch": "compiled2024"}' \
https://hooks.nauc.se/trigger
Expand Down
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,42 @@ TODO: Link na aktuální kurz
Chceš-li server spustit na svém počítači, např. proto, že se chceš zapojit do
vývoje, je potřeba ho nejdřív nainstalovat:

### Instalace `poetry`
### Instalace `uv`

Nemáš-li `poetry`, nainstaluj si jej. Na to je několik způsobů:
Nemáš-li `uv`, nainstaluj si jej. Na to je několik způsobů:

* podle [návodu](https://python-poetry.org/docs/)
* v aktivovaném [virtuálním prostředí](https://naucse.python.cz/lessons/beginners/install/)
pomocí `python -m pip install poetry`
* na Fedoře pomocí balíčkovacího systému: `sudo dnf install poetry`
* podle [návodu](https://github.com/astral-sh/uv)

### Instalace závislostí

Přepni se do adresáře s projektem a spusť:

```console
$ poetry install --dev
```shell
uv sync
```

### Lokální server

Chceš-li si kurz prohlédnout, přepni se do adresáře s projektem a spusť:

```console
$ poetry run python -m naucse serve
```shell
uv run python -m naucse serve
```

* Program vypíše adresu (např. `http://0.0.0.0:8003/`).
* Buď adresu navštiv v prohlížeči a doklikej se na kurz, nebo
* na konec adresy přidej `/course/local/` a navštiv kurz přímo.

Poznámka: ve windows mi to nefunguje :-(

## Publikování jedné hodiny

Balíček ZIP se všemi materiály lze vytvořit použitím skriptu:

```shell
uv run cli.py export <id-hodiny>
```

## Publikování

TODO: 🤯
Expand Down
33 changes: 16 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
[tool.poetry]
name = "naucse.python.cz"
version = "0"
description = "Website with learning materials / Stránka s učebními materiály"
authors = ["Petr Viktorin <encukou@gmail.com>", "Naucse contributors"]

[tool.poetry.dependencies]
python = "^3.9"
pygments-pytest = "^2.2.0"
naucse = "^0.5.2"
Jinja2 = "~3.0.0"
ipython = "^8.4.0"
ghp-import = "^2.1.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[project]
name = "pyladies-kurz"
version = "2024.9.1"
description = "Kurz pro PyLadies"
authors = [
{name = "Jan Pipek", email = "jan.pipek@gmail.com"},
{name = "Jakub Urban", email = "coobas@gmail.com"}
]
requires-python = ">=3.9"
dependencies = [
"naucse>=0.5.2",
"Jinja2>=3.0.0",
"ipython>=8.4.0",
"ghp-import~=2.1.0",
"pygit2==1.13.3" # V novějších verzích AttributeError
]
Loading

0 comments on commit 74fe820

Please sign in to comment.