diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml new file mode 100644 index 0000000..80d39b9 --- /dev/null +++ b/.github/workflows/run_tests.yaml @@ -0,0 +1,21 @@ +name: Run tests +on: [pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.9', '3.10', '3.11', '3.12'] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup yt_experiments + run: | + python -m pip install --upgrade pip + python -m pip install -e .[test] + - name: Run tests + run: pytest diff --git a/.gitignore b/.gitignore index 68bc17f..2dc53ca 100644 --- a/.gitignore +++ b/.gitignore @@ -157,4 +157,4 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +.idea/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..3b1af67 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,41 @@ +# pre-commit 1.1.0 is required for `exclude` +# however `minimum_pre_commit_version` itself requires 1.15.0 +minimum_pre_commit_version: "1.15.0" + + +ci: + autofix_prs: false + autoupdate_schedule: monthly + +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: no-commit-to-branch + - id: check-shebang-scripts-are-executable + - id: check-executables-have-shebangs + - id: check-yaml + +- repo: https://github.com/psf/black-pre-commit-mirror + rev: 23.10.1 + hooks: + - id: black-jupyter + +- repo: https://github.com/adamchainz/blacken-docs + rev: 1.16.0 + hooks: + - id: blacken-docs + additional_dependencies: [black==23.9.1] + +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.4 + hooks: + - id: ruff + args: [--fix] + +- repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.10.0 + hooks: + - id: rst-backticks diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1f85dee --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,87 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "yt_experiments" +version = "0.1.0" +authors = [ + { name="The yt project", email="yt-dev@python.org"}, +] +description="A repository containing some experimental packages and enhancements " +requires-python = ">=3.9" +classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "License :: OSI Approved :: BSD License", +] +dependencies=['yt>4.2.0',] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.urls] +"Homepage" = "https://github.com/yt-project/yt_experiments" +"Bug Tracker" = "https://github.com/yt-project/yt_experiments/issues" + +[project.license] +text = "BSD 3-Clause" + +[project.optional-dependencies] +test = [ + "pytest>=6.1", +] + +[tool.pytest.ini_options] +addopts = ''' + -s + -v + -rsfE + +''' + +[tool.black] +line-length = 88 +target-version = ['py39'] +include = '\.pyi?$' +exclude = ''' +/( + \.eggs + | \.git + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | _build + | build + | dist +)/ +''' + +[tool.ruff] +extend-include = ["*.ipynb"] +exclude = [ + "doc", +] +select = [ + "E", + "F", + "W", + "C4", # flake8-comprehensions + "B", # flake8-bugbear + "G", # flake8-logging-format + "YTT", # flake8-2020 + "UP", # pyupgrade + "I", # isort + "NPY", # numpy specific rules +] +ignore = [ + "E501", # line too long + "B018", # Found useless expression. # disabled because ds.index is idiomatic +] + +[tool.ruff.isort] +combine-as-imports = true diff --git a/yt_experiments/__init__.py b/yt_experiments/__init__.py new file mode 100644 index 0000000..19297b0 --- /dev/null +++ b/yt_experiments/__init__.py @@ -0,0 +1,3 @@ +from yt_experiments._version import __version__ + +version = __version__ diff --git a/yt_experiments/_version.py b/yt_experiments/_version.py new file mode 100644 index 0000000..3dc1f76 --- /dev/null +++ b/yt_experiments/_version.py @@ -0,0 +1 @@ +__version__ = "0.1.0" diff --git a/yt_experiments/tests/test_yt_experiments.py b/yt_experiments/tests/test_yt_experiments.py new file mode 100644 index 0000000..74385b9 --- /dev/null +++ b/yt_experiments/tests/test_yt_experiments.py @@ -0,0 +1,5 @@ +import yt_experiments + + +def test_yt_experiments(): + assert yt_experiments.version is not None