Skip to content

Commit 539743e

Browse files
pyproject.toml-upgrade (#6)
* Created pyproject.toml and removed setup.py * Remove requirement*.txt files * Add 'Bump My Version' config * Update all the versions to the latest * Make flask work with api-spec * Docker support - Use Python 3.13 - Update Dockerfile to use uv - Update docker targets in Makefile * Removed HISTORY file * package in src/ and Docker build - Moved package under src/ - Dockerfile builds image * Update dockerfile and project * Update all the versions to the latest Fix Conflicts * Make flask work with api-spec * Use uv in GitHub Action * Use ruff instead of black in CI * Update bug_report template * README and CONTRIBUTING.md updated * Docker Fix - Fix final sync - Use script for app start
1 parent fe38053 commit 539743e

File tree

4 files changed

+143
-141
lines changed

4 files changed

+143
-141
lines changed

CONTRIBUTING.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Contributing
2+
3+
Contributions are welcome, and they are greatly appreciated! Every
4+
little bit helps, and credit will always be given.
5+
6+
You can contribute in many ways:
7+
8+
## Types of Contributions
9+
10+
### Report Bugs
11+
12+
Report bugs at
13+
<https://github.com/nmdp-bioinformatics/my_project_template/issues>.
14+
15+
If you are reporting a bug, please include:
16+
17+
- Your operating system name and version.
18+
- Any details about your local setup that might be helpful in
19+
troubleshooting.
20+
- Detailed steps to reproduce the bug.
21+
22+
### Fix Bugs
23+
24+
Look through the GitHub issues for bugs. Anything tagged with "bug"
25+
and "help wanted" is open to whoever wants to implement it.
26+
27+
### Implement Features
28+
29+
Look through the GitHub issues for features. Anything tagged with
30+
"enhancement" and "help wanted" is open to whoever wants to
31+
implement it.
32+
33+
### Write Documentation
34+
35+
My Project Template could always use more documentation, whether as part
36+
of the official My Project Template docs, in docstrings, or even on the
37+
web in blog posts, articles, and such.
38+
39+
### Submit Feedback
40+
41+
The best way to send feedback is to file an issue at
42+
<https://github.com/nmdp-bioinformatics/my_project_template/issues>.
43+
44+
If you are proposing a feature:
45+
46+
- Explain in detail how it would work.
47+
- Keep the scope as narrow as possible, to make it easier to implement.
48+
- Remember that this is a volunteer-driven project, and that
49+
contributions are welcome :)
50+
51+
## Get Started!
52+
53+
Ready to contribute? Here's how to set up for local development.
54+
55+
1. Fork the repo on GitHub.
56+
57+
2. Clone your fork locally:
58+
59+
``` shell
60+
$ git clone [email protected]:your_name_here/my_project_template.git
61+
```
62+
63+
3. Install your local copy into a virtual environment. This is how you
64+
set up your fork for local development:
65+
66+
``` shell
67+
$ cd my_project_template/
68+
$ make venv
69+
$ source .venv/bin/activate
70+
$ make install
71+
$ make sync
72+
```
73+
74+
4. Create a branch for local development:
75+
76+
``` shell
77+
$ git checkout -b name-of-your-bugfix-or-feature
78+
```
79+
80+
Now you can make your changes locally.
81+
82+
5. When done making changes, check that your changes pass
83+
flake8 and the tests, including testing other Python versions with
84+
tox:
85+
86+
``` shell
87+
$ pre-commit
88+
$ make test
89+
```
90+
91+
6. Commit your changes and push your branch to GitHub:
92+
93+
``` shell
94+
$ git add .
95+
$ git commit -m "Your detailed description of your changes."
96+
$ git push origin name-of-your-bugfix-or-feature
97+
```
98+
99+
7. Submit a pull request through the GitHub website.
100+
101+
## Pull Request Guidelines
102+
103+
Before you submit a pull request, check that it meets these guidelines:
104+
105+
1. The pull request should include tests.
106+
2. If the pull request adds functionality, the docs should be updated.
107+
Put your new functionality into a function with a docstring, and add
108+
the feature to the list in README.rst.
109+
3. The pull request should work for Python 3.6 and higher.
110+
111+
## Tips
112+
113+
To run a subset of tests:
114+
115+
``` shell
116+
$ pytest tests.test_my_project_template
117+
```
118+
119+
## Release a new version
120+
121+
Make sure all your changes are committed. Then run:
122+
123+
``` shell
124+
$ bump-my-version bump patch -vv # possible: major / minor / patch
125+
$ git push
126+
```
127+
Maintainer can publish a release, which will submit to PyPi.

CONTRIBUTING.rst

Lines changed: 0 additions & 126 deletions
This file was deleted.

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ ENV PYTHONPATH="/app/.venv/lib/python3.13/site-packages/:"
4444
# Sync the project into a new environment, asserting the lockfile is up to date
4545
COPY pyproject.toml /app/
4646
COPY uv.lock /app/
47-
RUN /bin/uv sync --locked --group deploy
47+
RUN uv sync --no-build --no-install-project --locked --group deploy
4848

49-
CMD [".venv/bin/gunicorn" , "--bind", "0.0.0.0:8080", "--worker-tmp-dir", "/dev/shm", "app:app"]
49+
CMD ["/app/run-app.sh"]

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ My Project Template
44

55
How to use the template:
66

7-
1. Create a template by clicking on the "Use this template" button. Make sure to select all branches
7+
1. Click on the top-right green "Use this template" button. Make sure to select all branches
88
This will create a new repository with the given name e.g. `urban-potato`
99
2. Clone the repository locally
1010
```shell
@@ -14,14 +14,13 @@ How to use the template:
1414
3. Make a virtual environment and activate it, run `make venv`
1515
```shell
1616
> make venv
17-
python3 -m venv venv --prompt urban-potato-venv
18-
=====================================================================
19-
To activate the new virtual environment, execute the following from your shell
20-
source venv/bin/activate
21-
```
17+
Using CPython 3.13.7
18+
Creating virtual environment at: .venv
19+
Activate with: source .venv/bin/activate
20+
```
2221
4. Source the virtual environment
2322
```shell
24-
source venv/bin/activate
23+
source .venv/bin/activate
2524
```
2625
5. Development workflow is driven through `Makefile`. Use `make` to list show all targets.
2726
```
@@ -30,21 +29,23 @@ How to use the template:
3029
clean-build remove build artifacts
3130
clean-pyc remove Python file artifacts
3231
clean-test remove test and coverage artifacts
33-
lint check style with flake8
32+
lint check style with ruff
3433
behave run the behave tests, generate and serve report
3534
pytest run tests quickly with the default Python
3635
test run all(BDD and unit) tests
3736
coverage check code coverage quickly with the default Python
3837
dist builds source and wheel package
3938
docker-build build a docker image for the service
40-
docker build a docker image for the service
41-
install install the package to the active Python's site-packages
39+
docker build a docker image and run the service
40+
sync install the package to the active Python's site-packages
41+
install Sync pyproject.toml to .venv as well as install tools
4242
venv creates a Python3 virtualenv environment in venv
4343
activate activate a virtual environment. Run `make venv` before activating.
4444
```
45-
6. Install all the development dependencies. Will install packages from all `requirements-*.txt` files.
45+
6. Install and sync all the project and development dependencies.
4646
```shell
4747
make install
48+
make sync
4849
```
4950
7. The Gherkin Feature files, step files and pytest files go in `tests` directory:
5051
```
@@ -60,7 +61,7 @@ How to use the template:
6061
`-- unit
6162
`-- test_my_project_template.py
6263
```
63-
8. Package Module files go in the `my_project_template` directory.
64+
8. Package Module files go in the `src/my_project_template` directory.
6465
```
6566
my_project_template
6667
|-- __init__.py
@@ -72,6 +73,6 @@ How to use the template:
7273
`-- my_project_template.py
7374
```
7475
9. Run all tests with `make test` or different tests with `make behave` or `make pytest`. `make behave` will generate report files and open the browser to the report.
75-
10. Use `python app.py` to run the Flask service app in debug mode. Service will be available at http://localhost:8080/
76+
10. Use `uv run app.py` to run the Flask service app in debug mode. Service will be available at http://localhost:8080/
7677
11. Use `make docker-build` to build a docker image using the current `Dockerfile`.
7778
12. `make docker` will build and run the docker image with the service. Service will be available at http://localhost:8080/

0 commit comments

Comments
 (0)