Skip to content
Open
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
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Include all JSON files in the resources directory and its subdirectories
recursive-include src/pyromb/resources *.json
61 changes: 61 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
@echo off
setlocal

REM Verify Python and Pip paths
echo Using Python from:
where python
echo Using pip from:
where pip

REM Check setuptools version
python -m pip show setuptools

REM Upgrade setuptools and wheel
echo Upgrading setuptools and wheel...
python -m pip install --upgrade setuptools wheel

REM Define the directory where the package will be stored
set "PACKAGE_DIR=%~dp0dist"
echo Package directory: %PACKAGE_DIR%

REM Navigate to the directory containing the setup.py script
cd /d "%~dp0"

REM Clean previous builds
if exist "%PACKAGE_DIR%" (
echo Cleaning previous builds...
rmdir /s /q "%PACKAGE_DIR%"
)

REM Build the source distribution and wheel using setuptools
echo Building the package using setuptools...
python setup.py sdist bdist_wheel

REM Check if the build was successful
if %ERRORLEVEL% neq 0 (
echo Build failed. Please check the setup.py and pyproject.toml for errors.
endlocal
pause
goto :EOF
)

REM Create the dist directory if it doesn't exist
if not exist "%PACKAGE_DIR%" mkdir "%PACKAGE_DIR%"

REM Move the generated .tar.gz and .whl files to the desired folder
echo Moving built packages to %PACKAGE_DIR%...
move /Y "dist\*.tar.gz" "%PACKAGE_DIR%" >nul
move /Y "dist\*.whl" "%PACKAGE_DIR%" >nul

REM Check if the move was successful
if %ERRORLEVEL% neq 0 (
echo Failed to move the package to the destination folder.
endlocal
pause
goto :EOF
)

echo Package created and moved to %PACKAGE_DIR% successfully.
endlocal
pause
goto :EOF
41 changes: 41 additions & 0 deletions installer_osgeo4w.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@echo off
setlocal

REM THIS DIDN'T SEEM TO WORK, LIKELY USER ERROR.

REM Activate OSGeo4W environment
call "C:\OSGEO4W\bin\o4w_env.bat"

REM Define the directory where the built package is stored
set "PACKAGE_DIR=%~dp0dist"
echo Package directory: %PACKAGE_DIR%

REM Find the latest version of the package
for /f "delims=" %%i in ('dir /b /o-n "%PACKAGE_DIR%\pyromb-*.whl"') do (
set "LATEST_PACKAGE=%%i"
goto found
)

:found
if "%LATEST_PACKAGE%"=="" (
echo No package found in the directory.
pause
endlocal
goto :EOF
)

echo Installing or updating "%LATEST_PACKAGE%"

REM Install or update the package using pip from the OSGeo4W environment
pip install --upgrade "%PACKAGE_DIR%\%LATEST_PACKAGE%"

REM Check if the installation was successful
if %ERRORLEVEL% equ 0 (
echo Installation completed successfully.
) else (
echo Installation failed. Please check the path and try again.
)

endlocal
pause
goto :EOF
27 changes: 13 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/pyromb"]

[tool.hatch.build]
only-packages = true
exclude = [
".conda",
]
requires = ["setuptools>=61.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "pyromb"
version = "0.2.0"
version = "0.2.2"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

0.2.1

authors = [
{ name="Tom Norman", email="tom@normcosystems.com" }
{ name = "Tom Norman", email = "tom@normcosystems.com" }
]
description = "Runoff Model Builder (Pyromb) is a package used for building RORB and WBNM control files from catchment diagrams built from ESRI shapefiles. Its primary use is in the QGIS plugin Runoff Model: RORB and Runoff Model: WBNM"
readme = "README.md"
requires-python = ">=3.9"

dependencies = [
"shapely",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Remove Shapely and Pyshp dependency and use GDAL. GDAL is packaged with QGIS so will be one less dependency to install.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Apparently Shapely is also packaged with QGIS, but I figured that out after I got GDAL working.

"pyshp",
"matplotlib",
"numpy",
# Add any additional dependencies here
]

classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
Expand All @@ -29,4 +28,4 @@ classifiers = [

[project.urls]
"Homepage" = "https://github.com/norman-tom/pyromb"
"Bug Tracker" = "https://github.com/norman-tom/pyromb/issues"
"Bug Tracker" = "https://github.com/norman-tom/pyromb/issues"
29 changes: 29 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from setuptools import setup, find_packages
import os

# Read the long description from README.md
current_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(current_dir, "README.md"), "r", encoding="utf-8") as fh:
long_description = fh.read()

setup(
name="pyromb",
version="0.2.1",
packages=find_packages(
where="src", exclude=["*.tests", "*.tests.*", "tests.*", "tests"]
),
package_dir={"": "src"},
author="Tom Norman",
author_email="tom@normcosystems.com",
description="Runoff Model Builder (Pyromb) is a package used for building RORB and WBNM control files from catchment diagrams built from ESRI shapefiles. Its primary use is in the QGIS plugin Runoff Model: RORB and Runoff Model: WBNM",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/norman-tom/pyromb",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires=">=3.12",
include_package_data=True, # Ensures inclusion of files specified in MANIFEST.in
)
Loading