Skip to content

Commit 9de7189

Browse files
committed
some build infrastructure
1 parent e0e8463 commit 9de7189

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

.github/workflows/publish-to-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Install requirements
1515
run: pip install -r requirements.txt
1616
- name: Build a binary wheel and a source tarball
17-
run: python setup.py sdist
17+
run: python setup.py sdist bdist_wheel
1818
- name: Publish distribution package to Test PyPI
1919
uses: pypa/gh-action-pypi-publish@master
2020
with:

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Test docker file
2+
# `docker build .` verifies that the project builds and runs pytest
3+
FROM python:3.12-slim
4+
5+
# Verify wheel can be built
6+
RUN pip install setuptools twine wheel
7+
8+
WORKDIR /app
9+
10+
COPY . /app/
11+
12+
RUN pip install --no-cache-dir .
13+
14+
RUN python setup.py sdist bdist_wheel
15+
16+
RUN python -c "import sys, leetcode; print(f'Package installed successfully in Python {sys.version}'); leetcode.DefaultApi(leetcode.ApiClient(leetcode.Configuration())); print('leetcode package is installed and functional')"
17+
18+
RUN pip install pytest
19+
RUN pytest -vvvv -s

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ virtualenv -p python3 leetcode
2222
pip3 install python-leetcode
2323
```
2424

25-
Then in python shell initialize the client (if you're using chrome, cookies can be found here [chrome://settings/cookies/detail?site=leetcode.com](chrome://settings/cookies/detail?site=leetcode.com))
25+
Then in python shell initialize necessary environment variables. You can get it directly from your browser cookies (csrftoken and LEETCODE_SESSION)
2626
```python
2727
import leetcode
2828

@@ -174,14 +174,29 @@ Autogenerated by swagger documentation can be found [here](/README.generated.md)
174174

175175
## Development
176176

177+
Build package locally and upload to test pypi
178+
```sh
179+
virtualenv .venv
180+
. .venv/bin/activate
181+
pip install setuptools twine wheel
182+
rm -rf build/ dist/ *.egg-info/ *.egg
183+
python setup.py sdist bdist_wheel
184+
twine upload --repository-url https://test.pypi.org/legacy/ dist/*.whl
185+
```
186+
187+
To run tests set up env variables and run this
188+
189+
```sh
190+
docker build --env LEETCODE_SESSION_ID=$LEETCODE_SESSION_ID --env LEETCODE_CSRF_TOKEN=$LEETCODE_CSRF_TOKEN .
191+
```
192+
177193
Test new created package before publishing
178194
```sh
179-
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ python-leetcode==1.2.4
195+
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ python-leetcode==1.2.5
180196
```
181197

182198
Publish package
183199
```sh
184200
git tag 1.2.4
185201
git push --tags
186-
187202
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy