Skip to content

Commit

Permalink
Merge pull request #26 from delvtech/matt-pylint-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sentilesdal authored Nov 8, 2023
2 parents e48d791 + 45c7bfb commit 5b17509
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
TWINE_USERNAME=pypi_username
TWINE_PASSWORD=pypi_password
18 changes: 17 additions & 1 deletion BUILD.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
To create the distribution, run:
To create the distribution, first update the version by updating the version field in the pyproject.toml:

```python
# pyproject.toml

# change this line according to semver
version = "0.0.5"
```

Next, build the distribution:

```bash
python -m build
Expand All @@ -11,3 +20,10 @@ To upload to PyPI run (You'll be prompted for your PyPI credentials):
# twine upload dist/pypechain-[VERSION]*
twine upload dist/pypechain-0.0.1*
```

Optionally, you can setup a .env (see .env.sample) file with your pypi username
and passowrd and run:

```bash
./scripts/upload_latest.sh
```
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]

name = "pypechain"
version = "0.0.4"
version = "0.0.5"
authors = [
{ name = "Dylan Paiton", email = "dylan@delv.tech" },
{ name = "Matthew Brown", email = "matt@delv.tech" },
Expand Down
29 changes: 29 additions & 0 deletions scripts/upload_latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Source the .env file to export the TWINE_USERNAME and TWINE_PASSWORD
if [ -f ".env" ]; then
export $(cat .env | xargs)
else
echo ".env file not found"
exit 1
fi

# Navigate to the dist directory
cd dist || exit 1

# Find the latest version of the package, assuming the naming convention is 'pypechain-VERSION'
# This will extract the version numbers, sort them, and get the highest version
latest_version=$(ls pypechain-*.tar.gz | sort -V | tail -n 1 | sed -E 's/pypechain-(.*)\.tar\.gz/\1/')

# Check if latest_version is not empty
if [[ -z "$latest_version" ]]; then
echo "No distribution files found for upload."
exit 1
fi

# Use twine to upload all packages for the latest version
# The * after the version number is important to match all files for the version
twine upload "pypechain-${latest_version}"*

# Navigate back to the original directory
cd -

0 comments on commit 5b17509

Please sign in to comment.