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

🐍 migrated to src layout #11

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ build/
**/__pycache__/
**/*.pyc
**/*.so
nzthermo/*.c
src/nzthermo/*.c
.egg/
*.egg-info/
.vscode/
.coverage
.reports/
.trash/
.trash/
src/nzthermo/_version.py
18 changes: 14 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
[build-system]
requires = ["setuptools>=58.2.0", "wheel", "Cython>=0.29.23", "numpy>=1.23.4"]
requires = [
"wheel>=0.37.1",
"setuptools>=64",
"setuptools_scm>=8",
"Cython>=0.29.23",
"numpy>=1.23.4",
]
build-backend = "setuptools.build_meta"

[project]
name = "nzthermo"
version = "0.0.1"
dynamic = ["version"]
description = "(N, Z) Thermodynamics"
authors = [{ name = "Jason Leaver", email = "leaver2000@gmail.com" }]
dependencies = ['numpy']

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

[tool.setuptools_scm]
write_to = "src/nzthermo/_version.py"

[tool.pytest]
testpaths = ["tests/"]
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
if tuple(sys.argv[1:3]) == ("clean", "--all"):
# when switching between production and coverage we need to remove the _c.c file to
# ensure that the cython code is recompiled with the correct compiler directives
for file in ("nzthermo/_c.c", "nzthermo/_datetime.c"):
for file in ("src/nzthermo/_c.c", "src/nzthermo/_datetime.c"):
Copy link

Choose a reason for hiding this comment

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

suggestion: Consider using a constant or configuration for the file paths.

Hardcoding file paths can lead to maintenance issues. Consider defining these paths as constants or loading them from a configuration file to make future changes easier.

Suggested change
for file in ("src/nzthermo/_c.c", "src/nzthermo/_datetime.c"):
FILE_PATHS = ("src/nzthermo/_c.c", "src/nzthermo/_datetime.c")
for file in FILE_PATHS:
print(f"removing {file}")
if os.path.exists(file):

print(f"removing {file}")
if os.path.exists(file):
os.remove(file)
Expand Down Expand Up @@ -58,7 +58,7 @@
extension_modules = [
setuptools.Extension(
"nzthermo._c",
["nzthermo/_c.pyx"],
["src/nzthermo/_c.pyx"],
include_dirs=include_dirs,
define_macros=define_macros,
extra_compile_args=extra_compile_args,
Expand Down
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.
File renamed without changes.
File renamed without changes.
Loading