Skip to content

Commit

Permalink
Tapyr 0.2 release
Browse files Browse the repository at this point in the history
feat!: use uv instead of poetry for packages management
refactor: switch from raw-playwright to shiny-playwright api
chore: bump ruff in pre-commit
chore: update uv.lock to match pyproject.toml
refactor: rename footer to link_button
feat: change favicon
docs: pyshiny -> shiny for python
chore/docs: remove poetry.lock and other files 
tests: refactor startup tests
docs: improve readme
docs: uv and poetry comparison
  • Loading branch information
pstorozenko authored Oct 18, 2024
2 parents 8f2e080 + 50ad7ab commit ae10e11
Show file tree
Hide file tree
Showing 18 changed files with 1,854 additions and 2,395 deletions.
6 changes: 3 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:3.10-bullseye",
"image": "mcr.microsoft.com/devcontainers/python:3.12-bullseye",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers-contrib/features/poetry:2": {},
"ghcr.io/va-h/devcontainers-features/uv:1": {},
"ghcr.io/devcontainers/features/node:1": {}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "poetry install && poetry run playwright install --with-deps",
"postCreateCommand": "uv sync && uv run playwright install --with-deps",

// Configure tool-specific properties.
"customizations": {
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Python files
__pycache__
.ipynb_checkpoints

# MacOS
.DS_Store

# Code coverage
Expand All @@ -9,7 +12,5 @@ lcov.info
# Results of playwright tests with tracing
test-results/

# Files from playwright installed with npm
# Files packages installed with npm (if you use it)
node_modules
package-lock.json
package.json
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
exclude: ^data/records\.parquet$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
rev: v0.6.9
hooks:
- id: ruff
args: [ --fix ]
Expand Down
7 changes: 0 additions & 7 deletions .vscode/settings.json

This file was deleted.

64 changes: 47 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# Tapyr - Shiny for Python Application Template<a href="https://appsilon.github.io/tapyr-template/"><img src="www/images/tapyr.png" align="right" alt="Tapyr logo" style="height: 140px;"></a>

> Create and deploy enterprise-ready PyShiny dashboards with ease.
> Create and deploy enterprise-ready Shiny for Python dashboards with ease.
## Introduction

Tapyr is designed for data scientists and developers seeking a seamless transition from development to deployment, this template uses `poetry` for dependency management and `pytest`/`playwright` for comprehensive app validation/testing/quality assurance.
Tapyr is designed for data scientists and developers seeking a seamless transition from development to deployment, this template uses `uv` for dependency management and `pytest`/`playwright` for comprehensive app validation/testing/quality assurance.
Ideal for projects aiming for high-quality code and efficient deployment on Posit Connect.

> [!IMPORTANT]
> When we created `tapyr`, it used `poetry` for dependency management.
> Please check our docs for [a quick `poetry` and `uv` comparison](https://appsilon.github.io/tapyr-docs/contents/tapyr_features/02_uv.html#direct-uv-and-poetry-comparison).
## Events
### Upcoming
Would you like to learn about Tapyr? Join our events!
* [**Open Source Spotlight: Tapyr - Shiny for Python Framework**](https://go.appsilon.com/tapyr-webinar-may2024?utm_source=community&utm_medium=github&utm_campaign=shinygathering)<br>
2024-05-28 at 18:00 (UTC+1)<br>
Shiny Gathering led by [Piotr Storożenko](https://www.linkedin.com/in/piotr-pasza-storo%C5%BCenko/)
Shiny Gathering led by [Piotr Pasza Storożenko](https://www.linkedin.com/in/piotr-pasza-storo%C5%BCenko/)

## Docs

For comprehensive documentation, please visit our [documentation](https://connect.appsilon.com/tapyr-docs/).
For comprehensive documentation, please visit our [documentation](https://appsilon.github.io/tapyr-docs/).

## Getting Started

Expand All @@ -25,45 +29,71 @@ Check out our get started with `tapyr` [blog post](www.appsilon.com/post/introdu
### Using Devcontainer

To ensure a consistent development experience across all environments, we recommend using the [devcontainer](https://code.visualstudio.com/docs/remote/containers) configuration with Visual Studio Code or DevPod for container-based development.
If you prefer a local setup, follow the instructions below.

1. **Start the Devcontainer**: Open the project in VS Code and select "Reopen in Container" when prompted, or use the Command Palette (`Ctrl+Shift+P`) and choose "Remote-Containers: Reopen in Container". Alternatively, use [DevPod](https://devpod.sh/) following their instructions.
1. **Start the Devcontainer**: Open the project in VS Code and select "Reopen in Container" when prompted, or use the Command Palette (`Ctrl+Shift+P`) and choose "Dev Containers: Reopen in Container". Alternatively, use [DevPod](https://devpod.sh/) following their instructions.
2. **Activate the virtual environment**:
```sh
poetry shell
source .venv/bin/activate
```
3. **Run the application**:
```sh
shiny run app.py --reload
```
4. **Execute tests**:
```sh
poetry run pytest
pytest
```

*Note*: The Devcontainer might limit some `playwright` features, such as `codegen`. For full functionality, consider a local setup.

### Setting Up Locally with Poetry
### Setting Up Locally with `uv`

For developers preferring a local setup without Devcontainer:

1. **Install pipx**: Ensure pipx is installed for managing isolated CLI apps.
2. **Install Poetry**:
1. **Install `uv`**: [Follow the installation guide](https://docs.astral.sh/uv/getting-started/installation/).
2. **Clone the repository** and navigate to it.
3. **Install dependencies**:
```sh
pipx install poetry
uv sync
uv run playwright install --with-deps
```
3. **Clone the repository** and navigate to it.
4. **Install dependencies**:
4. **Run the application**:
```sh
poetry install
playwright install
uv run shiny run app.py --reload
```

*Attention*: Follow any additional steps prompted by `playwright install`.

More information on `uv` can be found in the [official documentation](https://docs.astral.sh/uv/).

### Setting Up Locally with `pip`

Although not recommended, you can set up the project using `pip`:

1. **Clone the repository** and navigate to it.
2. **Create a virtual environment**:
```sh
python -m venv .venv
source .venv/bin/activate
```
3. **Install package with dependencies**:
```sh
pip install -e ."[dev]"
playwright install --with-deps
```
4. **Run the application**:
```sh
shiny run app.py --reload
```

### Deployment on Posit Connect

Deploy your application to Posit Connect by:

0. **Activate the virtual environment**:
```sh
source .venv/bin/activate
```
1. **Exporting your API Key**:
```sh
export CONNECT_API_KEY="your_api_key_here"
Expand All @@ -83,7 +113,7 @@ Deploy your application to Posit Connect by:
Replace placeholders with your server URL, server name, and API key. Verify the deployment on Posit Connect for successful upload.

## :star2: Stay Updated
Don't miss out on important updates and exclusive content about Tapyr and PyShiny[Subscribe to our newsletter](https://go.appsilon.com/shiny-weekly?utm_source=community&utm_medium=github&utm_content=tapyr).
Don't miss out on important updates and exclusive content about Tapyr and Shiny for Python[Subscribe to our newsletter](https://go.appsilon.com/shiny-weekly?utm_source=community&utm_medium=github&utm_content=tapyr).

Have questions or want to contribute? Engage with Appsilon's developers and the data science community on our [Shiny 4 All](https://go.appsilon.com/shiny4allcommunity).

Expand Down
Loading

0 comments on commit ae10e11

Please sign in to comment.