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

256 all configs within pyprojecttoml for a streamlined build experience #271

Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3bf75bd
:sparkles: moved ruff and coverage config to pyproject.toml
davidhopkinson26 Jul 15, 2024
fdc7e4c
:fire: delete redundant config files
davidhopkinson26 Jul 16, 2024
7dc3d1c
add build-system and project secitons to pyproject.toml
davidhopkinson26 Jul 16, 2024
b9ad64f
bug fixes and adding [dev] optional dependencies
davidhopkinson26 Jul 16, 2024
5ea9a0b
:fire: delete requirements files
davidhopkinson26 Jul 16, 2024
015002a
Revert ":fire: delete requirements files"
davidhopkinson26 Jul 16, 2024
41afadb
:fire: removed dev dependency spec from pyproject.toml
davidhopkinson26 Jul 16, 2024
e99d4b8
:fire: deleted requirements.txt
davidhopkinson26 Jul 16, 2024
467400f
:construction: edits to release.yml to use build
davidhopkinson26 Jul 16, 2024
d041460
:bug: fixes to format in pyproject.toml for build to run
davidhopkinson26 Jul 16, 2024
7d331ce
:bug: adds requirements.txt back in
davidhopkinson26 Jul 16, 2024
f2189d9
separate calls to build --sdist and build --wheel
davidhopkinson26 Jul 16, 2024
b3cdfd7
Revert "separate calls to build --sdist and build --wheel"
davidhopkinson26 Jul 17, 2024
60a7e0d
:fire: point publish to pypi not testpypi
davidhopkinson26 Jul 17, 2024
387d947
:art: define requirements in pyproject.toml and use pip-compile to cr…
davidhopkinson26 Jul 17, 2024
85dde0c
removed python 3.12 from python-package.yml matrix as conflicts with …
davidhopkinson26 Jul 17, 2024
117a218
:construciton: adds pip compile to build pipeline and puts python 3.1…
davidhopkinson26 Jul 17, 2024
46cda92
:construction: swithc to using uv for compile in build pipeline
davidhopkinson26 Jul 17, 2024
90e8ac4
:construction: adds dev to pip compile command in build pipeline
davidhopkinson26 Jul 17, 2024
59f857d
:construction: install directly from pyproject.toml
davidhopkinson26 Jul 17, 2024
6aaee4c
:bug: fix code rendering in CONTRIBUTING.rst
davidhopkinson26 Jul 17, 2024
2e21ad6
:art: moved build install into Install dependencies step
davidhopkinson26 Jul 17, 2024
3942b60
:art: cleaned up old comments
davidhopkinson26 Jul 17, 2024
1e0bbf1
:fire: removed setup.py
davidhopkinson26 Jul 24, 2024
fad971f
:fire: removed requirements.txt
davidhopkinson26 Jul 24, 2024
81961d2
:sparkles: implements setuptools-scm to do dynamic versioning
davidhopkinson26 Jul 24, 2024
a9972f2
:bug: fixed import of version into base.py
davidhopkinson26 Jul 24, 2024
aff5f87
:fire: removed self.version setting as not used anywhere
davidhopkinson26 Jul 24, 2024
c066cef
u:memo: pdated Changelog
davidhopkinson26 Jul 24, 2024
d964161
Merge branch 'main' into 256-all-configs-within-pyprojecttoml-for-a-s…
davidhopkinson26 Aug 5, 2024
5b80647
:bug: removed version import form base.py
davidhopkinson26 Aug 5, 2024
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
16 changes: 0 additions & 16 deletions .coveragerc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
python -m pip install uv
uv venv -p ${{ matrix.python-version }} ${{ matrix.python-version }}
source ${{ matrix.python-version }}/bin/activate
uv pip install -r requirements-dev.txt
uv pip install .[dev]

- name: Test with pytest
if: always()
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ jobs:
with:
python-version: "3.x"
- name: Install dependencies
run: pip install wheel
- name: Build Package
run: |
pip install setuptools
python setup.py sdist bdist_wheel
pip install build
pip install wheel
- name: Build Package
run:
python -m build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

69 changes: 0 additions & 69 deletions .ruff.toml

This file was deleted.

19 changes: 19 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ If working in a codespace the dev requirements and precommit will be installed a

If you are building the documentation locally you will need the `docs/requirements.txt <https://github.com/lvgig/tubular/blob/main/docs/requirements.txt>`_.

Dependencies
^^^^^^^^^^^^
A point of surprise for some might be that `requirements.txt` and `requirements-dev.txt` are not user-edited files in this repo -
they are compiled using `pip-tools= <https://github.com/jazzband/pip-tools?tab=readme-ov-file#example-usage-for-pip-compile>`_ from
dependencies listed `pyproject.toml`. When adding a new direct dependency, simply add it to the appropriate field inside the package config -
there is no need to pin it, but you can specify a minimum requirement. Then use `pip-compile <https://medium.com/packagr/using-pip-compile-to-manage-dependencies-in-your-python-packages-8451b21a949e>`_
to create a pinned set of dependencies, ensuring reproducibility.

`requirements.txt` and `requirements-dev.txt` are still tracked under source control, despite being 'compiled'.

To compile using `pip-tools`:

.. code::

pip install pip-tools # optional
pip-compile -v --no-emit-index-url --no-emit-trusted-host --output-file requirements.txt pyproject.toml
pip-compile --extra dev -v --no-emit-index-url --no-emit-trusted-host --output-file requirements-dev.txt pyproject.toml


General
^^^^^^^

Expand Down
7 changes: 0 additions & 7 deletions bandit.yml

This file was deleted.

Empty file removed conftest.py
Empty file.
135 changes: 135 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
[build-system]
requires = [
"setuptools >= 61.0",
"wheel",
"setuptools-scm[toml]>=6.0"
]
build-backend = "setuptools.build_meta"

[project]
name = "tubular"
version = "1.3.1"
dependencies = [
"pandas>=1.5.0",
"scikit-learn>=1.2.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah - answered my own question by seeing that you install directly from the pyproject file.

]
requires-python = ">=3.8"
authors = [{ name = "LV GI Data Science Team", email="#[email protected]"}]
description = "Package to perform pre processing steps for machine learning models"
readme = {file = "README.md", content-type = "text/markdown"}
license = {file = "LICENSE"}
keywords = ["data science", "feature engineering", "data transforms", "pipeline", "sklearn", "machine learning", "ML", "DS"]
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
"License :: OSI Approved :: BSD License",
]

[project.optional-dependencies]
dev = [
"test-aide>=0.1.0",
"pytest>=5.4.1",
"pytest-mock>=3.5.1",
"pytest-cov>=2.10.1",
"pre-commit==2.15.0 ",
"ruff==0.2.2",
]

[project.urls]
Documentation = "https://tubular.readthedocs.io/en/latest/index.html"
Repository = "https://github.com/lvgig/tubular"
Issues = "https://github.com/lvgig/tubular/issues"
Changelog = "https://github.com/lvgig/tubular/CHANGELOG.md"

[tool.ruff]
# Same as Black.
line-length = 88

# Assume Python 3.8.
target-version = "py38"
adamsardar marked this conversation as resolved.
Show resolved Hide resolved

[tool.ruff.lint]
# Enable the pycodestyle (`E`) and Pyflakes (`F`) rules by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = [
"A",
"ANN",
"ASYNC",
"B", # bugbear
"C4",
"COM",
"DTZ",
"E", # pycodestyle
"EM",
"F", # Pyflakes
"FA",
"FLY",
"I",
"INT",
"ISC",
"NPY",
"PD",
"PERF",
"PGH",
"PIE",
"PLC",
"PLE",
"PLW",
"PYI",
"Q",
"RET",
"RSE",
"S", # Bandit
"SIM",
"SLOT",
"T10",
"TCH",
"TID",
"UP",
"W", # pycodestyle warnings
"YTT",
]

# Enabled to allow direct type comparisons using is and is not under E721 (see https://docs.astral.sh/ruff/rules/type-comparison/)
preview = true

# ignore E501 - linelength limit (covered by black except in docstrings)
# and PD901 - use of df variable name
ignore = ["E501", "PD901", "ANN101"]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [".git", "__pycache__", "build", "dist", "source"]

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Ignore `E402` (import violations) in all `__init__.py` file.
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "F401"]
"tests/*" = ["ANN", "S101"]


[tool.coverage.run]
branch = true

include = ["tubular/*"]

omit = [
"tests/*",
]

[tool.coverage.report]

show_missing = true

fail_under = 80
87 changes: 79 additions & 8 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,79 @@
test-aide>=0.1.0
pandas>=1.5.0
scikit-learn>=1.2.0
pytest>=5.4.1
pytest-mock>=3.5.1
pytest-cov>=2.10.1
pre-commit==2.15.0
ruff==0.2.2
#
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --extra=dev --no-emit-index-url --no-emit-trusted-host --output-file=requirements-dev.txt pyproject.toml
#
cfgv==3.4.0
# via pre-commit
coverage[toml]==7.6.0
# via pytest-cov
distlib==0.3.8
# via virtualenv
exceptiongroup==1.2.2
# via pytest
filelock==3.15.4
# via virtualenv
identify==2.6.0
# via pre-commit
iniconfig==2.0.0
# via pytest
joblib==1.4.2
# via scikit-learn
nodeenv==1.9.1
# via pre-commit
numpy==1.24.4
# via
# pandas
# scikit-learn
# scipy
packaging==24.1
# via pytest
pandas==2.0.3
# via tubular (pyproject.toml)
platformdirs==4.2.2
# via virtualenv
pluggy==1.5.0
# via pytest
pre-commit==2.15.0
# via tubular (pyproject.toml)
pytest==8.2.2
# via
# pytest-cov
# pytest-mock
# test-aide
# tubular (pyproject.toml)
pytest-cov==5.0.0
# via tubular (pyproject.toml)
pytest-mock==3.14.0
# via
# test-aide
# tubular (pyproject.toml)
python-dateutil==2.9.0.post0
# via pandas
pytz==2024.1
# via pandas
pyyaml==6.0.1
# via pre-commit
ruff==0.2.2
# via tubular (pyproject.toml)
scikit-learn==1.3.2
# via tubular (pyproject.toml)
scipy==1.10.1
# via scikit-learn
six==1.16.0
# via python-dateutil
test-aide==0.1.1
# via tubular (pyproject.toml)
threadpoolctl==3.5.0
# via scikit-learn
toml==0.10.2
# via pre-commit
tomli==2.0.1
# via
# coverage
# pytest
tzdata==2024.1
# via pandas
virtualenv==20.26.3
# via pre-commit
Loading
Loading