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

move metadata to pyproject.toml #23

Merged
merged 2 commits into from
Mar 30, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

[Unreleased]: https://github.com/LoicGrobol/zeldarose/compare/v0.4.0...HEAD

### Added

- `lint` extra that install linting tools and plugins
- Config for [flakeheaven](https://github.com/flakeheaven/flakeheaven)

### Changed

- Move packaging config to `pyproject.toml` and require `setuptools>=61".

## [0.4.0] — 2022-03-18

[0.4.0]: https://github.com/LoicGrobol/zeldarose/compare/v0.3.4...v0.4.0
Expand Down
76 changes: 72 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,78 @@
[build-system]
requires = ["setuptools>=61", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "zeldarose"
version = "0.4.0"
description = "Train transformer-based models"
license = {text = "MIT"}
authors = [{name = "Loïc Grobol", email = "loic.grobol@gmail.com"}]
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Environment :: Console",
]
keywords = [
"nlp",
"transformers",
"language-model",
]
requires-python = ">=3.8"
dependencies = [
"click",
"click_pathlib",
"datasets",
"filelock",
"loguru",
"pydantic",
"pytorch-lightning >= 1.5.6, < 1.6.0",
"rich",
"torch > 1.8, < 1.12",
"torchmetrics",
"tokenizers ~= 0.10",
"toml",
"tqdm",
"transformers >= 4.0.0, < 5.0.0",
]

[build-system]
requires = ["setuptools>=54", "wheel"]
build-backend = "setuptools.build_meta"
[project.readme]
file = "README.md"
content-type = "text/markdown"

[project.optional-dependencies]
lint = [
"flakeheaven",
"flake8-bugbear",
"flake8-pytest-style",
"mypy",
]
tests = [
"pytest",
"pytest-console-scripts",
"pytest-lazy-fixture",
]


[project.scripts]
zeldarose-tokenizer = "zeldarose.train_tokenizer:main"
zeldarose-transformer = "zeldarose.train_transformer:main"

[tool.flakeheaven]
max_line_length = 100

[tool.flakeheaven.plugins]
bugbear = ["+*"]
pycodestyle = ["+*", "-W503", "-E501"]
pyflakes = ["+*", "-E203", "-E266"]
pytest-style = ["+*"]

[tool.mypy]
allow_redefinition = true
warn_unreachable = true
plugins = ["pydantic.mypy"]

[tool.black]
line-length = 88
line-length = 100
54 changes: 0 additions & 54 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,61 +1,7 @@
[metadata]
name = zeldarose
version = 0.4.0
description = Train transformer-based models
license = MIT
author = Loïc Grobol
author_email = loic.grobol@gmail.com
long_description = file: README.md
long_description_content_type = text/markdown
classifiers =
License :: OSI Approved :: MIT License
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Environment :: Console
keywords =
nlp
transformers
language-model


[options]
packages = find:
include_package_data = True
python_requires = >=3.8
install_requires =
click
click_pathlib
datasets
filelock
loguru
pydantic
pytorch-lightning >= 1.5.6, < 1.6.0
rich
torch > 1.8, < 1.12
torchmetrics
tokenizers ~= 0.10
toml
tqdm
transformers >= 4.0.0, < 5.0.0

[options.extras_require]
tests =
pytest
pytest-console-scripts
pytest-lazy-fixture

[options.entry_points]
console_scripts =
zeldarose-tokenizer = zeldarose.train_tokenizer:main
zeldarose-transformer = zeldarose.train_transformer:main

[flake8]
max-line-length = 100
ignore = E203,E266,E501,W503
max-complexity = 18

[mypy]
allow_redefinition = True
warn_unreachable = True
plugins = pydantic.mypy
4 changes: 0 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import pathlib
from typing import Union

import pytest

from pytest_lazyfixture import lazy_fixture


fixtures_dir = pathlib.Path(__file__).parent / "fixtures"


Expand Down
2 changes: 1 addition & 1 deletion tests/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,4 @@ def test_train_mlm_with_remote_dataset(
"--max-epochs",
"2",
)
assert ret.success
assert ret.success
2 changes: 1 addition & 1 deletion zeldarose/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def __init__(
"Sharing embeddings between different model types might not work well:"
f" {type(self.follower_transformer.embeddings)} vs {type(self.leader_transformer.embeddings)}"
)

self.replaced_layer: Dict[str, CombiningLayer] = dict()

def on_train_start(self, trainer, pl_module):
Expand Down