-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from pharmaverse/main
Synchronize changes until v0.1.0
- Loading branch information
Showing
39 changed files
with
1,268 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
name: CI Tests | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12", "3.13"] | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
# we are using the -e flag, so that code cov finds the source. | ||
# this is not ideal, since installing an editable can technically | ||
# differ from a normal install in surprising ways. | ||
pip install -e '.[all]' | ||
- name: Test with pytest | ||
run: | | ||
pip install pytest pytest-cov | ||
pytest --cov=pkglite --cov-report=xml | ||
# - name: Upload coverage reports to Codecov | ||
# uses: codecov/codecov-action@v4 | ||
# with: | ||
# name: "py${{ matrix.python-version }}" | ||
# token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
test-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.13" | ||
- name: Install dependencies | ||
run: | | ||
pip install -e '.[all]' | ||
- name: Test with pytest | ||
run: | | ||
pip install pytest pytest-cov | ||
pytest --cov=pkglite --cov-report=xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: mkdocs | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Configure Git Credentials | ||
run: | | ||
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
key: mkdocs-material-${{ env.cache_id }} | ||
path: .cache | ||
restore-keys: | | ||
mkdocs-material- | ||
- run: pip install mkdocs-material | ||
- run: pip install mkdocstrings-python | ||
- run: mkdocs gh-deploy --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,8 @@ dist/ | |
wheels/ | ||
*.egg-info | ||
|
||
# pytest | ||
.coverage | ||
|
||
# venv | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.13.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Why pkglite for Python? | ||
|
||
## Differentiators | ||
|
||
Building on our experience developing pkglite for R, we resolved several | ||
longstanding, unmet needs with pkglite for Python: | ||
|
||
- **Broader scope**. Extend support for packing and unpacking packages | ||
across **any** programming language, without R-specific assumptions. | ||
- **Optimized tooling**. Simplify packing logic by classifying files | ||
based on content rather than file extensions. | ||
UTF-8 in and UTF-8 out for all text files on all platforms. | ||
- **Engineering-friendly interface**. Besides the language-specific API, | ||
provide a command-line interface (CLI) to better integrate with | ||
standard engineering workflows. | ||
|
||
## Design choices | ||
|
||
We made a few key design changes from pkglite for R to implement the above goals: | ||
|
||
- Introduced a `.pkgliteignore` configuration file to control packing scope, | ||
following the gitignore standard. | ||
- Adopted content-based file type classification for unsupervised file discovery. | ||
- Built with Python for better flexibility and accessibility. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Get started | ||
|
||
|
||
<!-- `.md` and `.py` files are generated from the `.qmd` file. Please edit that file. --> | ||
|
||
!!! tip | ||
|
||
To run the code from this article as a Python script: | ||
|
||
```bash | ||
python3 examples/get-started.py | ||
``` | ||
|
||
## Python API | ||
|
||
Import pkglite: | ||
|
||
``` python | ||
import pkglite as pkg | ||
``` | ||
|
||
### Single directory | ||
|
||
Pack a single directory into a text file and unpack it: | ||
|
||
``` python | ||
dirs = ["path/to/pkg"] | ||
txt = "path/to/pkg.txt" | ||
pkg.use_pkglite(dirs) | ||
pkg.pack(dirs, output_file=txt) | ||
pkg.unpack(txt, output_dir="path/to/output") | ||
``` | ||
|
||
### Multiple directories | ||
|
||
Pack multiple directories into a text file and unpack it: | ||
|
||
``` python | ||
dirs = ["path/to/pkg1", "path/to/pkg2"] | ||
txt = "path/to/pkgs.txt" | ||
pkg.use_pkglite(dirs) | ||
pkg.pack(dirs, output_file=txt) | ||
pkg.unpack(txt, output_dir="path/to/output") | ||
``` | ||
|
||
The `use_pkglite()` function creates a `.pkgliteignore` file to exclude | ||
files from the packing scope. | ||
|
||
## Command line interface | ||
|
||
### Single directory | ||
|
||
Pack a single directory into a text file and unpack it: | ||
|
||
``` bash | ||
pkglite use path/to/pkg | ||
pkglite pack path/to/pkg -o path/to/pkg.txt | ||
pkglite unpack path/to/pkg.txt -o path/to/output | ||
``` | ||
|
||
### Multiple directories | ||
|
||
Pack multiple directories into a text file and unpack it: | ||
|
||
``` bash | ||
pkglite use path/to/pkg1 path/to/pkg2 | ||
pkglite pack path/to/pkg1 path/to/pkg2 -o path/to/pkgs.txt | ||
pkglite unpack path/to/pkgs.txt -o path/to/output | ||
``` | ||
|
||
The `pkglite use` subcommand creates a `.pkgliteignore` file to exclude | ||
files from the packing scope. | ||
|
||
Run | ||
|
||
``` bash | ||
pkglite --help | ||
pkglite use --help | ||
pkglite pack --help | ||
pkglite unpack --help | ||
``` | ||
|
||
for more information about the available subcommands and their options. |
Oops, something went wrong.