8000 Poetry by marco-neumann-by · Pull Request #20 · JDASoftwareGroup/rle-array · GitHub
[go: up one dir, main page]

Skip to content

Poetry #20

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

Merged
merged 7 commits into from
Jul 29, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 16 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,55 +17,35 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Conda Bootstrap
uses: goanpeca/setup-miniconda@v1
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
- name: Conda Config
run: |
conda config --add channels conda-forge
conda config --add channels numba
conda config --set channel_priority strict
conda config --set always_yes yes
conda config --set changeps1 no
conda config --set pip_interop_enabled True
- name: Conda Install
shell: bash -l {0}
run: conda install --yes shellcheck --file=requirements.txt --file=test-requirements.txt
- name: Pip Install
shell: bash -l {0}
run: pip install --no-deps -e .[testing]
- name: Install Poetry Itself
run: pip install poetry
- name: Poetry Install
run: poetry install
- name: Flake8
shell: bash -l {0}
run: flake8
run: poetry run flake8
- name: Mypy
shell: bash -l {0}
run: mypy .
run: poetry run mypy .
- name: Black
shell: bash -l {0}
run: black --check .
run: poetry run black --check .
- name: Isort
shell: bash -l {0}
run: isort --recursive --check-only
run: poetry run isort --recursive --check-only
- name: Pytest
shell: bash -l {0}
run: pytest
run: poetry run pytest
- name: ASV
shell: bash -l {0}
run: |
asv --config ./asv_bench/asv.conf.json machine --machine travis --os unknown --arch unknown --cpu unknown --ram unknown
asv --config ./asv_bench/asv.conf.json run --show-stderr --environment existing --quick
poetry run asv --config ./asv_bench/asv.conf.json machine --machine travis --os unknown --arch unknown --cpu unknown --ram unknown
poetry run asv --config ./asv_bench/asv.conf.json run --show-stderr --environment existing --quick
- name: Sphinx
shell: bash -l {0}
run: |
python setup.py build_sphinx
poetry run python setup.py build_sphinx
touch ./docs/_build/html/.nojekyll
- name: Build Wheel
shell: bash -l {0}
run: python setup.py sdist bdist_wheel
- name: Build
run: poetry build
- name: Shellcheck
shell: bash -l {0}
run: shellcheck scripts/*.sh
- name: Preserve Dist
uses: actions/upload-artifact@v1
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
*.asv/
*.egg-info/
.coverage
.mypy_cache/
.pytest_cache/
.venv/
__pycache__/
build/
coverage.xml
poetry.lock
dist/
docs/_build/
docs/_rst/
6 changes: 0 additions & 6 deletions .isort.cfg

This file was deleted.

25 changes: 9 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,13 @@ tooling. See the "Development Plan" in the README for the generic prioritization
## Development

### Installation
To get started, set up a new virtual environment and install all requirements, either using pip:
To get started, set up a new virtual environment and install all requirements:

```bash
virtualenv --python=python3.6 .venv
source .venv/bin/activate
pip install -e .[testing]
```

or using conda:

```bash
conda create --name=rle_array shellcheck --file=requirements.txt --file=test-requirements.txt
conda activate rle_array
pip install -e .[testing]
pip install poetry
poetry install
```

### Code style
Expand All @@ -48,45 +41,45 @@ To ensure a consistent code style across the code base we're using the following
We have a convenience script that runs all these tools and a code style check for you:

```bash
./scripts/fmt.sh
poetry run ./scripts/fmt.sh
```

### Testing
There are different tools that ensure a well tested and presented library. To run them all at once (useful for
development), use:

```bash
./scripts/test.sh
poetry run ./scripts/test.sh
```

### Pytest
We're using [pytest](https://pytest.org) as a testing framework and make heavy use of `fixtures` and `parametrization`.
To run the tests simply run:

```bash
pytest
poetry run pytest
```

### Benchmarks
For performance critical code paths we have [asv](https://asv.readthedocs.io/) benchmarks in place in the subfolder
`asv_bench`. To run the benchmarks a single time and receive immediate feedback run

```bash
asv run --python=same --show-stderr
poetry run asv run --python=same --show-stderr
```

### Documentation
Documentation is created using [Sphinx](https://www.sphinx-doc.org/) and can be build by using:

```bash
python setup.py build_sphinx
poetry run python setup.py build_sphinx
```

### Typing
We use [mypy](http://mypy-lang.org/) to check python types. It can be run using:

```bash
mypy .
poetry run mypy .
```

## Performance Improvements
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 JDA Software, Inc
Copyright (c) 2019-2020 Blue Yonder Group, Inc

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
sys.path.append(os.path.abspath(os.path.join(__location__, "sphinxext")))

add_module_names = False
author = "JDA Software, Inc"
copyright = "2019, JDA Software, Inc"
author = "Blue Yonder Group, Inc"
copyright = "2019-2020, Blue Yonder Group, Inc"
project = "rle-array"
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
extensions = [
Expand Down
51 changes: 51 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[build-system]
requires = [
"poetry>=0.12",
]
build-backend = "poetry.masonry.api"

[tool.isort]
profile = "black"

[tool.poetry]
name = "rle-array"
description = "Run-length encoded pandas."
authors= [
"Blue Yonder Group, Inc",
]
version = "0.1"
readme = "README.rst"
license = "MIT"
packages = [
{ include = "rle_array" },
]
repository = "https://github.com/JDASoftwareGroup/rle_array"
keywords = [
"python",
]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
]

[tool.poetry.dependencies]
python = ">=3.6.1,<3.9"
numba = ">=0.45"
numpy = ">=1.17"
pandas = ">=1.0.3,<1.1"

[tool.poetry.dev-dependencies]
asv = "*"
black = "19.10b0"
flake8-mutable = "1.2.0"
flake8 = "3.8.3"
isort = "5.0.9"
mypy = "*"
pytest = "*"
pytest-cov = "*"
setuptools_scm = "*"
sphinx = "*"
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ isort --recursive --check-only
flake8
asv --config ./asv_bench/asv.conf.json run --show-stderr --environment existing --quick
python setup.py build_sphinx
shellcheck scripts/*.sh
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[build_sphinx]
source-dir = docs
build-dir = docs/_build
builder = doctest,html
warning-is-error = true
51 changes: 3 additions & 48 deletions setup.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,50 +1,5 @@
import os
from typing import List

from setuptools import setup


def get_requirements(path: str) -> List[str]:
with open(os.path.join(os.path.dirname(__file__), path)) as fp:
content = fp.read()
return [req for req in content.split("\n") if req != "" and not req.startswith("#")]


def setup_package() -> None:
name = "rle_array"

setup(
name=name,
packages=["rle_array"],
description="Run-length encoded pandas.",
author="JDA Software, Inc",
python_requires=">=3.6",
url="https://github.com/JDASoftwareGroup/rle_array",
license="MIT",
long_description=open("README.rst", "r").read(),
install_requires=get_requirements("requirements.txt"),
tests_require=get_requirements("test-requirements.txt"),
extras_require={"testing": get_requirements("test-requirements.txt")},
keywords=["python"],
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
],
use_scm_version=True,
command_options={
"build_sphinx": {
"source_dir": ("setup.py", "docs"),
"build_dir": ("setup.py", "docs/_build"),
"builder": ("setup.py", "doctest,html"),
"warning_is_error": ("setup.py", "1"),
}
},
)

#!/usr/bin/env python
import setuptools

if __name__ == "__main__":
setup_package()
setuptools.setup()
10 changes: 0 additions & 10 deletions test-requirements.txt

This file was deleted.

0