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

Replacing Setup.py with Pyproject.py #279

Merged
merged 10 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
3 changes: 0 additions & 3 deletions .github/workflows/pypi_packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ jobs:
- name: Setup Env
run: python3 -m pip install --upgrade pip build

- name: Validate setup.py
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is no integrated solution for validating the pyproject.toml file. There are some third-party application but they are unstable.
I've noticed though that tox run excutting its test automatically does a basic level check of the toml file using not a cli command but via package called "tomli". This has been added to the dev-requirments.txt file

run: python3 setup.py check --metadata

- name: Build
run: python3 -m build

Expand Down
6 changes: 3 additions & 3 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
isort==4.3.21
isort==5.13.2
tox
wheel
bumpversion
twine
black
flake8
pylint
tomli==2.0.1
cython
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

needed for tox validation of pyproject.toml

sphinx
sphinx-rtd-theme
mypy==0.770
-r requirements.txt
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

needed to updated because latest version of Py3.11 did not support this version

mypy==1.8.0
6 changes: 3 additions & 3 deletions developer_docs/runtests.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ as seen below
tox -e lint

# reformat all project files
black src tests setup.py
black src tests

# sort imports in project files
isort -rc src tests setup.py
isort -rc src tests

# check pep8 against all project files
flake8 src tests setup.py
flake8 src tests

# lint python code for common errors and codestyle issues
pylint src
Expand Down
51 changes: 49 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

ignore_missing_imports = true
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain this one to me? Don't we need all our imports?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for this catch, its suppose to be under [tool.mypy."pytest.*"]
When ignore_missing_imports is set to true, mypy will not report an error when an imported module cannot be found. This is to replicate the setting that was originally found in the setup.cfg file

[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
Expand All @@ -7,8 +9,53 @@ name = "cromshell"
# Version number is automatically set via bumpversion. DO NOT MODIFY:
version = "2.1.1"
readme = "README.md"

description="Command Line Interface (CLI) for Cromwell servers"
authors=[
{name = "Jonn Smith", email = "[email protected]"},
{name = "Louis Bergelson", email = "[email protected]"},
{name = "Beri Shifaw", email = "[email protected]"},
]
license={text = "BSD 3-Clause"}
requires-python=">=3.7"
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
]
keywords = [
"cromwell", "cromshell", "cromwell-cli", "cromwell-client", "cromwell-api",
"cromwell-rest", "cromwell-utilities", "cromwell-tools",
]
dynamic = ["dependencies", "optional-dependencies"]

[project.urls]
"Homepage" = "https://github.com/broadinstitute/cromshell"
Homepage = "https://github.com/broadinstitute/cromshell"
"Bug Tracker" = "https://github.com/broadinstitute/cromshell/issues"

[project.scripts]
cromshell = "cromshell.__main__:main_entry"

# Configuration for the `setuptools` package
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
optional-dependencies = {dev = { file = ["dev-requirements.txt"]}, tests = { file = ["test-requirements.txt"]}}

[tool.setuptools.packages.find]
where = ["src"]
include = ["cromshell*"]

# former dump_setup.cfg configuration for mypy
[tool.mypy."numpy.*"]
ignore_missing_imports = true

[tool.mypy."pysam.*"]
ignore_missing_imports = true

[tool.mypy."pytest.*"]
8 changes: 0 additions & 8 deletions setup.cfg

This file was deleted.

54 changes: 0 additions & 54 deletions setup.py

This file was deleted.

1 change: 0 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ pytest
pytest-cov
pytest-dependency
coverage>=4.5
-r requirements.txt
16 changes: 10 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ignore = E203, E501, W503

[testenv]
deps = -rtest-requirements.txt
-rrequirements.txt
commands =
pytest tests/unit tests/integration tests/acceptance \
--cov cromshell \
Expand All @@ -28,16 +29,19 @@ setenv =

[testenv:unit]
deps = -rtest-requirements.txt
-rrequirements.txt
commands =
pytest tests/unit {posargs}

[testenv:integration]
deps = -rtest-requirements.txt
-rrequirements.txt
commands =
pytest tests/integration {posargs}

[testenv:acceptance]
deps = -rtest-requirements.txt
-rrequirements.txt
commands =
pytest tests/acceptance {posargs}

Expand All @@ -49,9 +53,9 @@ deps =
flake8

commands =
black --check --diff --target-version py38 src tests setup.py
isort --check-only --profile black --diff -rc tests src setup.py
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

-rc for isort is deprecated because options now happen by default

flake8 src tests setup.py
black --check --diff --target-version py38 src tests
isort --check-only --profile black --diff tests src
flake8 src tests
pylint --exit-zero src

[testenv:lint-edit]
Expand All @@ -61,9 +65,9 @@ deps =
flake8

commands =
black --target-version py38 src tests setup.py
isort --profile black -rc tests src setup.py
flake8 src tests setup.py
black --target-version py38 src tests
isort --profile black tests src
flake8 src tests
pylint --exit-zero src

[gh-actions]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The original thought was to have this be used during github testing, but the github actions list the python version to test so its is not needed here

Expand Down
Loading