Skip to content

Commit

Permalink
refactor!: migrate the whole project to pyproject.toml project defi…
Browse files Browse the repository at this point in the history
…nition (#92)

#92
  • Loading branch information
palazzem authored Aug 25, 2023
2 parents 0dfd637 + d0ba14b commit fa9f4e7
Show file tree
Hide file tree
Showing 20 changed files with 97 additions and 140 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
push:
branches:
- main
- upstream
pull_request:

permissions:
Expand All @@ -31,8 +30,7 @@ jobs:
- name: Upgrade pip and install required tools
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install tox -U
pip install tox
- name: Lint codebase
run: tox -e lint
4 changes: 1 addition & 3 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
push:
branches:
- main
- upstream
pull_request:

permissions:
Expand Down Expand Up @@ -37,8 +36,7 @@ jobs:
- name: Upgrade pip and install required tools
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install tox -U
pip install tox
- name: Test with tox environments
run: tox
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,24 @@ and ask for help in our [Discord channel](https://discord.gg/NSmAPWw8tE) if you

## Development

We accept external contributions even though the project is mostly designed for personal
needs. If you think some parts can be exposed with a more generic interface, feel free
to open a GitHub issue and to discuss your suggestion.
We welcome external contributions, even though the project was initially intended for personal use. If you think some
parts could be exposed with a more generic interface, please open a [GitHub issue](https://github.com/palazzem/econnect-python/issues)
to discuss your suggestion.

### Dev Environment

To create a virtual environment and install the project and its dependencies, execute the following commands in your
terminal:

```bash
# Create and activate a new virtual environment
python3 -m venv venv
source venv/bin/activate

# Upgrade pip and install all projects and their dependencies
pip install --upgrade pip
pip install -e '.[all]'
```

### Coding Guidelines

Expand Down
61 changes: 61 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "elmo"
dynamic = ["version"]
description = 'API adapter used to control programmatically an Elmo alarm system'
readme = "README.md"
requires-python = ">=3.5"
license = "Apache-2.0"
keywords = []
authors = [
{ name = "Emanuele Palazzetti", email = "emanuele.palazzetti@gmail.com" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
"requests[security]",
]

[project.optional-dependencies]
dev = [
"mypy",
# Test
"pytest",
"pytest-cov",
"pytest-mock",
"responses",
"tox",
]

lint = [
"black",
"flake8",
]

all = [
"elmo[dev]",
"elmo[lint]",
]

[project.urls]
Documentation = "https://github.com/palazzem/econnect-python#readme"
Issues = "https://github.com/palazzem/econnect-python/issues"
Source = "https://github.com/palazzem/econnect-python"

[tool.hatch.version]
path = "src/elmo/__about__.py"

[tool.hatch.metadata]
allow-direct-references = true
9 changes: 0 additions & 9 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements/requirements-linting.in

This file was deleted.

28 changes: 0 additions & 28 deletions requirements/requirements-linting.txt

This file was deleted.

5 changes: 0 additions & 5 deletions requirements/requirements-testing.in

This file was deleted.

75 changes: 0 additions & 75 deletions requirements/requirements-testing.txt

This file was deleted.

4 changes: 4 additions & 0 deletions src/elmo/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: 2023-present Emanuele Palazzetti <emanuele.palazzetti@gmail.com>
#
# SPDX-License-Identifier: MIT
__version__ = "0.4.0"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 12 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
[tox]
envlist =
lint
py{36}
py{37}
py{38}
py{39}
py3.6
py3.7
py3.8
py3.9

[testenv]
setenv =
PYTHONPATH = {toxinidir}
PYTHONDONTWRITEBYTECODE=1
deps = -r requirements/requirements-testing.txt
allowlist_externals = pytest
deps =
-e .[dev]
commands =
pytest tests/ --cov elmo -s -v

[testenv:lint]
skip_install = true
deps = -r requirements/requirements-linting.txt
deps =
-e .[lint]
basepython =
python3.9
commands =
flake8 elmo/ tests/ --exclude=elmo/const.py
black elmo/ tests/ --check
flake8 src/elmo/ tests/ --exclude=src/elmo/const.py
black src/elmo/ tests/ --check

[flake8]
max-line-length = 120
exclude =
.tox
conftest.py # Contains fixtures
conftest.py # Contains fixtures

0 comments on commit fa9f4e7

Please sign in to comment.