Skip to content

Commit

Permalink
Merge pull request #194 from RommelLayco/RommelLayco-pyproject-toml
Browse files Browse the repository at this point in the history
Update project to use pyproject.toml
  • Loading branch information
facetoe authored Mar 28, 2024
2 parents 7a4b1ae + ed10795 commit d6f28c5
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 172 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ jobs:
cache: 'pip'

- name: Install requirements
run: pip install -r requirements.txt
run: |
pip install "."
pip install ".[dev]"
- name: Run all pre-commit hooks
run: make lint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: pip install -e '.[cassandra]'

- name: Install testing requirements (not included by default in normal install)
run: pip install -r requirements.testing.txt
run: pip install ".[dev]"

- name: Execute unit-tests
run: make unittest
Expand Down
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ PROTODIR=astacus/proto
PROTOBUFS = $(wildcard $(PROTODIR)/*.proto)
GENERATED_PROTOBUFS = $(patsubst %.proto,%_pb2.py,$(PROTOBUFS))

GENERATED = astacus/version.py $(GENERATED_PROTOBUFS)
GENERATED = $(GENERATED_PROTOBUFS)

PYTHON = python3
DNF_INSTALL = sudo dnf install -y
Expand All @@ -20,11 +20,20 @@ ZOOKEEPER_HASH = 284cb4675adb64794c63d95bf202d265cebddc0cda86ac86fb0ede8049de918
default: $(GENERATED)

venv: default
$(PYTHON) -m venv venv && source venv/bin/activate && pip install -U pip && pip install -r requirements.txt
$(PYTHON) -m venv venv && source venv/bin/activate && pip install -U pip && pip install . ".[dev]"

clean:
rm -rf rpm/ $(GENERATED)

.PHONY: astacus/version.py
python-build:
$(PYTHON) -m build

.PHONY: dev-deps
dev-deps:
pip install .
pip install ".[dev]"

.PHONY: build-dep-fedora
build-dep-fedora:
sudo dnf -y install --best --allowerasing rpm-build
Expand Down Expand Up @@ -146,8 +155,5 @@ rpm: $(GENERATED) /usr/bin/rpmbuild /usr/lib/rpm/check-buildroot
--define 'minor_version $(subst -,.,$(subst $(SHORT_VER)-,,$(LONG_VER)))'
$(RM) astacus-rpm-src.tar

astacus/version.py: version_from_git.py
$(PYTHON) $^ $@

%_pb2.py: %.proto
protoc -I $(PROTODIR) $< --python_out=$(PROTODIR)
2 changes: 1 addition & 1 deletion astacus/node/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def write_hashes_to_storage(
parallel: int,
progress: Progress,
still_running_callback=lambda: True,
validate_file_hashes: bool = True
validate_file_hashes: bool = True,
):
todo = [
(hexdigest, list(snapshot.get_files_for_digest(hexdigest)))
Expand Down
80 changes: 80 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,83 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "astacus"
authors = [
{ name="Aiven", email="[email protected]" },
]
description = "Astacus, cluster (database) backup tool"
readme = "README.md"
requires-python = ">=3.11"
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.11",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Software Development :: Libraries",
]
license = { text = "Apache License 2.0" }
dynamic = ["version"]
dependencies = [
"fastapi",
"httpx",
"msgspec",
"kazoo",
"protobuf < 3.21",
"pydantic",
"pyyaml",
"rohmu >= 2.2.0",
"sentry-sdk",
"tabulate",
"typing-extensions >= 4.7.1",
"uvicorn==0.15.0",
"wcmatch",
]

[project.optional-dependencies]
dev = [
# makefile convenience"
"pre-commit>=2.20.0",
# pre-commit tasks in Makefile need these"
"anyio==3.5.0",
"pylint==2.15.5",
"pytest-asyncio==0.21.1",
"pytest-cov==3.0.0",
"pytest-mock==3.3.1",
"pytest-order==1.0.0",
"pytest-timeout==1.4.2",
"pytest-watch==4.2.0",
"pytest==7.2.2",
# pinning mypy to the same version as pre-commit"
"mypy==1.0.0",
# types for things that don't seem to have them"
"types-PyYAML>=6.0.12.2",
"types-tabulate>=0.9.0.0",
"types-urllib3>=1.26.25.4",
"typing_extensions>=4.4.0",
"freezegun>=1.2",
"respx==0.20.1",
]

[project.urls]
"Homepage" = "https://github.com/Aiven-Open/astacus"
"Bug Tracker" = "https://github.com/Aiven-Open/astacus/issues"

[project.scripts]
astacus = "astacus.main:main"


[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "astacus/version.py"


[tool.black]
line-length = 125

Expand Down
32 changes: 0 additions & 32 deletions requirements.testing.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

27 changes: 0 additions & 27 deletions setup.cfg

This file was deleted.

51 changes: 0 additions & 51 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get_clickhouse_version(command: Sequence[str | Path]) -> tuple[int, ...]:


def is_cassandra_driver_importable() -> bool:
return importlib.util.find_spec("cassandra") is not None
return importlib.util.find_spec("cassandra") is not None # type: ignore[attr-defined]


def format_astacus_command(*arg: str) -> Sequence[str]:
Expand Down
51 changes: 0 additions & 51 deletions version_from_git.py

This file was deleted.

0 comments on commit d6f28c5

Please sign in to comment.