# eztransformer
<div align="center">
[](https://github.com/ezhang7423/eztransformer/actions/workflows/build.yml/badge.svg)
[](https://github.com/ezhang7423/eztransformer/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot)
[](https://github.com/psf/black)
[](https://github.com/PyCQA/bandit)
[](https://github.com/ezhang7423/eztransformer/blob/master/.pre-commit-config.yaml)
[](https://github.com/ezhang7423/eztransformer/releases)
[](https://github.com/ezhang7423/eztransformer/blob/master/LICENSE)
faster, simpler, more interpretable nanoGPT
</div>
## β Installation
We require [conda](https://docs.conda.io/en/latest/miniconda.html). Afterwards to install, simply run
```bash
$ make install
```
### Development features
- Supports for `Python 3.8` and higher.
- [`Poetry`](https://python-poetry.org/) as the dependencies manager. See configuration in [`pyproject.toml`](https://github.com/ezhang7423/eztransformer/blob/master/pyproject.toml) and [`setup.cfg`](https://github.com/ezhang7423/eztransformer/blob/master/setup.cfg).
- Automatic codestyle with [`black`](https://github.com/psf/black), [`isort`](https://github.com/timothycrosley/isort) and [`pyupgrade`](https://github.com/asottile/pyupgrade).
- Ready-to-use [`pre-commit`](https://pre-commit.com/) hooks with code-formatting.
- Type checks with [`mypy`](https://mypy.readthedocs.io); docstring checks with [`darglint`](https://github.com/terrencepreilly/darglint); security checks with [`safety`](https://github.com/pyupio/safety) and [`bandit`](https://github.com/PyCQA/bandit)
- Testing with [`pytest`](https://docs.pytest.org/en/latest/).
- Ready-to-use [`.editorconfig`](https://github.com/ezhang7423/eztransformer/blob/master/.editorconfig), [`.dockerignore`](https://github.com/ezhang7423/eztransformer/blob/master/.dockerignore), and [`.gitignore`](https://github.com/ezhang7423/eztransformer/blob/master/.gitignore). You don't have to worry about those things.
## π Releases
You can see the list of available releases on the [GitHub Releases](https://github.com/ezhang7423/eztransformer/releases) page.
We follow [Semantic Versions](https://semver.org/) specification, and use the [`Release Drafter`](https://github.com/marketplace/actions/release-drafter). As pull requests are merged, a draft release is kept up-to-date listing the changes, ready to publish when youβre ready. With the categories option, you can categorize pull requests in release notes using labels.
### List of labels and corresponding titles
| **Label** | **Title in Releases** |
| :-----------------------------------: | :---------------------: |
| `enhancement`, `feature` | π Features |
| `bug`, `refactoring`, `bugfix`, `fix` | π§ Fixes & Refactoring |
| `build`, `ci`, `testing` | π¦ Build System & CI/CD |
| `breaking` | π₯ Breaking Changes |
| `documentation` | π Documentation |
| `dependencies` | β¬οΈ Dependencies updates |
GitHub creates the `bug`, `enhancement`, and `documentation` labels for you. Dependabot creates the `dependencies` label. Create the remaining labels on the Issues tab of your GitHub repository, when you need them.
## ποΈ Development
1. Install and initialize poetry and install `pre-commit` hooks:
```bash
make install
make pre-commit-install
```
2. Run the codestyle:
```bash
make codestyle
```
### Makefile usage
[`Makefile`](https://github.com/ezhang7423/eztransformer/blob/master/Makefile) contains a lot of functions for faster development.
<details>
<summary>1. Download and remove Poetry</summary>
<p>
To download and install Poetry run:
```bash
make poetry-download
```
To uninstall
```bash
make poetry-remove
```
</p>
</details>
<details>
<summary>2. Install all dependencies and pre-commit hooks</summary>
<p>
Install requirements:
```bash
make install
```
Pre-commit hooks coulb be installed after `git init` via
```bash
make pre-commit-install
```
</p>
</details>
<details>
<summary>3. Codestyle</summary>
<p>
Automatic formatting uses `pyupgrade`, `isort` and `black`.
```bash
make codestyle
# or use synonym
make formatting
```
Codestyle checks only, without rewriting files:
```bash
make check-codestyle
```
> Note: `check-codestyle` uses `isort`, `black` and `darglint` library
Update all dev libraries to the latest version using one comand
```bash
make update-dev-deps
```
<details>
<summary>4. Code security</summary>
<p>
```bash
make check-safety
```
This command launches `Poetry` integrity checks as well as identifies security issues with `Safety` and `Bandit`.
```bash
make check-safety
```
</p>
</details>
</p>
</details>
<details>
<summary>5. Type checks</summary>
<p>
Run `mypy` static type checker
```bash
make mypy
```
</p>
</details>
<details>
<summary>6. Tests with coverage badges</summary>
<p>
Run `pytest`
```bash
make test
```
</p>
</details>
<details>
<summary>7. All linters</summary>
<p>
Of course there is a command to ~~rule~~ run all linters in one:
```bash
make lint
```
the same as:
```bash
make test && make check-codestyle && make mypy && make check-safety
```
</p>
</details>
<details>
<summary>8. Docker</summary>
<p>
```bash
make docker-build
```
which is equivalent to:
```bash
make docker-build VERSION=latest
```
Remove docker image with
```bash
make docker-remove
```
More information [about docker](https://github.com/ezhang7423/eztransformer/tree/master/docker).
</p>
</details>
<details>
<summary>9. Cleanup</summary>
<p>
Delete pycache files
```bash
make pycache-remove
```
Remove package build
```bash
make build-remove
```
Delete .DS_STORE files
```bash
make dsstore-remove
```
Remove .mypycache
```bash
make mypycache-remove
```
Or to remove all above run:
```bash
make cleanup
```
</p>
</details>
### Poetry
Want to know more about Poetry? Check [its documentation](https://python-poetry.org/docs/).
<details>
<summary>Details about Poetry</summary>
<p>
Poetry's [commands](https://python-poetry.org/docs/cli/#commands) are very intuitive and easy to learn, like:
- `poetry add numpy@latest`
- `poetry run pytest`
- `poetry publish --build`
etc
</p>
</details>
### Building and releasing
Building a new version of the application contains steps:
- Bump the version of your package `poetry version <version>`. You can pass the new version explicitly, or a rule such as `major`, `minor`, or `patch`. For more details, refer to the [Semantic Versions](https://semver.org/) standard.
- Make a commit to `GitHub`.
- Create a `GitHub release`.
- And... publish π `poetry publish --build`
## π― What's next
## π‘ License
[](https://github.com/ezhang7423/eztransformer/blob/master/LICENSE)
This project is licensed under the terms of the `MIT` license. See [LICENSE](https://github.com/ezhang7423/eztransformer/blob/master/LICENSE) for more details.
## π Citation
```bibtex
```
# π Credits [](https://github.com/TezRomacH/python-package-template)
Template: [`python-package-template`](https://github.com/TezRomacH/python-package-template)
Raw data
{
"_id": null,
"home_page": "https://github.com/ezhang7423/eztransformer",
"name": "eztransformer",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "ezhang7423",
"author_email": "ete@ucsb.edu",
"download_url": "https://files.pythonhosted.org/packages/60/24/acf79b8e967b55c3ea14925074944874d3e52c9492d73382590af521008f/eztransformer-0.1.2.tar.gz",
"platform": null,
"description": "# eztransformer\n\n<div align=\"center\">\n\n[](https://github.com/ezhang7423/eztransformer/actions/workflows/build.yml/badge.svg)\n[](https://github.com/ezhang7423/eztransformer/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot)\n[](https://github.com/psf/black)\n[](https://github.com/PyCQA/bandit)\n[](https://github.com/ezhang7423/eztransformer/blob/master/.pre-commit-config.yaml)\n[](https://github.com/ezhang7423/eztransformer/releases)\n[](https://github.com/ezhang7423/eztransformer/blob/master/LICENSE)\n\nfaster, simpler, more interpretable nanoGPT\n\n</div>\n\n## \u2693 Installation\n\nWe require [conda](https://docs.conda.io/en/latest/miniconda.html). Afterwards to install, simply run\n\n```bash\n$ make install\n```\n\n### Development features\n\n- Supports for `Python 3.8` and higher.\n- [`Poetry`](https://python-poetry.org/) as the dependencies manager. See configuration in [`pyproject.toml`](https://github.com/ezhang7423/eztransformer/blob/master/pyproject.toml) and [`setup.cfg`](https://github.com/ezhang7423/eztransformer/blob/master/setup.cfg).\n- Automatic codestyle with [`black`](https://github.com/psf/black), [`isort`](https://github.com/timothycrosley/isort) and [`pyupgrade`](https://github.com/asottile/pyupgrade).\n- Ready-to-use [`pre-commit`](https://pre-commit.com/) hooks with code-formatting.\n- Type checks with [`mypy`](https://mypy.readthedocs.io); docstring checks with [`darglint`](https://github.com/terrencepreilly/darglint); security checks with [`safety`](https://github.com/pyupio/safety) and [`bandit`](https://github.com/PyCQA/bandit)\n- Testing with [`pytest`](https://docs.pytest.org/en/latest/).\n- Ready-to-use [`.editorconfig`](https://github.com/ezhang7423/eztransformer/blob/master/.editorconfig), [`.dockerignore`](https://github.com/ezhang7423/eztransformer/blob/master/.dockerignore), and [`.gitignore`](https://github.com/ezhang7423/eztransformer/blob/master/.gitignore). You don't have to worry about those things.\n\n## \ud83d\udcc8 Releases\n\nYou can see the list of available releases on the [GitHub Releases](https://github.com/ezhang7423/eztransformer/releases) page.\n\nWe follow [Semantic Versions](https://semver.org/) specification, and use the [`Release Drafter`](https://github.com/marketplace/actions/release-drafter). As pull requests are merged, a draft release is kept up-to-date listing the changes, ready to publish when you\u2019re ready. With the categories option, you can categorize pull requests in release notes using labels.\n\n### List of labels and corresponding titles\n\n| **Label** | **Title in Releases** |\n| :-----------------------------------: | :---------------------: |\n| `enhancement`, `feature` | \ud83d\ude80 Features |\n| `bug`, `refactoring`, `bugfix`, `fix` | \ud83d\udd27 Fixes & Refactoring |\n| `build`, `ci`, `testing` | \ud83d\udce6 Build System & CI/CD |\n| `breaking` | \ud83d\udca5 Breaking Changes |\n| `documentation` | \ud83d\udcdd Documentation |\n| `dependencies` | \u2b06\ufe0f Dependencies updates |\n\nGitHub creates the `bug`, `enhancement`, and `documentation` labels for you. Dependabot creates the `dependencies` label. Create the remaining labels on the Issues tab of your GitHub repository, when you need them.\n\n## \ud83c\udfd7\ufe0f Development\n\n1. Install and initialize poetry and install `pre-commit` hooks:\n\n```bash\nmake install\nmake pre-commit-install\n```\n\n2. Run the codestyle:\n\n```bash\nmake codestyle\n```\n\n### Makefile usage\n\n[`Makefile`](https://github.com/ezhang7423/eztransformer/blob/master/Makefile) contains a lot of functions for faster development.\n\n<details>\n<summary>1. Download and remove Poetry</summary>\n<p>\n\nTo download and install Poetry run:\n\n```bash\nmake poetry-download\n```\n\nTo uninstall\n\n```bash\nmake poetry-remove\n```\n\n</p>\n</details>\n\n<details>\n<summary>2. Install all dependencies and pre-commit hooks</summary>\n<p>\n\nInstall requirements:\n\n```bash\nmake install\n```\n\nPre-commit hooks coulb be installed after `git init` via\n\n```bash\nmake pre-commit-install\n```\n\n</p>\n</details>\n\n<details>\n<summary>3. Codestyle</summary>\n<p>\n\nAutomatic formatting uses `pyupgrade`, `isort` and `black`.\n\n```bash\nmake codestyle\n\n# or use synonym\nmake formatting\n```\n\nCodestyle checks only, without rewriting files:\n\n```bash\nmake check-codestyle\n```\n\n> Note: `check-codestyle` uses `isort`, `black` and `darglint` library\n\nUpdate all dev libraries to the latest version using one comand\n\n```bash\nmake update-dev-deps\n```\n\n<details>\n<summary>4. Code security</summary>\n<p>\n\n```bash\nmake check-safety\n```\n\nThis command launches `Poetry` integrity checks as well as identifies security issues with `Safety` and `Bandit`.\n\n```bash\nmake check-safety\n```\n\n</p>\n</details>\n\n</p>\n</details>\n\n<details>\n<summary>5. Type checks</summary>\n<p>\n\nRun `mypy` static type checker\n\n```bash\nmake mypy\n```\n\n</p>\n</details>\n\n<details>\n<summary>6. Tests with coverage badges</summary>\n<p>\n\nRun `pytest`\n\n```bash\nmake test\n```\n\n</p>\n</details>\n\n<details>\n<summary>7. All linters</summary>\n<p>\n\nOf course there is a command to ~~rule~~ run all linters in one:\n\n```bash\nmake lint\n```\n\nthe same as:\n\n```bash\nmake test && make check-codestyle && make mypy && make check-safety\n```\n\n</p>\n</details>\n\n<details>\n<summary>8. Docker</summary>\n<p>\n\n```bash\nmake docker-build\n```\n\nwhich is equivalent to:\n\n```bash\nmake docker-build VERSION=latest\n```\n\nRemove docker image with\n\n```bash\nmake docker-remove\n```\n\nMore information [about docker](https://github.com/ezhang7423/eztransformer/tree/master/docker).\n\n</p>\n</details>\n\n<details>\n<summary>9. Cleanup</summary>\n<p>\nDelete pycache files\n\n```bash\nmake pycache-remove\n```\n\nRemove package build\n\n```bash\nmake build-remove\n```\n\nDelete .DS_STORE files\n\n```bash\nmake dsstore-remove\n```\n\nRemove .mypycache\n\n```bash\nmake mypycache-remove\n```\n\nOr to remove all above run:\n\n```bash\nmake cleanup\n```\n\n</p>\n</details>\n\n### Poetry\n\nWant to know more about Poetry? Check [its documentation](https://python-poetry.org/docs/).\n\n<details>\n<summary>Details about Poetry</summary>\n<p>\n\nPoetry's [commands](https://python-poetry.org/docs/cli/#commands) are very intuitive and easy to learn, like:\n\n- `poetry add numpy@latest`\n- `poetry run pytest`\n- `poetry publish --build`\n\netc\n\n</p>\n</details>\n\n### Building and releasing\n\nBuilding a new version of the application contains steps:\n\n- Bump the version of your package `poetry version <version>`. You can pass the new version explicitly, or a rule such as `major`, `minor`, or `patch`. For more details, refer to the [Semantic Versions](https://semver.org/) standard.\n- Make a commit to `GitHub`.\n- Create a `GitHub release`.\n- And... publish \ud83d\ude42 `poetry publish --build`\n\n## \ud83c\udfaf What's next\n\n## \ud83d\udee1 License\n\n[](https://github.com/ezhang7423/eztransformer/blob/master/LICENSE)\n\nThis project is licensed under the terms of the `MIT` license. See [LICENSE](https://github.com/ezhang7423/eztransformer/blob/master/LICENSE) for more details.\n\n## \ud83d\udcc3 Citation\n\n```bibtex\n\n```\n\n# \ud83d\udc4f Credits [](https://github.com/TezRomacH/python-package-template)\n\nTemplate: [`python-package-template`](https://github.com/TezRomacH/python-package-template)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "faster, simpler, more interpretable nanoGPT",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/ezhang7423/eztransformer",
"Repository": "https://github.com/ezhang7423/eztransformer"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "96661437fd2a9ee55216d02cb7ee1f6b1cf559b4c364bdc9dee6730659a8e1a7",
"md5": "51baa8a24129f3d0a6a638e47bff1066",
"sha256": "9388a522c8fab1e47e63bff9b641f95a83ca02e1abb4f2b6eea7fd951ecbcb6b"
},
"downloads": -1,
"filename": "eztransformer-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "51baa8a24129f3d0a6a638e47bff1066",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6,<4.0",
"size": 11664,
"upload_time": "2023-11-26T15:35:58",
"upload_time_iso_8601": "2023-11-26T15:35:58.978764Z",
"url": "https://files.pythonhosted.org/packages/96/66/1437fd2a9ee55216d02cb7ee1f6b1cf559b4c364bdc9dee6730659a8e1a7/eztransformer-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6024acf79b8e967b55c3ea14925074944874d3e52c9492d73382590af521008f",
"md5": "5381f03f36e086420a90ae685ae2f0fa",
"sha256": "3e2e4cdfffbb4d6bfa72d4fd38bb13d4cf29d5a45fd574436bf88431cf0d8283"
},
"downloads": -1,
"filename": "eztransformer-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "5381f03f36e086420a90ae685ae2f0fa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6,<4.0",
"size": 13639,
"upload_time": "2023-11-26T15:36:00",
"upload_time_iso_8601": "2023-11-26T15:36:00.816327Z",
"url": "https://files.pythonhosted.org/packages/60/24/acf79b8e967b55c3ea14925074944874d3e52c9492d73382590af521008f/eztransformer-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-26 15:36:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ezhang7423",
"github_project": "eztransformer",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "beartype",
"specs": [
[
"==",
"0.16.4"
]
]
},
{
"name": "click",
"specs": [
[
"==",
"8.1.7"
]
]
},
{
"name": "colorama",
"specs": [
[
"==",
"0.4.6"
]
]
},
{
"name": "einops",
"specs": [
[
"==",
"0.7.0"
]
]
},
{
"name": "executing",
"specs": [
[
"==",
"2.0.1"
]
]
},
{
"name": "eztils",
"specs": [
[
"==",
"0.4.76"
]
]
},
{
"name": "filelock",
"specs": [
[
"==",
"3.13.1"
]
]
},
{
"name": "fsspec",
"specs": [
[
"==",
"2023.10.0"
]
]
},
{
"name": "jinja2",
"specs": [
[
"==",
"3.1.2"
]
]
},
{
"name": "loguru",
"specs": [
[
"==",
"0.7.2"
]
]
},
{
"name": "markdown-it-py",
"specs": [
[
"==",
"3.0.0"
]
]
},
{
"name": "markupsafe",
"specs": [
[
"==",
"2.1.3"
]
]
},
{
"name": "mdurl",
"specs": [
[
"==",
"0.1.2"
]
]
},
{
"name": "mpmath",
"specs": [
[
"==",
"1.3.0"
]
]
},
{
"name": "networkx",
"specs": [
[
"==",
"3.2.1"
]
]
},
{
"name": "numpy",
"specs": [
[
"==",
"1.26.1"
]
]
},
{
"name": "pygments",
"specs": [
[
"==",
"2.16.1"
]
]
},
{
"name": "python-dotenv",
"specs": [
[
"==",
"1.0.0"
]
]
},
{
"name": "rich",
"specs": [
[
"==",
"13.6.0"
]
]
},
{
"name": "shellingham",
"specs": [
[
"==",
"1.5.4"
]
]
},
{
"name": "sympy",
"specs": [
[
"==",
"1.12"
]
]
},
{
"name": "torch",
"specs": [
[
"==",
"2.1.0"
]
]
},
{
"name": "tqdm",
"specs": [
[
"==",
"4.66.1"
]
]
},
{
"name": "typer-config",
"specs": [
[
"==",
"1.3.0"
]
]
},
{
"name": "typer",
"specs": [
[
"==",
"0.9.0"
]
]
},
{
"name": "typer",
"specs": [
[
"==",
"0.9.0"
]
]
},
{
"name": "typing-extensions",
"specs": [
[
"==",
"4.8.0"
]
]
},
{
"name": "varname",
"specs": [
[
"==",
"0.12.0"
]
]
},
{
"name": "win32-setctime",
"specs": [
[
"==",
"1.1.0"
]
]
}
],
"lcname": "eztransformer"
}