Add Python build configuration and packaging setup#5
Add Python build configuration and packaging setup#5mdellison90-stack with Copilot wants to merge 3 commits into
Conversation
Co-authored-by: mdellison90-stack <230609064+mdellison90-stack@users.noreply.github.com>
Co-authored-by: mdellison90-stack <230609064+mdellison90-stack@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb41a67a0e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| long_description=long_description, | ||
| long_description_content_type="text/markdown", | ||
| url="https://github.com/yasinkuyu/binance-trader", | ||
| packages=find_packages(), |
There was a problem hiding this comment.
Fix
app imports before exposing it as a setuptools package
Packaging app via find_packages() makes callers import modules as app.*, but the package still uses source-checkout-only imports such as import config and from Database import Database in app/Trading.py. In a clean editable/wheel install, import app.Trading now fails with ModuleNotFoundError unless the user also manually prepends ./app to sys.path, so the new pip install -e . workflow cannot actually load the bot outside the repo root.
Useful? React with 👍 / 👎.
| long_description=long_description, | ||
| long_description_content_type="text/markdown", | ||
| url="https://github.com/yasinkuyu/binance-trader", | ||
| packages=find_packages(), |
There was a problem hiding this comment.
Install the bot entry points with the new package metadata
This setup only publishes the app package. trader.py and balance.py stay outside any package, and there is no scripts= or entry_points= declaration here, so the built wheel/sdist contains no executable to start the bot. After installing from a distribution artifact, users cannot run the workflow described in README.md; python trader.py still works only from a git checkout.
Useful? React with 👍 / 👎.
| exclude .dockerignore | ||
| global-exclude __pycache__ | ||
| global-exclude *.py[cod] | ||
| global-exclude *.db |
There was a problem hiding this comment.
Ship the sample database instead of excluding all
.db files
app/Database.py opens ../db/orders.db at import time, and README.md still tells users to rename db/orders.sample.db to orders.db. With this global-exclude *.db, the source distribution no longer contains any db/ directory or sample database, so following the packaged install path leaves users with no file to rename and the bot dies with sqlite3.OperationalError: unable to open database file unless they hand-create the database.
Useful? React with 👍 / 👎.
The project lacked standard Python packaging infrastructure, requiring manual dependency installation and preventing pip-based workflows.
Changes
Build Configuration
requirements.txt- declares requests dependencysetup.py- enablespip install -e .with package metadatarequirements-dev.txt- adds pytest, flake8, black, mypy for developmentMANIFEST.in- excludes database files from distributionsPackage Structure
app/__init__.py- makes app a discoverable package for setuptoolsDocker & Ignores
Dockerfile- uses requirements.txt for better layer caching.gitignore- excludes__pycache__,*.egg-info,dist/,build/, virtual environmentsUsage
Dependencies verified against GitHub Advisory Database - no vulnerabilities found.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.