Skip to content

Commit a511076

Browse files
Move build system to poetry
1 parent 1a8a065 commit a511076

File tree

9 files changed

+82
-114
lines changed

9 files changed

+82
-114
lines changed

.github/workflows/ci.yml

+16-36
Original file line numberDiff line numberDiff line change
@@ -17,55 +17,35 @@ jobs:
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v2
20-
- name: Conda Bootstrap
21-
uses: goanpeca/setup-miniconda@v1
20+
- name: Set up Python ${{ matrix.python }}
21+
uses: actions/setup-python@v2
2222
with:
23-
auto-update-conda: true
2423
python-version: ${{ matrix.python }}
25-
- name: Conda Config
26-
run: |
27-
conda config --add channels conda-forge
28-
conda config --add channels numba
29-
conda config --set channel_priority strict
30-
conda config --set always_yes yes
31-
conda config --set changeps1 no
32-
conda config --set pip_interop_enabled True
33-
- name: Conda Install
34-
shell: bash -l {0}
35-
run: conda install --yes shellcheck --file=requirements.txt --file=test-requirements.txt
36-
- name: Pip Install
37-
shell: bash -l {0}
38-
run: pip install --no-deps -e .[testing]
24+
- name: Install Poetry Itself
25+
run: pip install poetry
26+
- name: Poetry Install
27+
run: poetry install
3928
- name: Flake8
40-
shell: bash -l {0}
41-
run: flake8
29+
run: poetry run flake8
4230
- name: Mypy
43-
shell: bash -l {0}
44-
run: mypy .
31+
run: poetry run mypy .
4532
- name: Black
46-
shell: bash -l {0}
47-
run: black --check .
33+
run: poetry run black --check .
4834
- name: Isort
49-
shell: bash -l {0}
50-
run: isort --recursive --check-only
35+
run: poetry run isort --recursive --check-only
5136
- name: Pytest
52-
shell: bash -l {0}
53-
run: pytest
37+
run: poetry run pytest
5438
- name: ASV
55-
shell: bash -l {0}
5639
run: |
57-
asv --config ./asv_bench/asv.conf.json machine --machine travis --os unknown --arch unknown --cpu unknown --ram unknown
58-
asv --config ./asv_bench/asv.conf.json run --show-stderr --environment existing --quick
40+
poetry run asv --config ./asv_bench/asv.conf.json machine --machine travis --os unknown --arch unknown --cpu unknown --ram unknown
41+
poetry run asv --config ./asv_bench/asv.conf.json run --show-stderr --environment existing --quick
5942
- name: Sphinx
60-
shell: bash -l {0}
6143
run: |
62-
python setup.py build_sphinx
44+
poetry run python setup.py build_sphinx
6345
touch ./docs/_build/html/.nojekyll
64-
- name: Build Wheel
65-
shell: bash -l {0}
66-
run: python setup.py sdist bdist_wheel
46+
- name: Build
47+
run: poetry build
6748
- name: Shellcheck
68-
shell: bash -l {0}
6949
run: shellcheck scripts/*.sh
7050
- name: Preserve Dist
7151
uses: actions/upload-artifact@v1

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
__pycache__/
88
build/
99
coverage.xml
10+
poetry.lock
1011
dist/
1112
docs/_build/
1213
docs/_rst/

CONTRIBUTING.md

+9-16
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,13 @@ tooling. See the "Development Plan" in the README for the generic prioritization
2121
## Development
2222

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

2626
```bash
2727
virtualenv --python=python3.6 .venv
2828
source .venv/bin/activate
29-
pip install -e .[testing]
30-
```
31-
32-
or using conda:
33-
34-
```bash
35-
conda create --name=rle_array shellcheck --file=requirements.txt --file=test-requirements.txt
36-
conda activate rle_array
37-
pip install -e .[testing]
29+
pip install poetry
30+
poetry install
3831
```
3932

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

5043
```bash
51-
./scripts/fmt.sh
44+
poetry run ./scripts/fmt.sh
5245
```
5346

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

5851
```bash
59-
./scripts/test.sh
52+
poetry run ./scripts/test.sh
6053
```
6154

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

6659
```bash
67-
pytest
60+
poetry run pytest
6861
```
6962

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

7467
```bash
75-
asv run --python=same --show-stderr
68+
poetry run asv run --python=same --show-stderr
7669
```
7770

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

8174
```bash
82-
python setup.py build_sphinx
75+
poetry run python setup.py build_sphinx
8376
```
8477

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

8881
```bash
89-
mypy .
82+
poetry run mypy .
9083
```
9184

9285
## Performance Improvements

pyproject.toml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[build-system]
2+
requires = [
3+
"poetry>=0.12",
4+
]
5+
build-backend = "poetry.masonry.api"
6+
7+
[tool.poetry]
8+
name = "rle-array"
9+
description = "Run-length encoded pandas."
10+
authors= [
11+
"JDA Software, Inc",
12+
]
13+
version = "0.1"
14+
readme = "README.rst"
15+
license = "MIT"
16+
packages = [
17+
{ include = "rle_array" },
18+
]
19+
repository = "https://github.com/JDASoftwareGroup/rle_array"
20+
keywords = [
21+
"python",
22+
]
23+
classifiers = [
24+
"Development Status :: 4 - Beta",
25+
"Environment :: Console",
26+
"Intended Audience :: Developers",
27+
"Natural Language :: English",
28+
"Programming Language :: Python",
29+
"Programming Language :: Python :: 3",
30+
]
31+
32+
[tool.poetry.dependencies]
33+
python = ">=3.6.1,<3.9"
34+
numba = ">=0.45"
35+
numpy = ">=1.17"
36+
pandas = ">=1.0.3,<2"
37+
38+
[tool.poetry.dev-dependencies]
39+
asv = "*"
40+
black = "19.10b0"
41+
flake8-mutable = "1.2.0"
42+
flake8 = "3.8.3"
43+
isort = "5.0.9"
44+
mypy = "*"
45+
pytest = "*"
46+
pytest-cov = "*"
47+
setuptools_scm = "*"
48+
sphinx = "*"

requirements.txt

-3
This file was deleted.

scripts/test.sh

-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ isort --recursive --check-only
99
flake8
1010
asv --config ./asv_bench/asv.conf.json run --show-stderr --environment existing --quick
1111
python setup.py build_sphinx
12-
shellcheck scripts/*.sh

setup.cfg

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[build_sphinx]
2+
source-dir = docs
3+
build-dir = docs/_build
4+
builder = doctest,html
5+
warning-is-error = true

setup.py

100644100755
+3-48
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,5 @@
1-
import os
2-
from typing import List
3-
4-
from setuptools import setup
5-
6-
7-
def get_requirements(path: str) -> List[str]:
8-
with open(os.path.join(os.path.dirname(__file__), path)) as fp:
9-
content = fp.read()
10-
return [req for req in content.split("\n") if req != "" and not req.startswith("#")]
11-
12-
13-
def setup_package() -> None:
14-
name = "rle_array"
15-
16-
setup(
17-
name=name,
18-
packages=["rle_array"],
19-
description="Run-length encoded pandas.",
20-
author="JDA Software, Inc",
21-
python_requires=">=3.6",
22-
url="https://github.com/JDASoftwareGroup/rle_array",
23-
license="MIT",
24-
long_description=open("README.rst", "r").read(),
25-
install_requires=get_requirements("requirements.txt"),
26-
tests_require=get_requirements("test-requirements.txt"),
27-
extras_require={"testing": get_requirements("test-requirements.txt")},
28-
keywords=["python"],
29-
classifiers=[
30-
"Development Status :: 4 - Beta",
31-
"Environment :: Console",
32-
"Intended Audience :: Developers",
33-
"Natural Language :: English",
34-
"Programming Language :: Python",
35-
"Programming Language :: Python :: 3",
36-
],
37-
use_scm_version=True,
38-
command_options={
39-
"build_sphinx": {
40-
"source_dir": ("setup.py", "docs"),
41-
"build_dir": ("setup.py", "docs/_build"),
42-
"builder": ("setup.py", "doctest,html"),
43-
"warning_is_error": ("setup.py", "1"),
44-
}
45-
},
46-
)
47-
1+
#!/usr/bin/env python
2+
import setuptools
483

494
if __name__ == "__main__":
50-
setup_package()
5+
setuptools.setup()

test-requirements.txt

-10
This file was deleted.

0 commit comments

Comments
 (0)