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

Move package metadata and tool configuration to pyproject.toml #1158

Merged
merged 11 commits into from
Nov 7, 2023
Merged
20 changes: 0 additions & 20 deletions .bumpversion.cfg

This file was deleted.

16 changes: 0 additions & 16 deletions .coveragerc

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,6 @@ tlo.conf
# ignore all files in outputs directory, except README
outputs/*
!outputs/README

# ignore _version.py file generated by setuptools_scm
src/**/_version.py
2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ graft tests
graft requirements

include README.rst
include .bumpversion.cfg
include .coveragerc
include tox.ini
include tlo.example.conf
include CITATION.cff
Expand Down
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import os
import sys
from importlib.metadata import version as get_version

sys.path.insert(0, os.path.abspath('../..')), os.path.abspath('../src')

Expand Down Expand Up @@ -39,7 +40,8 @@
year = '2021'
author = 'The TLOmodel Team'
copyright = '{0}, {1}'.format(year, author)
version = release = '0.1.0'
release = get_version('setuptools_scm')
version = ".".join(release.split('.')[:2])

pygments_style = 'trac'
templates_path = ['.']
Expand Down
144 changes: 144 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=62", "setuptools_scm[toml]>=8.0"]

[project]
name = "tlo"
authors = [
{name = "Thanzi La Onse Model Development Team"},
]
classifiers = [
'Development Status :: 3 - Alpha',
'Intended Audience :: Science/Research',
'License :: MIT',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'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',
]
dependencies = [
"GitPython",
"click",
"matplotlib",
"pyshp",
"squarify",
"numpy",
"pandas~=2.0.0",
"scipy",
# Avoid https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1963
"openpyxl==3.1.0",
# To submit jobs to Azure Batch
"azure-batch",
"azure-identity",
"azure-keyvault",
"azure-storage-file-share",
]
description = "Thanzi la Onse Epidemiology Model"
dynamic = ["version"]
license = {file = "LICENSE.txt"}
readme = "README.rst"
requires-python = ">=3.8"

[project.optional-dependencies]
dev = [
# Running tests
"pytest",
"pytest-cov",
"pytest-xdist",
"virtualenv",
"tox",
# Linting
"isort",
"pylint",
"ruff",
# Profiling
"pyinstrument>=4.3",
# Building requirements files
"pip-tools",
]

[project.scripts]
tlo = "tlo.cli:cli"

[project.urls]
repository = "https://github.com/UCL/TLOmodel"
documentation = "https://tlomodel.org"

[tool.coverage]
report = {show_missing = true, precision = 2}
run = {branch = true, parallel = true, source = [
"tlo",
"tests"
]}
paths.source = [
"src",
"*/site-packages",
]

[tool.isort]
force_single_line = false
multi_line_output = 3
include_trailing_comma = true
line_length = 100
known_first_party = "tlo"
default_section = "THIRDPARTY"

[tool.pylint.main]
extension-pkg-whitelist = ["numpy"]
disable = [
"R",
"C",
"W",
"E0110", # abstract class instantiated
"E0611", # no-name-in-module
"E0702", # raising NoneType
"E1136", # unsubscriptable type
"E1137", # doesn't support item assignment
"E1101", # no-member
"E1120", # no-value-for-parameter
"E1130", # bad operand type for unary ~
]


[tool.pylint.typecheck]
signature-mutators = [
"click.decorators.option",
"click.decorators.argument",
"click.decorators.version_option",
"click.decorators.help_option",
"click.decorators.pass_context",
"click.decorators.confirmation_option",
]

[tool.pytest.ini_options]
testpaths = "tests"
python_files = [
"test_*.py",
"*_test.py",
"tests.py",
]
addopts = "-ra --strict-markers --doctest-modules --doctest-glob=*.rst --tb=short"
markers = ["group2", "slow"]

[tool.ruff]
target-version = "py38"
line-length = 120
ignore = [
"E712", # comparison to False
"E713", # use `not in`
"E714", # use `is not`
"E721", # do not compare types
"E731", # do not assign a lambda expression
"E741", # ambiguous variable name
"F601", # dictionary literal key repeated
]

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools_scm]
version_file = "src/tlo/_version.py"
17 changes: 0 additions & 17 deletions requirements/Makefile

This file was deleted.

17 changes: 0 additions & 17 deletions requirements/base.in

This file was deleted.

46 changes: 21 additions & 25 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#
# This file is autogenerated by pip-compile
# To update, run:
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=base.txt base.in
# pip-compile --output-file=/home/matt/projects/TLOmodel/requirements/base.txt
#
adal==1.2.7
# via msrestazure
azure-batch==14.0.0
# via -r base.in
# via tlo (pyproject.toml)
azure-common==1.1.28
# via
# azure-batch
Expand All @@ -23,17 +23,17 @@ azure-core==1.29.4
# azure-storage-file-share
# msrest
azure-identity==1.14.0
# via -r base.in
# via tlo (pyproject.toml)
azure-keyvault==4.2.0
# via tlo (pyproject.toml)
azure-keyvault-certificates==4.7.0
# via azure-keyvault
azure-keyvault-keys==4.8.0
# via azure-keyvault
azure-keyvault-secrets==4.7.0
# via azure-keyvault
azure-keyvault==4.2.0
# via -r base.in
azure-storage-file-share==12.14.1
# via -r base.in
# via tlo (pyproject.toml)
certifi==2023.7.22
# via
# msrest
Expand All @@ -43,7 +43,7 @@ cffi==1.15.1
charset-normalizer==3.2.0
# via requests
click==8.1.7
# via -r base.in
# via tlo (pyproject.toml)
contourpy==1.1.1
# via matplotlib
cryptography==41.0.3
Expand All @@ -63,11 +63,9 @@ fonttools==4.42.1
gitdb==4.0.10
# via gitpython
gitpython==3.1.36
# via -r base.in
# via tlo (pyproject.toml)
idna==3.4
# via requests
importlib-resources==6.0.1
# via matplotlib
isodate==0.6.1
# via
# azure-keyvault-certificates
Expand All @@ -78,32 +76,32 @@ isodate==0.6.1
kiwisolver==1.4.5
# via matplotlib
matplotlib==3.7.3
# via -r base.in
msal-extensions==1.0.0
# via azure-identity
# via tlo (pyproject.toml)
msal==1.24.0
# via
# azure-identity
# msal-extensions
msal-extensions==1.0.0
# via azure-identity
msrest==0.7.1
# via msrestazure
msrestazure==0.6.4
# via azure-batch
numpy==1.24.4
# via
# -r base.in
# contourpy
# matplotlib
# pandas
# scipy
# tlo (pyproject.toml)
oauthlib==3.2.2
# via requests-oauthlib
openpyxl==3.1.0
# via -r base.in
# via tlo (pyproject.toml)
packaging==23.1
# via matplotlib
pandas==2.0.3
# via -r base.in
# via tlo (pyproject.toml)
pillow==10.0.1
# via matplotlib
portalocker==2.8.2
Expand All @@ -117,25 +115,25 @@ pyjwt[crypto]==2.8.0
pyparsing==3.1.1
# via matplotlib
pyshp==2.3.1
# via -r base.in
# via tlo (pyproject.toml)
python-dateutil==2.8.2
# via
# adal
# matplotlib
# pandas
pytz==2023.3.post1
# via pandas
requests-oauthlib==1.3.1
# via msrest
requests==2.31.0
# via
# adal
# azure-core
# msal
# msrest
# requests-oauthlib
requests-oauthlib==1.3.1
# via msrest
scipy==1.10.1
# via -r base.in
# via tlo (pyproject.toml)
six==1.16.0
# via
# azure-core
Expand All @@ -145,7 +143,7 @@ six==1.16.0
smmap==5.0.1
# via gitdb
squarify==0.4.3
# via -r base.in
# via tlo (pyproject.toml)
typing-extensions==4.8.0
# via
# azure-core
Expand All @@ -157,5 +155,3 @@ tzdata==2023.3
# via pandas
urllib3==2.0.4
# via requests
zipp==3.16.2
# via importlib-resources
Loading