-
Notifications
You must be signed in to change notification settings - Fork 5
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
PyPi Setup #37
Merged
Merged
PyPi Setup #37
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a28772c
Updated app-release action
moleculekayak 3f96d2f
Got tests working locally
moleculekayak b2628da
Updated test CI
moleculekayak e4be04c
WIP - set up dev dockerfile
moleculekayak f4ac98e
Reverted pytest shenanigans
moleculekayak ee62ff6
Create a script to consolidate version bumping
moleculekayak 04d1ebb
Added new pypi actions file
moleculekayak 4246d21
Added pip install to 'prod' dockerfile
moleculekayak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Publish Python distribution to PyPI and TestPyPI | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build distribution | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/fertilizer | ||
permissions: | ||
id-token: write # IMPORTANT: mandatory for trusted publishing | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
- name: Install pypa/build | ||
run: python3 -m pip install build twine --user | ||
- name: Build a binary wheel and a source tarball | ||
run: python3 -m build | ||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM python:3.11-slim-buster | ||
|
||
WORKDIR /app | ||
|
||
COPY pyproject.toml docker_start ./ | ||
COPY src src | ||
|
||
RUN apt-get update \ | ||
&& echo "----- Installing python requirements" \ | ||
&& pip install uv \ | ||
&& uv pip install -r pyproject.toml --system --all-extras \ | ||
&& uv pip install -e . --system \ | ||
&& echo "----- Preparing directories" \ | ||
&& mkdir /config /data /torrents \ | ||
&& echo "----- Cleanup" \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
EXPOSE 9713 | ||
|
||
ENTRYPOINT ["./docker_start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
# Get current version from pyproject.toml | ||
CURRENT_VERSION=$(grep "^version = " pyproject.toml | sed "s/^version = \"\(.*\)\"/\1/g") | ||
# Get the new version from stdin | ||
NEW_VERSION=$1 | ||
|
||
echo "Bumping from $CURRENT_VERSION to $NEW_VERSION" | ||
|
||
# Check that the user wants to continue. exit if not | ||
read -p "Continue? (y/n) " -n 1 -r | ||
echo # move to a new line | ||
|
||
if [[ $REPLY =~ ^[Yy]$ ]]; then | ||
# Update the version in the pyproject.toml file | ||
sed -i "" "s/^version = \".*\"/version = \"$NEW_VERSION\"/g" "pyproject.toml" | ||
|
||
# Set the git tag | ||
git tag "v$NEW_VERSION" | ||
fi | ||
Comment on lines
+1
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't be bothered to set up a gh action to bump versions so instead I'll run this locally and it'll handle all the bumping required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if you use
uv sync .
, you can avoid thepythonpath
shenanigans for pytest.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That didn't work immediately, but it looks like
uv pip install -e . --system
did! Good enough for meThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, I think because you want a system-wide installation.
uv sync
creates a virtual environment at$PWD/.venv
.