Skip to content

Commit

Permalink
more cleanup remove tox, update pyproject
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Jun 28, 2023
1 parent 430fce7 commit ca6a00d
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 108 deletions.
21 changes: 10 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ["3.8", "3.9", "3.10"]
platform: [ubuntu-latest, macos-latest, windows-latest]
include:
- platform: ubuntu-latest
python-version: '3.7'
python-version: "3.7"
- platform: macos-latest
python-version: '3.11'
python-version: "3.11"
- platform: ubuntu-latest
python-version: '3.11'
python-version: "3.11"
# skipping windows 3.11 until lxml has wheels

steps:
Expand All @@ -47,10 +47,9 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
pip install -e .[autogen]
- name: Test with tox
run: tox
env:
PLATFORM: ${{ matrix.platform }}
python -m pip install -U pip
python -m pip install -e .[autogen,test]
- name: Test
run: pytest --cov --cov-report=xml

- uses: codecov/codecov-action@v2
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,3 @@ python src/ome_autogen.py
To run tests quickly, just install and run `pytest`. Note, however, that this
requires that the `ome_types.model` module has already been built with `python
src/ome_autogen.py`.

Alternatively, you can install and run `tox` which will run tests and
code-quality checks in an isolated environment.
2 changes: 1 addition & 1 deletion hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ def initialize(self, version: str, build_data: dict) -> None:

import ome_autogen.main

ome_autogen.main.convert_schema()
ome_autogen.main.build_model()
75 changes: 35 additions & 40 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,6 @@
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

# https://hatch.pypa.io/latest/config/metadata/
[tool.hatch.version]
source = "vcs"

[tool.hatch.build]
artifacts = ["src/ome_types/model"]

[tool.hatch.build.targets.sdist]
include = ["src", "tests", "CHANGELOG.md"]

[tool.hatch.build.hooks.custom]
# requirements to run the autogen script in hatch_build.py
dependencies = [
"black",
"ruff",
"xsdata[cli]>=23.6",
"xsdata-pydantic-basemodel @ git+https://github.com/tlambert03/xsdata-pydantic-basemodel",
"mypy",
]

# https://peps.python.org/pep-0621/
[project]
name = "ome-types"
Expand Down Expand Up @@ -66,7 +46,13 @@ ome-types = "ome_types._napari_plugin"
# extras
# https://peps.python.org/pep-0621/#dependencies-optional-dependencies
[project.optional-dependencies]
autogen = ["autoflake", "black", "isort>=5.0", "numpydoc"]
autogen = [
"black",
"ruff",
"xsdata[cli]>=23.6",
"xsdata-pydantic-basemodel @ git+https://github.com/tlambert03/xsdata-pydantic-basemodel",
"mypy",
]
docs = [
"autoflake",
"black",
Expand All @@ -77,11 +63,32 @@ docs = [
"sphinx==5.3.0",
"sphinx-rtd-theme==1.1.1",
]
test = ["pytest", "pytest-cov", "pytest-benchmark", "tox"]
test = ["pytest", "pytest-cov", "pytest-benchmark"]


# https://hatch.pypa.io/latest/config/metadata/

[tool.hatch]
version = { source = "vcs" }
# required for github.com/tlambert03/xsdata-pydantic-basemodel
metadata = { allow-direct-references = true }

[tool.hatch.build]
artifacts = ["src/ome_types/model/ome_2016_06"]

[tool.hatch.build.targets.sdist]
include = ["src", "tests", "CHANGELOG.md"]

[tool.hatch.build.hooks.custom]
# requirements to run the autogen script in hatch_build.py
dependencies = [
"black",
"ruff",
"xsdata[cli]>=23.6",
"xsdata-pydantic-basemodel @ git+https://github.com/tlambert03/xsdata-pydantic-basemodel",
"mypy",
]

[tool.setuptools_scm]
write_to = "src/ome_types/_version.py"

# https://github.com/charliermarsh/ruff
[tool.ruff]
Expand Down Expand Up @@ -135,7 +142,6 @@ ignore = [
".readthedocs.yml",
"docs/**/*",
"setup.py",
"tox.ini",
]


Expand All @@ -146,21 +152,7 @@ float_to_top = true
skip_glob = ["*examples/*", "*vendored*"]

[tool.black]
target-version = ['py37', 'py38']
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
| docs
)/
'''
target-version = ['py38']

# https://docs.pytest.org/en/6.2.x/customize.html
[tool.pytest.ini_options]
Expand All @@ -183,3 +175,6 @@ disallow_any_generics = false
no_implicit_reexport = true
ignore_missing_imports = true
disallow_untyped_defs = true

[tool.coverage.run]
source = ["src/ome_types"]
4 changes: 2 additions & 2 deletions src/ome_autogen/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .main import convert_schema
from .main import build_model

convert_schema()
build_model()
2 changes: 1 addition & 1 deletion src/ome_autogen/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
]


def convert_schema(
def build_model(
output_dir: Path | str = SRC_PATH,
schema_file: Path | str = SCHEMA_FILE,
line_length: int = 88,
Expand Down
1 change: 0 additions & 1 deletion src/ome_types/_mixins/_base_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ def validate_id(cls, value: Any) -> Any:
if value is _AUTO_SEQUENCE:
# just increment the counter
_COUNTERS[cls] += 1
breakpoint()
return f"{cls.__name__}:{_COUNTERS[cls]}"

raise ValueError(f"Invalid ID value: {value!r}")
Expand Down
49 changes: 0 additions & 49 deletions tox.ini

This file was deleted.

0 comments on commit ca6a00d

Please sign in to comment.