Skip to content

Commit

Permalink
Move optional dependencies from dev_requirements to `pyproject.toml…
Browse files Browse the repository at this point in the history
…`; Introduce Hatchling Build (#268)

Co-authored-by: konstantin <konstantin.klein@hochfrequenz.de>
  • Loading branch information
FreddyFox892 and hf-kklein authored Sep 26, 2024
1 parent fa5f290 commit 195bb97
Show file tree
Hide file tree
Showing 23 changed files with 127 additions and 266 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./dev_requirements/requirements-formatting.txt
pip install .[formatting]
- name: Black Code Formatter
run: |
black . --check
10 changes: 7 additions & 3 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ "3.12" ]
os: [ ubuntu-latest ]
# Specifying a GitHub environment, # Specifying a GitHub environment, which is strongly recommended by PyPI: https://docs.pypi.org/trusted-publishers/adding-a-publisher/
# you have to create an environment in your repository settings and add the environment name here
environment: release
Expand All @@ -45,14 +49,14 @@ jobs:
needs: tests
steps:
- uses: actions/checkout@v4
- name: Set up Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev_requirements/requirements-test_packaging.txt
pip install .[test_packaging]
- name: Build wheel and source distributions
run: |
python -m build
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The framework
- enforces users to adapt to structured and consistent patterns
- and by doing so will lead to higher chances for maintainable and reusable code.

## Architeture / Overview
## Architecture / Overview
The overall setup for a migration from 1-n source systems (A, B, C...) to 1-m target systems (1,2, 3...) might look like this:

```mermaid
Expand Down
1 change: 0 additions & 1 deletion dev_requirements/requirements-coverage.in

This file was deleted.

8 changes: 0 additions & 8 deletions dev_requirements/requirements-coverage.txt

This file was deleted.

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

This file was deleted.

20 changes: 0 additions & 20 deletions dev_requirements/requirements-formatting.txt

This file was deleted.

1 change: 0 additions & 1 deletion dev_requirements/requirements-linting.in

This file was deleted.

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

This file was deleted.

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

This file was deleted.

80 changes: 0 additions & 80 deletions dev_requirements/requirements-test_packaging.txt

This file was deleted.

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

This file was deleted.

34 changes: 0 additions & 34 deletions dev_requirements/requirements-tests.txt

This file was deleted.

3 changes: 0 additions & 3 deletions dev_requirements/requirements-type_check.in

This file was deleted.

18 changes: 0 additions & 18 deletions dev_requirements/requirements-type_check.txt

This file was deleted.

2 changes: 2 additions & 0 deletions domain-specific-terms.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# contains 1 lower case word per line which are ignored in the spell_check
adresse
98 changes: 95 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,70 @@
[project]
name = "bomf"
description = "BO4E Migration Framework"
license = { text = "MIT" }
requires-python = ">=3.11"
authors = [{ name = "Hochfrequenz Unternehmensberatung GmbH", email = "info@hochfrequenz.de" }]
keywords = ["BO4E", "Migration", "Data"]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"pydantic>=2.0.0",
"typeguard",
"frozendict",
"bidict",
"networkx",
"injector",
"python-generics",
"pvframework"
] # add all the dependencies here
dynamic = ["readme", "version"]

[project.optional-dependencies]
tests = [
"pytest==8.3.3",
"pytest-asyncio==0.24.0",
"bo4e==202401.2.1"
]
linting = [
"pylint==3.2.7"
]
type_check = [
"mypy==1.11.2",
"networkx-stubs==0.0.1",
"types-frozendict==2.0.9"
]
spellcheck = [
"codespell==2.3.0"
]
coverage = [
"coverage==7.6.1"
]
formatting = [
"black==24.8.0",
"isort==5.13.2"
]
test_packaging = [
"build==1.2.2",
"twine==5.1.1"
]
dev = [
"pip-tools"
]


[project.urls]
Changelog = "https://github.com/Hochfrequenz/bo4e_migration_framework/releases"
Homepage = "https://github.com/Hochfrequenz/bo4e_migration_framework"

[tool.black]
line-length = 120

Expand All @@ -9,6 +76,12 @@ profile = "black"
max-line-length = 120
disable="fixme"

[mypy]
truethy-bool = true

[tool.mypy]
disable_error_code = []

[tool.pytest.ini_options]
# When the mode is auto, all discovered async tests are considered asyncio-driven
# even if they have no @pytest.mark.asyncio marker.
Expand All @@ -18,7 +91,26 @@ asyncio_mode = "auto"
# the following lines are needed if you would like to build a python package
# and you want to use semantic versioning
[build-system]
requires = ["setuptools>=41.0", "wheel", "setuptools_scm[toml]>=3.4"]
build-backend = "setuptools.build_meta"
requires = ["hatchling>=1.8.0", "hatch-vcs", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build"


[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"
fragments = [{ path = "README.md" }]

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

[tool.hatch.build.hooks.vcs]
version-file = "src/_bomf_version.py"
template = '''
version = "{version}"
'''

[tool.hatch.build.targets.sdist]
exclude = ["/unittests"]

[tool.setuptools_scm]
[tool.hatch.build.targets.wheel]
only-include = ["src"]
sources = ["src"]
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile requirements.in
Expand Down Expand Up @@ -36,4 +36,3 @@ typing-extensions==4.9.0
# via
# pydantic
# pydantic-core
# typeguard
Loading

0 comments on commit 195bb97

Please sign in to comment.